Commit Graph

94813 Commits

Author SHA1 Message Date
Tomi Fontanilles 9bbff1ac84 drivers: crypto: mbedtls: fix dependency
Explicitly enable SHA-512 now that it is not enabled by default
anymore.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-05-03 14:47:52 -07:00
Tomi Fontanilles 6c68068c38 modules: mbedtls: remove default-enabling of hash algorithms
Do not enable hash algorithms except SHA-256 by default.
This unnecessarily inflates the final code size even if not all the
enabled hash algorithms are actually used.

SHA-256 is (for now) kept enabled by default because many configurations
across the code base assume that there is some hash algorithm
available without needing to enable it.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-05-03 14:47:52 -07:00
Pieter De Gendt 1ae357850d doc: migration-guide-3.7: Add driver API renamed structs
Add a migration entry for some of the driver API structs that have been
renamed.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-05-03 14:44:41 +01:00
Pieter De Gendt 947906de7e scripts: build: gen_kobject_list.py check _driver_api suffix
Raise an exceptionif _driver_api suffix is missing from subsystem name.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-05-03 14:44:41 +01:00
Pieter De Gendt 7ad76e598f include: drivers: Add missing __subsystem tags
Add __subsystem tags to driver API structs.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-05-03 14:44:41 +01:00
Pieter De Gendt 10dafbfcf4 drivers: bbram: Rename emul_bbram_backend_api to emul_bbram_driver_api
Structs with a __subsystem tag are required to have a _driver_api suffix.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-05-03 14:44:41 +01:00
Pieter De Gendt e5a126ae0e drivers: usbc_ppc: Rename usbc_ppc_drv to usbc_ppc_driver_api
Structs with a __subsystem tag are required to have a _driver_api suffix.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-05-03 14:44:41 +01:00
Pieter De Gendt 8a2bece9af drivers: sensor: Rename emul_sensor_backend_api to emul_sensor_driver_api
Structs with a __subsystem tag are required to have a _driver_api suffix.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-05-03 14:44:41 +01:00
Pieter De Gendt b4e5c2e078 include: mgmt: ec_host_cmd: Remove __subsystem tag
Remove the subsystem tag from a backend API.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-05-03 14:44:41 +01:00
Rubin Gerritsen 13699dc660 tests: Bluetooth: per_adv_syncer -> per_adv_sync
This ensures the naming convention matches the APIs that
are tested.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-05-03 14:44:31 +01:00
Rubin Gerritsen 7fdc99a4cb tests: Bluetooth: Add coverage for Coded PHY sync establishment
Adds test coverage for the case where the host starts the
scanner automatically upon sync creation.
This test covers there bug where we previously did not start
scanning on Coded PHY.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-05-03 14:44:31 +01:00
Rubin Gerritsen 4095b790ee tests: Bluetooth: Increase coverage for sync establishment
We didn't have test coverage for the scenario where the host
starts scanning automatically.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-05-03 14:44:31 +01:00
Rubin Gerritsen 44199f3a48 Bluetooth: Host: Fix auto-connect/sync establishment on Coded PHY
As documented in bt_le_scan_update(), the host may start scanning
automatically for various reasons.

Until now scanning was only done on 1M PHY, making it impossible
to use auto-connect/sync establishment if the advertiser was using
Coded PHY as its primary PHY.

Auto-connection would never work. Sync establishment would work if
the scanner was started by the application.

This commit fixes this by instructing the controller to scan on
both 1M and Coded PHY if the controller supports Coded PHY.
The application may see increased power consumption as a result
of this change as the controller may now spend 2*scan_window
listening for advertising packets.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-05-03 14:44:31 +01:00
Wei-Tai Lee 29043c9ead driver: hwinfo: andes: add missing Kconfig dependency
Add Kconfig dependency to the Andes hwinfo driver.

