Commit graph

54935 commits

Author SHA1 Message Date
Fabio Baltieri
ef93bbad57 linker: add an initialized DATA_SECTIONS linker location option
Current location options for linker source files includes init and
noinit ram data, but only a noinit ram section. This makes it impossible
for application code to define an initialized RAM output section,
such as with the Z_ITERABLE_SECTION_RAM() helpers.

Adding a DATA_SECTIONS linker source option for this use case.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2021-08-07 20:26:41 -04:00
Scott Worley
114b84a58b Microchip: XEC GPIO driver interrupt enable fix part 2
Fixes issue 34879
This PR updates previous PR's 37138 and 37139.
Refer to issue 34879 for information from MCHP HW
designers. A delay after enabling interrupts is a
more appropriate work-around than depending upon
behavior of ARM DMB instruction.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-08-07 20:24:37 -04:00
Martí Bolívar
d1eee6a966 linker: rename DT_REGION_FROM_NODE_STATUS_OKAY
The main motivation is to avoid polluting the all-caps "DT_"
namespace, which within zephyr belongs to devicetree.h.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-07 20:24:13 -04:00
Ramesh Babu B
d40d963bef net: fix for assert on enabling socket CAN
Socket CAN does not require interface link address to be
assigned, check is not applicable for socket CAN
interfaces. As this address is NULL for socket CAN interface
it results in assertion.

Signed-off-by: Ramesh Babu B <ramesh.babu.b@intel.com>
2021-08-07 20:10:48 -04:00
Gerard Marull-Paretas
8b0d3450a0 pm: device: use z_device_get_all_static
Use the internal function z_device_get_all_static helper function
instead of using __device_start and __device_end directly. Some other
minor adjustments have been done (e.g. reduce *dev scope to the for
loop). An issue on the range of the for loop in _pm_devices has also
been fixed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-07 19:59:48 -04:00
Gerard Marull-Paretas
7e7b222d84 pm: device: simplify suspend checks
The shared _pm_devices function used should_suspend check function to
see if a device had to be suspended or not. Some of the logic inside
that function was redundant since the pm_device_state_set function
already performs similar checks, e.g. if the device is already at the
given state or the state transition is not supported it will return
error codes appropriately.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-07 19:59:48 -04:00
Gerard Marull-Paretas
f93778f2d2 pm: device: do not allow suspending a turned off device
A device that is turned off should not be suspended. A device that has
been turned off can only be resumed. This action is currently forbidden
by the "should_suspend" function in the device PM code.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-07 19:59:48 -04:00
Felipe Neves
4a0b5ce277 soc: riscv: esp32c3: fix ble controller init
By appending the right link layer controller configurarion

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-08-07 19:59:27 -04:00
Felipe Neves
2a5c37829d soc: riscv: esp32c3: make use of atomic in C
esp32c3 SoC is an rv32imc, so it does not support the atomic builtin.

Since it relies in atomic instructions.

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-08-07 19:59:27 -04:00
Felipe Neves
2474c9b3f3 soc: riscv: esp32c3: added initial support for ble
subsystem by linking esp32 vhci adapter to the
espressif ble controller adapter

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-08-07 19:59:27 -04:00
Gerson Fernando Budke
7163473d66 boards: atmel soc: Remove non-minimal peripherals from defconfig
Some boards, e.g. atsamd20_xpro, enable non-minimal peripherals by
default like SPI.  This goes against board porting guidelines, as it
enables a peripheral that is not necessarily used by all samples,
as discussed at #30694.  This removes SPI as a default peripheral
for all sam/sam0 boards.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-08-06 21:21:52 -04:00
David Leach
569a1a0a5d soc: arm: nxp_imx: rt: Configure settings for TRNG IP
RT platforms that support TRNG IP (rt10xx and rt6xx) need to set
RNG and CSRNG to Xoroshiro and CTR_DRBG respectively instead of
using TRNG as random source.

Fixes: #37307

