Commit graph

94333 commits

Author SHA1 Message Date
Andrzej Kaczmarek fbc7a9e209 soc: arm: smartbond: Add support for extended sleep
This enabled extended sleep for Renesas SmartBond(tm).

Extended sleep is low power mode where ARM core is powered off and can
be woken up by PDC. This is default sleep mode when CONFIG_PM is
enabled.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2024-04-25 16:17:53 +02:00
Andrzej Kaczmarek 8ccc345c6e soc: arm: smartbond: Always select PLATFORM_SPECIFIC_INIT
Platform specific init is needed once power management is introduced.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2024-04-25 16:17:53 +02:00
Andrzej Kaczmarek 6307d8de78 drivers: timer: Add timer driver to Renesas SmartBond(tm)
This adds timer driver for Renesas SmartBond(tm) family.
It uses TIMER2 block which is in PD_TIM power domain so it can work even
if ARM core is disabled, thus can work as a sleep timer.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2024-04-25 16:17:53 +02:00
Jordan Yates 3247a1db81 modules: mbedtls: option for MBEDTLS_HKDF_C
Add kconfig option to enabled `MBEDTLS_HKDF_C`, HMAC-based
Extract-and-Expand Key Derivation Function.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-04-25 09:46:52 -04:00
Mateusz Holenko 6784ed8202 boards: nxp: Add compatible for RD_RW612_BGA
Add `compatible` entry for the rd_rw612_bga target.

Signed-off-by: Mateusz Hołenko <mholenko@antmicro.com>
2024-04-25 09:46:39 -04:00
Grzegorz Swiderski a0df4272ac dts: broadcom: Move viper-common.dtsi to dts/common
Squash the two copies of this file found in `dts/arm` and `dts/arm64`.
Their contents were identical up to devicetree property ordering.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2024-04-25 09:46:25 -04:00
Grzegorz Swiderski 3ddfa67655 dts: broadcom: Remove old copy of viper-a72.dtsi
This file was moved to the `dts/arm64` directory 3 years ago:
3539c2fbb3

However, the original file in `dts/arm` was left by mistake. Since then,
it's been unused and seldom updated, but it hasn't diverged much.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2024-04-25 09:46:25 -04:00
Håvard Reierstad f597e7d2a9 doc: Bluetooth: Mesh: Remove experimental DFU statement
Removes statement saying the implementation for Mesh DFU is
experimental.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2024-04-25 09:45:51 -04:00
Joel Guittet d9e5aa46b6 samples: display: lvgl: add esp32-s3-touch-lcd-1.28 config
Add configuration for the Waveshare ESP32-S3-Touch-LCD-1.28 board.

Signed-off-by: Joel Guittet <joelguittet@gmail.com>
2024-04-25 15:12:35 +02:00
Joel Guittet 277c558e47 samples: drivers: adc: add esp32-s3-touch-lcd-1.28 overlay
Add configuration for the Waveshare ESP32-S3-Touch-LCD-1.28 board.

Signed-off-by: Joel Guittet <joelguittet@gmail.com>
2024-04-25 15:12:35 +02:00
Joel Guittet 6d91c528a0 boards: xtensa: add support for waveshare esp32-s3-touch-lcd-1.28
Add support for the Waveshare ESP32-S3-Touch-LCD-1.28 board, including
support the LCD and touchscreen controllers. Tested with samples
already available.

Signed-off-by: Joel Guittet <joelguittet@gmail.com>
2024-04-25 15:12:35 +02:00
Caspar Friedrich 666a89221b drivers: adc: tla2021: Fix reference voltage
This fixes the problem that `adc_raw_to_millivolts` only returns half of
the actual voltage.

Signed-off-by: Caspar Friedrich <c.s.w.friedrich@gmail.com>
2024-04-25 15:12:14 +02:00
Andy Ross 02b24911f7 kernel/sched: Fix lockless ordering in halt_thread()
We've had threads spinning on the thread state bits, but weren't being
careful to ensure that those bits were the last things seen to change
in a halting thread.  Move it to the end, and add a barrier for
correctness.