Signed-off-by: Wei-Tai Lee <wtlee@andestech.com>
2024-05-03 14:44:16 +01:00
Grzegorz Swiderski b8338f956d boards: nordic: nrf54h20dk: Update memory map
Move global RAM0x regions to align with the documentation.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2024-05-03 07:53:47 -04:00
Mikhail Skobov 7d362e0a77 drivers: i2c: i2c_ll_stm32_v1
In rare cases, the I2C driver runs the N==2 logic
for I2C receives when N>2. This change breaks early
when handling the last 2 bytes for transactions with N>2

Signed-off-by: Mikhail Skobov <skobovm@meta.com>
2024-05-03 07:53:31 -04:00
Jeppe Odgaard 5d44ebfa7d drivers: i2s: stm32: use length from i2s_write
The length parameter from `i2s_write` is not used correctly by
i2s_ll_stm32.c. E.g. `i2s_write(dev, block, 0)` would work.

Use the length from `i2s_write` in `dma_reload` to fix the issue.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2024-05-03 07:53:05 -04:00
frei tycho 32ba549536 lib: os: coding guidelines: add explicit cast to void
- added explicit cast to void when returned value is expectedly ignored

Signed-off-by: frei tycho <tfrei@baumer.com>
2024-05-03 07:52:42 -04:00
Simon Guinot ea47ef0ac0 drivers: ncp5623: check led_info for all LEDs
With the current code, when three separate monochrome LEDs are defined
in DT, only the information from the first LED is checked during driver
initialization. This patch fixes the code to verify the information of
each LED.

Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
2024-05-03 07:29:45 -04:00
Marc Herbert bfa5d02125 device.h: fix unbalanced initializer: ({ .pm_base = (pm_),)}
Close parentheses and braces in the reverse order they are opened.