Signed-off-by: David Leach <david.leach@nxp.com>
2021-08-06 20:29:59 -04:00
Enjia Mai
ee327803e3 tests: common: skip arch_nop testing on some physical x86 board
Using the NOP instructions to do timing control on some physical board
such as ehl_crb, up_squared and intel adsp board, that doesn't work.
It seems like it can only be used for instruction alignment purposes.
We skip this test on this board because it's not meaningful.

Fixes #35971

Signed-off-by: Enjia Mai <enjiax.mai@intel.com>
2021-08-06 20:20:32 -04:00
Emil Lindqvist
dab4616e45 net: socket: fix regression causing corrupted poll timeout
k_timeout_t was converted to ticks using a nonsense function
causing poll timeout corruption for offloaded sockets; this
commit uses ticks directly from the struct instead.

Fixes #37472

Signed-off-by: Emil Lindqvist <emil@lindq.gr>
2021-08-06 19:20:48 -04:00
Emil Lindqvist
f9023d2c41 net: sockets: dtls: reset mbedtls session on timed out handshake
According to MbedTLS API documentation, its session must be
reset if mbedtls_ssl_handshake returns timeout error. This
commit resets the session for said return value, and that
allows us to call send() multiple times even if handshake
times out for previous calls.

Fixes #35711

Signed-off-by: Emil Lindqvist <emil@lindq.gr>
2021-08-06 19:19:26 -04:00
Andrzej Głąbek
bff5d03581 boards: nrf: Enable pull-ups on UART pins in Nordic DKs
This is a follow-up to commit 3656ba5ae9.

Enable pull-up resistors on UART pins RXD and CTS in Nordic DK boards
where it is possible that these pins are not connected to anything on
the board and could generate problems if left floating (on some DKs
also the Interface MCU can be disconnected with the switch "nRF only",
hence pull-ups enabled also on uart0 for them).
Those pull-ups can still be disabled (by deleting the added properties)
if necessary to use a given board in some specific hardware setup.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-08-06 19:17:26 -04:00
Andrzej Głąbek
3842babc79 drivers: serial: nrf: Make pull-ups on UART pins configurable
This is a follow-up to commit 3656ba5ae9.

Do not enforce pull-up resistors to be enabled on RXD and CTS pins
in nRF UART drivers, as in certain hardware designs this may be
undesirable or may even make certain hardware not working.
Instead, provide devicetree properties that allow enabling of those
resistors when it is actually needed.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-08-06 19:17:26 -04:00
Martí Bolívar
fd73eb8b60 doc: dts: macros.bnf: add docs for new for-each macros
Document the new DT_FOREACH_OKAY_INST_<compat> and
DT_FOREACH_OKAY_INST_VARGS_<compat> macros that are generated by
gen_defines.py and explain how they are used in devicetree.h.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-06 12:24:57 -05:00
Martí Bolívar
9bd8534040 doc: dts: macros.bnf: fix a comment
This is referring to the wrong macro.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-06 12:24:57 -05:00
Martí Bolívar
56da140791 devicetree: add new for-each macros
Add two new for-each macros:

- DT_FOREACH_STATUS_OKAY(compat, fn)
- DT_FOREACH_STATUS_OKAY_VARGS(compat, fn, ...)

These can be used to expand "fn" once for every status "okay" node in
the devicetree which has a given compatible. The intended use case is
to allow doing something in C once for each node of a compatible,
but outside of a device driver.

E.g. an application might want to collect an array of structures for a
compatible, where each structure is initialized from a node.

In such cases we don't want people to be forced into using
DT_DRV_COMPAT and instance numbers, because that's in general a hint
that you're doing something driver-like.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-06 12:24:57 -05:00
Martí Bolívar
e7d42ff879 dts: gen_defines: emit more for-each helpers
Add some helper macros that work similarly to the
'DT_FOREACH_OKAY_INST_<compat>(fn)' macros, except they give 'fn'
node identifiers in their expansion instead of instance numbers.

This makes it possible to add for-each APIs to devicetree.h that work
on an arbitrary compatible, not just DT_DRV_COMPAT.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-06 12:24:57 -05:00
Martí Bolívar
1c4aa60229 tests: devicetree: refactor some for-each tests
Split the generic tests for DT_INST_FOREACH_STATUS_OKAY() out of the
function which tests it as applied to device instantiation.