Signed-off-by: Andy Ross <andyross@google.com>
2024-04-25 15:12:02 +02:00
Andy Ross 20611f13ca sched: Optimize dummy thread usage on SMP
Nicolas Pitre points out that since these thread structs are just
dummies for the context swtiching, they can be presumed to be "write
only" and thus there's no point in having one per CPU, everyone can
share the same one.

The only gotcha is that we never really documented (nor really have a
place to document) that rule, so it's not theoretically impossible for
an architecture to read back what it might have written underneath
arch_switch().  Leave this in a separate commit for bisection
purposes, but the risk seems very low.

Signed-off-by: Andy Ross <andyross@google.com>
2024-04-25 15:12:02 +02:00
Peter Mitsis 9f4d9989c6 tests: thread abort deadlock scenario
Adds a test to verify that a series of k_thread_abort() issued from
ISRs do not cause a deadlock.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2024-04-25 15:12:02 +02:00
Andy Ross 3ef282be6c tests/kernel/threads: Augment abort_from_isr test to detect FMW
There's a easily-tripped-upon free memory write condition in the arch
layers where they will write to a cached _current pointer after that
thread has been aborted.  Detect this by clobbering the thread data
after the return from k_thread_abort() and validating that it's still
clear after the ISR returns.

Note that the clobbering of the thread struct requires the removal of
a k_thread_join() that (obviously) requires that it see a DEAD flag
set.  Joining aborted threads isn't actually legal, but does still
work as long as app code doesn't reuse the memory.  Basically we can't
test both cases here, and we have join coverage elsewhere already.

Signed-off-by: Andy Ross <andyross@google.com>
2024-04-25 15:12:02 +02:00
Andy Ross 61c70626a5 kernel/sched: Fix free-memory write when ISRs abort _current
After a k_thread_abort(), the resulting thread struct is documented as
unused/free memory that may be re-used (for example, to respawn a new
thread).