Fixes commit f91d4731af ("pm: use braces for .pm_base inside anonymous
union initializer")

I have no idea how no compiler caught this!?

I tested very carefully with two different gcc versions and one clang
version and generated binaries are strictly identical before and after
this commit. Fix the code anyway because C macros are painful enough to
debug already, so no need to add more confusion.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-05-03 07:29:26 -04:00
Benjamin Cabé 003f145314 drivers: gpio: fix bug with Px15 pins
Fix condition in pin number check so that PA15, PB15, etc. can be properly
accessed..

Co-authored-by: Денис <baden.i.ua@gmail.com>
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-05-03 07:29:13 -04:00
Jonathon Penix 274bd59283 arch: arm: cortex-m: Change character used to mark immediate operand
Change the character used to indicate immediate operands from '$' to '#'
to resolve an "invalid instruction" error when building with clang.

For arm, binutils allows either '#' or '$' to indicate immediate operands.
clang seems to accept '$' for arm in other instances
(my build accepts 'subs r0, r0, $0x02', for example), but in this case it
produces an error that this is an invalid instruction due to the "$0x02"
operand.

Given clang's inconsistent behavior, I'm guessing this is a bug in clang
somewhere, but:

  1. '#' for immediate operands seems to be more standard for arm in
     general and seems to be what is used throughout the rest of Zephyr's
     arm asm code.
  2. Switching out '$' for '#' shouldn't negatively impact other
     toolchains.

As such, switch out the character used to unblock clang builds until this
can be fixed in clang.

Signed-off-by: Jonathon Penix <jpenix@quicinc.com>
2024-05-03 07:28:52 -04:00
Glenn Andrews eb4d2229fc Kernel: Fix comment for doc build.
Add an asterisk to make the comment for `k_poll_signal_reset()` appear
in documentation and move an @brief down by one line.

Signed-off-by: Glenn Andrews <glenn.andrews.42@gmail.com>
2024-05-03 07:28:25 -04:00
Swift Tian 74ddfbc8a2 tests: devicetree: Add a test test_child_nodes_number
The test uses DT_CHILD_NUM and DT_INST_CHILD_NUM to get the number of
child nodes of a given node from generated macro.
The test uses DT_CHILD_NUM_STATUS_OKAY and DT_INST_CHILD_NUM_STATUS_OKAY
to get the number of child nodes of a given node which children's status
are "okay" from generated macro.

Signed-off-by: Swift Tian <swift.tian@ambiq.com>
2024-05-03 11:18:43 +02:00
Swift Tian 5871ff010b devicetree: Add DT/DT_INST_CHILD_NUM and DT/DT_INST_CHILD_NUM_STATUS_OKAY
Add a generated macro for the number of child nodes of a given node.
Add a generated macro for the number of child nodes of a given node which
children's status are "okay".

Signed-off-by: Swift Tian <swift.tian@ambiq.com>
2024-05-03 11:18:43 +02:00
Jeferson Fernando 4810914d00 tests: subsys: lorawan: add channels mask configuration tests
Checks the behavior of configuration of channels mask for LoRaWAN.
Are passed wrong masks sizes as argument, NULL pointer instead channels
mask buffer and the right case to validate the expected returns.

Signed-off-by: Jeferson Fernando <jeferson.santos@edge.ufal.br>
2024-05-03 09:51:46 +02:00
Jeferson Fernando c0a17a9a5e lorawan: add channels mask configuration.
Add channels mask configuration for LoRaWAN, creating a request for
 LoRaMAC. This change is needed because using LoRaWAN with ABP
activation without configuring channels mask will provide no acceptable
 channels on data transmit, causing data loss.

Signed-off-by: Jeferson Fernando <jeferson.santos@edge.ufal.br>
2024-05-03 09:51:46 +02:00
Bjarki Arge Andreasen 15fa7f79da drivers: gnss: gnss_publish: Use sem for locking
The gnss_publish incorrectly uses a spinlock for mutual
exclusion when publishing data and satellites. Update it to
use a binary semaphore.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-05-02 22:44:19 +01:00
Bjarki Arge Andreasen 2ff1ed7804 drivers: gnss: gnss_lcx6g: replace spinlock with sem
Use semaphore instead of spinlock for mutual exclusion. The
spinlock is improperly used for mutual exclusion, leading to
timeouts and other unintended behavior as ISRs are disabled.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-05-02 22:43:11 +01:00
Bjarki Arge Andreasen f95fc461d2 samples: drivers: gnss: boards: adjust mimxrt1062 dts overlay
The overlay for the mimxrt1062 boards gnss alias is pointing
to the uart node rather than the gnss node. Adjust gnss alias
and node naming.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-05-02 22:42:39 +01:00
Sebastian Bøe 850cd54e67 arm: fatal: log which IRQn is triggering on spurious IRQs
LOG which IRQn line is triggering on spurious IRQs as this makes it
much easier to debug spurious IRQs.

The new logs with this patch looks like:

<err> os: Unhandled IRQn: 227
<err> os: >>> ZEPHYR FATAL ERROR 1: Unhandled interrupt on CPU 0
<err> os: Current thread: 0x20032c20 (unknown)
<err> os: Halting system

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2024-05-02 22:42:30 +01:00
Romain Pelletant a58a7d0aa1 boards: st: add stm32c0116_dk board support
Add board support for stm32c0116_dk

Signed-off-by: Romain Pelletant <romainp@kickmaker.net>
2024-05-02 22:41:51 +01:00
Romain Pelletant 68fc448b1c soc: st: add stm32c011xx support
Add STM32C011XX familly support

Signed-off-by: Romain Pelletant <romainp@kickmaker.net>
2024-05-02 22:41:51 +01:00
Romain Pelletant c8bd343309 dts: st: add stm32c011X6 support
Provide support for STM32C011X6 family support

Signed-off-by: Romain Pelletant <romainp@kickmaker.net>
2024-05-02 22:41:51 +01:00
Fin Maaß 410edaebaa sample: mgmt: hawkbit: sign image by default
Sign the image by default by using the Kconfig options.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-05-02 22:41:27 +01:00
Fin Maaß c78fc290ee samples: mgmt: hawkbit: docs: reflect change in reboot
hawkbit is rebooting automatically after installing a new update,
reflect that change in the docs.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-05-02 22:41:27 +01:00
Daniel DeGrasse 6290d18c13 drivers: display: display_hx8394: use MIPI LPM during init commands
Although not documented in the HX8394 datasheet, it seems that the
display fails to initialize if MIPI HS mode is used to send
configuration commands. Therefore, we must make sure all initialization
commands are sent with the MIPI_DSI_MSG_USE_LPM flag set.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-05-02 21:26:32 +03:00
Daniel DeGrasse 5c2d25f93e boards: shields: rk055hdmipi4ma0: fix GT911 identifier in RT595 overlay
In 42c6f3311b (boards: stop using kscan for LVGL touch input), GT911
node label was renamed for rk055hdmipi4ma0 shield. The node label rename
was missed in the RT595 EVK overlay, fix this.

Fixes #69302

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-05-02 21:26:32 +03:00
Jose Alberto Meza 5e8322f017 doc: Update eSPI sections in migration and release notes
Indicate macro and enum changes with respect to new inclusive
term in eSPI specification 1.5.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2024-05-02 13:56:46 -04:00
Jose Alberto Meza 929d0c8bbf samples: drivers: espi: Add support for mec172x board
Add overlay file for mec172x modular card

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2024-05-02 13:56:46 -04:00
Jose Alberto Meza 33f905009d doc: eSPI: Update link to eSPI spec
Add link to eSPI spec 1.5
Update coding guidelines for eSPI bus

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2024-05-02 13:56:46 -04:00
Jose Alberto Meza 30eda2058b treewide: drivers: espi: Adjust terms per eSPI specification 1.5
1) Replace master/slave in API for new terms in eSPI spec 1.5
2) Reflect eSPI VW change and macro changes across eSPI drivers
3) Update terms in eSPI driver sample and eSPI test driver

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2024-05-02 13:56:46 -04:00
Fin Maaß 7cf97c61c0 mgmt: hawkbit: some doc improvements
some doc improvements in hawkbit.h.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-05-02 13:55:28 -04:00
Fin Maaß fb3704665a mgmt: hawkbit: use shell macros
use short shell macros for printing.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-05-02 13:55:28 -04:00
Peter Mitsis 283d4133fa 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.