This is just moving code around as prep work for expanding on the set
of macros which are in for-each-node style.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-06 12:24:57 -05:00
Evgeniy Paltsev
1ffd1ea8fd test: lib/cbprintf_fp: fix test filtering
The commit
6fe9e408ab (tests/cbprintf_fp: Filter on CONSOLE_HAS_DRIVER)
added filtering on Kconfig symbol incorrectly - it checked
CONSOLE_HAS_DRIVER instead CONFIG_CONSOLE_HAS_DRIVER so
this test was filtered out (and therefore skipped) on all
platforms.

Fix that.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-08-06 08:00:54 -05:00
Jamie McCrae
46d6b8f528 boards: arm: pinnacle_100_dvk: Update clock error
The 32KHz crystal used is a tuning fork crystal which can have a larger
clock drift over temperature than an AT cut crystal, therefore the LFXO
clock source error rate needs updating to account for this possible
drift over temperature.

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2021-08-06 07:57:28 -05:00
Jamie McCrae
e09b700df0 boards: arm: bt6x0: Update clock error
The 32KHz crystal used is a tuning fork crystal which can have a larger
clock drift over temperature than an AT cut crystal, therefore the LFXO
clock source error rate needs updating to account for this possible
drift over temperature.

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2021-08-06 07:57:28 -05:00
Jamie McCrae
adedf635a0 boards: arm: bt510: Update clock error
The 32KHz crystal used is a tuning fork crystal which can have a larger
clock drift over temperature than an AT cut crystal, therefore the LFXO
clock source error rate needs updating to account for this possible
drift over temperature.

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2021-08-06 07:57:28 -05:00
Jamie McCrae
6922ff6ae5 boards: arm: bl654_sensor_board: Update clock error
The 32KHz crystal used is a tuning fork crystal which can have a larger
clock drift over temperature than an AT cut crystal, therefore the LFXO
clock source error rate needs updating to account for this possible
drift over temperature.

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2021-08-06 07:57:28 -05:00
Jamie McCrae
89ec5d30ca boards: arm: bl5340_dvk: Update clock error
The 32KHz crystal used is a tuning fork crystal which can have a larger
clock drift over temperature than an AT cut crystal, therefore the LFXO
clock source error rate needs updating to account for this possible
drift over temperature.

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2021-08-06 07:57:28 -05:00
Emil Gydesen
57fc354f6c Bluetooth: ISO: Fix iso channels not disconnecting properly
We had added a break in a switch statement that stopped
ISO channels from setting the BT_CONN_CLEANUP flag
which in turn stopped them from disconnecting (in the
eyes of the upper layers) properly.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-05 15:08:06 -04:00
Emil Gydesen
b1f4764f4f Bluetooth: ISO: Add clearer error message on iso accept failure
Instead of just writing "err" we make it clear that it is
the ISO server that failed to accept.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-05 15:08:06 -04:00
Emil Gydesen
7f3a085a7a Bluetooth: shell: ISO change to use shell_print instead of printk
shell_print is preffered for the shell as printk may appear
in a different terminal.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-05 15:08:06 -04:00
Lingao Meng
ce40fa434f tester: bluetooth: gatt: fix null pointer case CASE failed
GATT/SR/GAD/BV-03-C will read attr value, but we parse NULL
from `attr->read` which point to `attr_read` function.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-08-05 17:34:57 +02:00
Jan Pohanka
1df0569001 drivers: ethernet: eth_stm32_hal.c: add wait time for buffer allocation
Driver's RX thread can wait some time before a free buffer is available.
When resources are limited we can easily run out of them.

Fixes #36891.

Signed-off-by: Jan Pohanka <xhpohanka@gmail.com>
2021-08-05 11:32:42 -04:00
Krzysztof Chruscinski
f923779e4d tests: drivers: counter: Extend basic api test with ZLI support
Modified test to handle case when counter handlers are called in
ZLI interrupt context where kernel primitives cannot be used. In
that case volatile counters are used to track number of handlers
calls.