But in the special case of aborting the current thread from within an
ISR, that wasn't quite happening.  The scheduler cleanup would
complete, but the architecture layer would still try to context switch
away from the aborted thread on exit, and that can include writes to
the now-reused thread struct!  The specifics will depend on
architecture (some do a full context save on entry, most don't), but
in the case of USE_SWITCH=y it will at the very least write the
switch_handle field.

Fix this simply, with a per-cpu "switch dummy" thread struct for use
as a target for context switches like this.  There is some non-trivial
memory cost to that; thread structs on many architectures are large.

Pleasingly, this also addresses a known deadlock on SMP: because the
"spin in ISR" step now happens as the very last stage of
k_thread_abort() handling, the existing scheduler lock works to
serialize calls such that it's impossible for a cycle of threads to
independently decide to spin on each other: at least one will see
itself as "already aborting" and break the cycle.

Fixes #64646

Signed-off-by: Andy Ross <andyross@google.com>
2024-04-25 15:12:02 +02:00
Andy Ross 93dc7e7438 kernel/spinlock: Fix SPIN_VALIDATE in ISRs
Spinlocks taken in ISRs were storing the _current thread pointer of
the interrupted thread as the owner, which was never strictly correct
but was benign as the thread would never run until the lock was
released.

But now k_thread_abort(_current) in an ISR has been fixed to eliminate
all references to the (now aborted) thread struct, and _current points
to a dummy thread.  Handle that edge case in the validation framework.

Signed-off-by: Andy Ross <andyross@google.com>
2024-04-25 15:12:02 +02:00
Andy Ross 9b43fed10a tests/kernel: Bump kobj thread bitmask size for a few tests
A scheduler fix for free memory usage on aborted threads is now using
a per-CPU dummy thread instead of a single stack-based one at startup.
These static thread objects need spots in the kobj bitmasks, and a few
tests are sitting right at the default limit (16 threads).

Signed-off-by: Andy Ross <andyross@google.com>
2024-04-25 15:12:02 +02:00
Andy Ross 5fa2b6f377 kernel/sched: Refeactor/cleanup z_thread_halt()
Big change is to factor out a thread_halt_spin() utility to manage the
core complexity of this code: the situation where an ISR is asked to
abort a thread already running on another SMP CPU.

With that gone, things can be cleaned up quite a bit.  Remove early
returns, most of the "#if CONFIG_SMP" usage was superfluous and will
optimize out, unify and clean up the comments, etc...

No behavioral changes (hopefully), just refactoring.

Signed-off-by: Andy Ross <andyross@google.com>
2024-04-25 15:12:02 +02:00
Aleksander Wasaznik 2a7adae6c1 Bluetooth: Rename num_complete_pool -> sync_evt_pool
Refactor only. The surrounding ifdefs are intentionally not changed in
this patch. They will be in the near future.

Rename the pool and generalize the documentation to allow using this
pool for other events that fit the same criteria. This pool can be used
for any buffer that is processed synchronously, without negatively
affecting 'num complete' messages. E.g. 'cmd complete/status' can be put
in this pool already.

We will be working towards making the host process all event buffers
synchronously. This is because events have no dedicated flow control,
and discarding events in the driver without informing the host creates
problems. Discarding should instead happen in the host higher layers
when unavoidable.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-04-25 15:10:50 +02:00
Benjamin Lemouzy 21e111c469 boards: mimxrt1050_evk: doc: add SWD related jumpers for rev B1
Add jumpers used for SWD on rev B1 boards.

Signed-off-by: Benjamin Lemouzy <blemouzy@centralp.fr>
2024-04-25 15:10:37 +02:00
Marcin Szymczyk 0ea7bf19e4 arch: riscv: irq_manage: support ISR_OFFSET in dynamic IRQs
`CONFIG_RISCV_RESERVED_IRQ_ISR_TABLES_OFFSET` shoud be taken into
account in `arch_irq_connect_dynamic`, same as it is done in
`ARCH_IRQ_CONNECT` macro.

Signed-off-by: Marcin Szymczyk <marcin.szymczyk@nordicsemi.no>
2024-04-25 15:03:23 +02:00
Daniel DeGrasse 7150877801 doc: develop: flash_debug: add note for LinkServer breakpoints
LinkServer does not set a breakpoint at reset by default when debugging
platforms, so if the user single steps after loading an application they
will likely step through ROM code for the target. Add a note clarifying
that users need to set a breakpoint at the reset handler or "main" in
order to pause their application there.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-04-25 08:59:44 -04:00
Marcin Szymczyk 258ecb5a2c MAINTAINERS: add nRF platform collaborators
Add new collaborators to nRF platform.

Signed-off-by: Marcin Szymczyk <marcin.szymczyk@nordicsemi.no>
2024-04-25 08:59:16 -04:00
Marcin Szymczyk 28d8856d44 MAINTAINERS: update nRF platform files
Add missing tests, drivers and Nordic-specific
snippets.

Signed-off-by: Marcin Szymczyk <marcin.szymczyk@nordicsemi.no>
2024-04-25 08:59:16 -04:00
Mykola Kvach b1493339de snippets: xen_dom0: add support of rcar_spider_ca55
Add support of rcar_spider_ca55 to xen_dom0 snippet.

Disable CONFIG_UART_INTERRUPT_DRIVEN for xen_dom0, because
xen dom0 consoleio doesn't support interrupt driven mode.

Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
2024-04-25 14:54:51 +02:00
Mykola Kvach 797158997f boards: arm64: add support of Renesas Spider S4 A55 board
Add support of 'rcar_spider_s4/r8a779f0/a55' board: minimal dts
and configuration.

Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
2024-04-25 14:54:51 +02:00
Jakub Zymelka c572614b8b tests: drivers: gpio: Add nRF54L15 FLPR core targets to test
Add overlays for nrf54l15_cpuflpr and nrf54l15_cpuflpr/xip

Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
2024-04-25 12:43:58 +00:00
Jakub Zymelka 5e4cb886f4 dts: nordic: Change IRQ number for GPIOTE instances for nRF54L15
Adjusting the interrupt numbers for individual cores
to match the definitions in nrfx.

Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
2024-04-25 12:43:58 +00:00
Krzysztof Chruściński d82b27b08b soc: nordic: nrf54h: Add DCACHE initialization
Add initialization of the data cache.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-04-25 12:43:44 +00:00
Krzysztof Chruściński cfa6e250e4 soc: nordic: nrf54h: Remove redundant ICACHE kconfig
Remove CONFIG_NRF_ENABLE_ICACHE as it is not needed. There is CONFIG_ICACHE
which is by default enabled for nrf54h.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-04-25 12:43:44 +00:00
Wilfried Chauveau 00ddd8a81a arch: arm: cortex_m: enable interrupts before entering application’s main
This also fixes a typo in `z_arm_switch_to_main_no_multithreading` making
it unlock irq instead of locking them when main returns.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
2024-04-25 07:54:47 -04:00
Szymon Janc e4747b28a8 Bluetooth: OTS: Fix checksum calculation support
There was a typo in Kconfig check (missing CONFIG_ prefix) which
resulted in not setting OACP_FEAT_BIT_CRC bit in features.

This also resulted in checksum feature being disabled due to check
in bt_ots_init().

This was affecting OTS/SR/OASP/BV-03-C qualificatio test case.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2024-04-25 07:44:08 -04:00
Marcin Niestroj 14c6eef241 dts: bindings: display: gc9x01x: make 'reset-gpios' optional
Driver already handles the case when 'reset-gpios' is not provided, so
remove 'required: true' from bindings to allow boards / shields definition
without reset signal being connected to any Zephyr controlled GPIO.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-04-25 07:42:46 -04:00
Sebastian Bøe 33786b55ab tf-m: Silence harmless version warning
Silence harmless version warning for users that have tagged TF-M.

TF-M creates a very noisy warning when you tag it:

CMake Warning at cmake/version.cmake:28 (message):
  Actual TF-M version is not available from Git repository.  Settled to
  v2.0.0
Call Stack (most recent call first):
  CMakeLists.txt:22 (include)

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2024-04-25 07:25:36 -04:00
Piotr Dymacz fc72f696fe west_commands: sign: imgtool: fix slot size readout
This fixes wrong slot selection when reading partition size. According
to the comment in code, 'slot1_partition' size should be preferred:

  [...] slot1_partition size is used, when available, because in
  swap-move mode it can be one sector smaller. When not available,
  fallback to slot0_partition (single slot dfu). [...]

This fixes a typo in the if statement which currently always results in
use of 'slot0_partition' size.

Fixes: 86c4b4caa9 ("west/sign: Move from using partition label property")
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2024-04-25 07:25:04 -04:00
Nerijus Bendžiūnas 14338208ca spi: shell: fix copyright typo
Corrected copyright header.

Signed-off-by: Nerijus Bendžiūnas <nerijus.bendziunas@astrolightspace.com>
2024-04-25 07:24:14 -04:00
Ren Chen bfd24c4e4d tests: timer_behavior: increase stdev tolerance for ite platform
There might be a deviation of 30.5 microseconds (1 cycle) due to the
calculation deviation between free run and event timers. This commit
increases stdev to 33 for ite platform.

Fix #67833

Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
2024-04-25 07:22:47 -04:00
Wilfried Chauveau 8ffcdd3b66 maintainers: move cmsis-dsp and cmsis-nn label to be more specific
Each of them have a matching area so lets use that rather than the
catch-all "area: ARM" label.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
2024-04-25 07:22:28 -04:00
Jukka Rissanen 07599e3a53 net: vlan: Add a function to check if interface is VLAN one
We were missing a helper function that can be used to check
whether the given function is the virtual VLAN interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-25 11:06:23 +00:00
François Baldassari 4fe9909949 ADC: kb1200: start_read returns uninitialzed value
Found via static analyis. When `adc_kb1200_start_read` succeeds, no
value is set for `error` so it is still uninitialized when it is
returned.

Signed-off-by: François Baldassari <francois@memfault.com>
2024-04-25 11:06:11 +00:00
Håkon Amundsen 5895be5438 dts: nordic: add USBHS node for nrf54h20
Add missing USBHS node to list of global peripherals.

Signed-off-by: Håkon Amundsen <haakon.amundsen@nordicsemi.no>
2024-04-25 11:05:41 +00:00
Lukasz Madej 71e7a77e99 drivers: adc: adc_ad559x: improve adc read
Use information encoded in conversion result value to validate it.
Check if MSB bit is set to zero.
Check if channel number included in the result matches channel
number selected for conversion.
Use bitmask to extract converted value instead of math calculations.

Signed-off-by: Lukasz Madej <l.madej@grinn-global.com>
2024-04-25 12:15:19 +02:00
Lukasz Madej f565f4cae7 drivers: adc: adc_ad559x: fix driver init
k_thread_name_set() function returns an error if CONFIG_THREAD_NAME is
not enabled which may make the driver not functional.

Fix the issue by adding a check against CONFIG_THREAD_NAME avaliability
before calling k_thread_name_set() function so the driver can operate
properly with CONFIG_THREAD_NAME disabled.

Signed-off-by: Lukasz Madej <l.madej@grinn-global.com>
2024-04-25 12:15:19 +02:00
Lukasz Madej 55235712fb drivers: adc: adc_ad559x: add invernal vref value
Add configuration of internal refference voltage value so raw ADC
readings can be converted to mV utilizing adc_raw_to_millivolts()
ADC API function.

Signed-off-by: Lukasz Madej <l.madej@grinn-global.com>
2024-04-25 12:15:19 +02:00
Damian Nikodem 2455436337 driver: ssp: update Intel SSP DAI driver to support dynamic SSP management
This commit refactors the Intel SSP DAI driver to support dynamic
management of SSP IP. This change additionally separates the management
of the DAI part from the management part of the SSP IP.

Key changes:
- Add new static functions to manage SSP IP power.
- Update the DAI SSP configuration functions to use the new management
  approach.
- Update device tree bindings and instances to reflect the new SSP IP
  management mechanism.

Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
2024-04-25 12:14:50 +02:00
Nithin Ramesh Myliattil 92417967cf Bluetooth: BAP: Shell: Add BASS service data to ext-adv
As per the BAP spec, the scan delegator device should add the BASS service
data in the extended advertising data when it requests a broadcast
assistant to scan for it. For testing purposes that's usually the case
with the shell, extended advertising data shall be populated with the
BASS service data.

Signed-off-by: Nithin Ramesh Myliattil <niym@demant.com>
2024-04-25 09:56:25 +00:00
Mahesh Mahadevan 496802178a boards: frdm_mcxn947: Add clock setup for FlexSPI
The MEMC driver in memc_mcux_flexspi.c is initialized
before the FlexSPI driver (flash_mcux_flexspi_nor.c)
and hangs during FlexSPI init. Initialize the FlexSPI
clock to 50MHz before the speed is set to the optimum
speed by the FlexSPI driver.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2024-04-25 09:55:59 +00:00
Anas Nashif aa2b72d32a tests: logging: remove userspace testing
This test is disabled upstream for a while and only run on zephyr
toolchains. Logging is missing the support needed for userspace, see
releated issue.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-04-25 09:55:08 +00:00