Filtered on x86 as the x86_64 irq_offload() implementation isn't
SMP-safe.  See #72172

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2024-05-02 13:55:03 -04:00
Andy Ross dec022a848 kernel/sched: Fix edge^2 case in abort/join
The previous abort-lifecycle fix missed a case: other threads can
enter k_thread_join(), see that the thread is already dead, and then
need to call z_thread_switch_spin() to wait for a context switch.  But
the new "dummification" code was (by design!) terminating the thread
such that no context would be saved to it.  So switch_handle stayed
NULL and if you hit that timing case correctly[1] you'd deadlock
waiting for a switch that would never come.

Fix is just to set switch_handle when dummifying to any non-NULL
value.

Also add an assertion to catch the obvious case that a thread is
actually dead on the exit path of k_thread_abort() to make sure the
variant path continues to set flags correctly

[1] CI was doing it fairly reliably via tests/kernel/smp_abort on
    qemu_cortex_a53 only.  Only one of my dev systems could see it,
    and then only about 15% of the time.

Signed-off-by: Andy Ross <andyross@google.com>
2024-05-02 13:55:03 -04:00
Andy Ross 47ab66311d 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-05-02 13:55:03 -04:00
Andy Ross fd340ebf31 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-05-02 13:55:03 -04:00
Andy Ross 727996acdc 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-05-02 13:55:03 -04:00
Andy Ross f0fd54cb31 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-05-02 13:55:03 -04:00