Added configuration for nrf52840dk board where zli feature is enabled
for all counters.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-08-05 16:17:23 +02:00
Krzysztof Chruscinski
0419ff72aa drivers: counter: nrfx_timer: Add option to use ZLI interrupt
Extended driver configuration in device tree to enable ZLI interrupt.
When zli is set in the device tree then event handlers for alarm and
top is called in ZLI interrupt context. It means that kernel primitives
cannot be used there.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-08-05 16:17:23 +02:00
Krzysztof Chruscinski
53333d58bf drivers: counter: nrfx_rtc: Add option to use ZLI interrupt
Extended driver configuration in device tree to enable ZLI interrupt.
When zli is set in the device tree then event handlers for alarm and
top is called in ZLI interrupt context. It means that kernel primitives
cannot be used there.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-08-05 16:17:23 +02:00
Martí Bolívar
0dbe619f74 net/socket_select.h: add missing include
Macros such as __syscall must be defined before use.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-05 16:14:36 +02:00
Lukasz Maciejonczyk
53531a7682 openthread: implement missing time service functionality
Add missing otPlatTimeGet implementation which is needed for proper
calculation the time offset in host-RCP communication.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2021-08-05 16:14:24 +02:00
Martí Bolívar
6fe3c30af7 scripts: check_compliance: fix filter_py edge case
The filter_py() function is handed a bunch of file names and is
expected to give back just the python files.

Its input is the output from a 'git diff' command which normally when
used in the vanilla zephyr repository just prints regular files.

In situations where we're checking compliance on a repository with
submodules, however, filter_py() can be given directories in the
'fnames' list from the git output.

In the interests of being defensive and sharing infrastructure, just
handle this case in filter_py().

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-05 16:14:12 +02:00
Jordan Yates
3e6598e7d9 gpio: fixup doxygen on _dt functions
Fixup the doxygen comments for return values on `_dt` functions.
@retval should only be used when specifying actual return values,
@return is more general and can refer to other functions.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-05 16:13:54 +02:00
Johann Fischer
5a35745b44 usb: fix SetInterface handling for interfaces without any endpoints
With the last changes in USB device stack it was unfortunately
not considered that an interface can have no endpoints.
This caused the USB DFU class to stop working in DFU mode.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-05 16:13:10 +02:00
Yuriy Vynnychek
84db9cd36a drivers: pwm: introduce new Telink B91 PWM driver
PWM driver basic support for Telink B91 SoC.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-08-05 16:11:41 +02:00
Yuriy Vynnychek
0c483a25ca boards: riscv: tlsr9518adk80d: add Telink B91 PWM driver support
Added PWM driver board support.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-08-05 16:11:41 +02:00
Yuriy Vynnychek
0830738975 dts: riscv: add Telink B91 PWM driver support
Added PWM driver DTSI support for Telink B91 platform.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-08-05 16:11:41 +02:00
Dario Binacchi
c3ee515865 drivers: can: stm32: fix typo in a comment
Replace 'mailbix' with 'mailbox' in drivers/can/can_stm32.c.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
2021-08-05 16:11:11 +02:00
Dario Binacchi
f4e9ec5392 drivers: can: stm32: drop exit from sleep mode
Before entering initialization mode, we left sleep mode, then request
to leave again sleep mode before returning from can_stm32_init() is
useless.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
2021-08-05 16:11:11 +02:00
Dario Binacchi
b1097df26e drivers: can: stm32: remove useless mcr setting
Disabling the time-triggered communication mode (TTCM) is done twice in
the setting of the master control register (MCR). So, let's remove the
second.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
2021-08-05 16:11:11 +02:00
Johann Fischer
3aa48613b1 usb: cdc_acm: add support for poll in to UART driver
Use cdc_acm_fifo_read() to support poll in.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-05 16:08:39 +02:00
Johann Fischer
9973314ea2 usb: cdc_acm: fix CDC ACM IAD initialization
CONFIG_CDC_ACM_IAD option should also be considered.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-05 16:08:39 +02:00
Johann Fischer
ef18329051 usb: cdc_acm: rework descriptors, config, and data definitions macros
Simplify and rearrange the macros, remove unnecessary arguments.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-05 16:08:39 +02:00