Commit graph

96296 commits

Author SHA1 Message Date
Yong Cong Sin eb37b8620b sensor_shell: fix hang when device is not a sensor
If `CONFIG_SENSOR_INFO` is enabled, use the `sensor_info`
section to validate that the argument is a sensor before using,
otherwise the shell command will hang the application.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-24 07:49:27 -04:00
Yong Cong Sin e879cd0502 sensor_shell: fix assertion due to NULL pointer deref
The `SENSOR_CHAN_VSHUNT` was added in #60717 but was never
added to the `sensor_channel_name[SENSOR_CHAN_COMMON_COUNT]`
table. Since the length of `sensor_channel_name` is fixed to
`SENSOR_CHAN_COMMON_COUNT`, this means that the index at
`SENSOR_CHAN_VSHUNT` points to `NULL`. When we use the
`sensor get` command for anything bigger than
`SENSOR_CHAN_VSHUNT`, we will deref that `NULL` pointer
when we do `strcmp` in the for-loop of `parse_named_int`.

Fix this by defining `SENSOR_CHAN_VSHUNT` in the table.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-24 07:49:27 -04:00
Aleksander Wasaznik 26f3073b9a Bluetooth: audio: tests: Switch to one-time adv
This patch removes all uses of the adv auto-resume feature in the audio
bsim tests, and instead makes all adv starts explicit.

The auto-resume feature is planned for deprecation. And, explicit
starting of adv makes what happens in the test more explicit as well.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-05-24 07:48:54 -04:00
Ioannis Karachalios 62f8f160ad drivers: entropy: smartbond: Optimize driver PM
This commit should optimize the way the device is allowed
to enter the suspended state. Instead of returning a PM
error code to abort the PM process, the standby power state
is constrained as long as the device is not allowed to enter
suspension. With that approach, acquiring PD_SYS is not needed
when in PM device runtime mode.

Signed-off-by: Ioannis Karachalios <ioannis.karachalios.px@renesas.com>
2024-05-24 07:48:41 -04:00
Ioannis Karachalios 71a5f1b9fd drivers: display: smartbond: Optimize driver PM
This commit should optimize the way the device is allowed
to enter the suspended state. Instead of returning a PM
error code to abort the PM process, the standby power state
is constrained as long as the device is not allowed to enter
suspension. With that approach, acquiring PD_SYS is not needed
when in PM device runtime mode.

Signed-off-by: Ioannis Karachalios <ioannis.karachalios.px@renesas.com>
2024-05-24 07:48:41 -04:00
Ioannis Karachalios 2958f691bb drivers: mipi_dbi: smartbond: Optimize driver PM
This commit should optimize the way the device is allowed
to enter the suspended state. Instead of returning a PM
error code to abort the PM process, the standby power state
is constrained as long as the device is not allowed to enter
suspension. With that approach, acquiring PD_SYS is not needed
when in PM device runtime mode.

Signed-off-by: Ioannis Karachalios <ioannis.karachalios.px@renesas.com>
2024-05-24 07:48:41 -04:00
Gerard Marull-Paretas 33665348c2 dt-bindings: pinctrl: nrf: allow for more ports
New nRF54H20 SoC series expose more ports, e.g. P9, so reserve more bits
for the Port+Pin field.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-05-24 07:48:30 -04:00
Marcin Niestroj c6fd2a1ddf net: dns: don't request address in recvfrom()
Source address is not used anywhere, so don't request it with recvfrom()
API.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-05-24 07:48:17 -04:00
Aurelien Jarno 44f86dd67d usb: dfu: fix detach happening too fast
In some relatively rare conditions, the DFU detach/attach happens to
fast, which cause the host to not notice it. It seems to to be the case
for instance on STM32 when no endpoint are being used.

Adding a 1 ms delay (i.e. one SOF period) between the detach and the
attach fixes the issue.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2024-05-24 07:48:03 -04:00
Nicolas Pitre b34e94f362 kernel: demand_paging: fix arch_page_location_get() documentation
Symbols from enum arch_page_location are defined as
ARCH_PAGE_LOCATION_* and not ARCH_PAGE_FAULT_*.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2024-05-24 07:47:49 -04:00
Krzysztof Chruściński af3c8b973e drivers: timer: nrf_grtc_timer: Fix for random system hangs
d599e2b670 removed early return from sys_clock_timeout_handler if
current counter value is less than cc_val. It seems that this return is
needed as after the removal some stress tests which were using system
timers heavily started to hang.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-05-24 07:47:29 -04:00
Andrzej Głąbek e9256135d6 Bluetooth: Controller: nrf5: Allocate GPIOTE channels
Allocate the GPIOTE channels that the Bluetooth Controller needs to use
with the dedicated function provided by the nrfx_gpiote driver instead
of using hard-coded indexes of these channels, as now, when the driver
supports multiple GPIOTE instances, it would be much more difficult to
properly inform the driver which channels should be reserved.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2024-05-24 07:47:15 -04:00
Andrzej Głąbek 2e8f104425 modules: hal_nordic: nrfx_glue: Remove NRFX_GPIOTE_CHANNELS_USED
This definition is no longer supported by the nrfx_gpiote driver (since
nrfx 3.2.0, reserved channels need to be defined per GPIOTE instance),
so remove it to not mislead users.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2024-05-24 07:47:15 -04:00
Emil Gydesen cc602a6941 tests: Bluetooth: Fix incorrect comments about adv sets
Several places we simply had
/* Create a non-connectable non-scannable advertising set */
regardless of the type of advertising it was.

Modified the comment to omit the scannable part
and corrected the connectable part.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-05-24 07:46:43 -04:00
Emil Gydesen 04e38ae176 samples: Bluetooth: Fix incorrect comments about adv sets
Several places we simply had
/* Create a non-connectable non-scannable advertising set */
regardless of the type of advertising it was.

Modified the comment to omit the scannable part
and corrected the connectable part.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-05-24 07:46:43 -04:00
Luis Ubieda 4ae093eaf0 drivers: i2c: nrfx_twi_rtio: Minor indentation fixes
Not necessarily related to the namespacing changes, but just
establishing proper indentation formatting throughout the whole file.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-05-24 07:46:27 -04:00
Luis Ubieda 98c121d262 i2c: nrfx_twi_rtio: Establish proper namespacing in driver
To clearly distinguish between common code and RTIO-only code
on nrfx_twi and nrfx_twi_rtio.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-05-24 07:46:27 -04:00
Szymon Janc d3c0dfbf36 tests: Bluetooth: tester: Fix assert in OTS
MCS OTS support doesn't implement OTS checksum and if this is globally
enabled assert is triggered.

[00:00:03.409,484] <dbg> bttester_gap: set_io_cap: io_cap: 0
ASSERTION FAIL [ots_init->cb->obj_cal_checksum]
     @ WEST_TOPDIR/zephyr/subsys/bluetooth/services/ots/ots.c:476
 Callback for object calculate checksum is not set

This should be reverted when Zephyr issue #72471 is fixed.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2024-05-24 12:57:26 +03:00
Flavio Ceolin e0c955eba3 tests: uoscore: Set necessary PSA options
Set necessary psa options to the test execution.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-05-24 11:39:28 +02:00
Stephanos Ioannidis 8c8e2f6243 doc: requirements: Add pyserial
Since 7eaca455fa, pyserial is required for
building docs because `DeviceAdapter` from the `pytest-twister-harness`
plugin, which is imported by autodoc, now depends on it.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2024-05-23 17:02:27 -04:00
Valerio Setti 11920e35a0 mbedtls: reduce heap usage when building PSA crypto
By default PSA crypto library copies all the buffers that are passed
in into the heap before further processing them. This is required
when the PSA crypto library is on the secure side and it accepts
buffers from a non-secure code. However this case in Zephyr
is already handled by TF-M, so when the PSA crypto library is
built (CONFIG_MBEDTLS_PSA_CRYPTO_C) then it will be on the
non-secure side. Therefore this malloc copy is useless and
it consumes heap memory. Setting MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS
at Mbed TLS build time helps in removing this mechanism and
it saves heap memory.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-05-23 09:03:20 -07:00
Jeppe Odgaard 85bc3e6461 codeowners: add sensor veaa-x-3
Add @jeppenodgaard and @MaureenHelm as veaa-x-3 codeowners.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2024-05-23 11:54:59 -04:00
Mike J. Chen 3656c1b14c spi_nor: remove unneeded enter_dpd() at end of spi_nor_configure()
This block of code was in the original commit that added
CONFIG_SPI_NOR_IDLE_IN_DPD but later modifications
added acquire_device() and release_device() calls
earlier in spi_nor_configure() and the release_device()
function will have already done the enter_dpd().

Signed-off-by: Mike J. Chen <mjchen@google.com>
2024-05-23 11:53:45 -04:00
Morten Priess 06870146e6 Bluetooth: controller: Allow any valid ISO sync receiver BIG handle
The BIG handle for an ISO sync receiver is provided by the host. The
valid range is [0x00..0xEF], and this requires the controller to allow
non-consecutive handle numbering. This means that even if only one sync
set is supported, a BIG handle of ex. value 2 must be supported.

As the code uses indexing and range checking directly by handle, this
needs to be changed. Introducing the handle index, which sequnces the
handles such that index = 0 is always the "first handle", regardless
of value.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2024-05-23 11:53:22 -04:00
Valerio Setti ffe79b5522 test: mbedtls: add custom target to check MbedTLS auto-generated files
This commit adds a custom target to tests/crypto/mbedtls in
order to verify that MbedTLS auto-generated files are up to
date.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-05-23 11:53:02 -04:00
Valerio Setti 210e08be5d bluetooth: mesh: update BT_MESH_USES_MBEDTLS_PSA selected symbols
Instead of selecting legacy MBEDTLS symbols, use corresponding
PSA_WANT ones when possible (note: some legacy symbols do not
have a PSA correspondance).

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-05-23 11:53:02 -04:00
Valerio Setti a1a7c9081a mbedtls: add new source file from MbedTLS 3.6 release
Add "sha3.c" source file that was previously missing from
CMakeLists.txt and that has been added in MbedTLS 3.6 release.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-05-23 11:53:02 -04:00
Valerio Setti 12ff947568 mbedtls: add new PSA_CRYPTO_CLIENT config
Using MBEDTLS_PSA_CRYPTO_CLIENT to guard all PSA_WANT symbols is
not completely correct because:

1. the prefix MBEDTLS suggests that it's something related to
   MbedTLS, while actually PSA APIs can be provided also
   by other implementations (ex: TFM)

2. there might applications which are willing to use PSA APIs
   without using MbedTLS at all. For example computing an hash
   can be as simple as writing psa_hash_compute() and, if the
   PSA function is provided thorugh TFM, then MbedTLS is not
   required at all

Therefore this commit:

- moves MBEDTLS_PSA_CRYPTO_CLIENT to Kconfig.tls-generic since
  that symbol belongs to MbedTLS

- adds a new symbol named PSA_CRYPTO_CLIENT as a generic way
  to state that there is "some" PSA crypto API provider

- let MBEDTLS_PSA_CRYPTO_CLIENT automatically select
  PSA_CRYPTO_CLIENT, since the former is an implementation of
  the latter.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-05-23 11:53:02 -04:00
Valerio Setti 2adb4cac17 mbedtls: default enable USE_PSA_CRYPTO when CRYPTO_C
Now that support for all PSA_WANT symbols is in place, we can
enable MBEDTLS_USE_PSA_CRYPTO when MBEDTLS_PSA_CRYPTO_C is
enabled as well.

Note: this commit also moves USE_PSA_CRYPTO out of CRYPTO_C
dependency in config-tls-generic.h because TLS/DTLS/X509 modules
of MbedTLS can rely on *any* implementation of PSA crypto APIs
not only the MbedTLS one. TFM is for example an alternative
to this.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-05-23 11:53:02 -04:00
Valerio Setti c4e1b56ef9 mbedtls: add the python script used to generate PSA Kconfigs
Since PSA has several different symbols defined and since it's
better to keep them aligned with the current MbedTLS release,
a python script is used to generate both:
- Kconfig.psa
- config-psa-generic.h

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-05-23 11:53:02 -04:00
Valerio Setti e58ebe12f4 mbedtls: add configuration file for PSA features
Adding a Kconfig and a header file to control which PSA features
are to be used from MbedTLS:

- new kconfig symbols are placed in a separate header file
  (Kconfig.psa) and are guarded by MBEDTLS_PSA_CRYPTO_CLIENT. The
  reason for this is that TLS/X509 can either rely on PSA functions
  provided by MbedTLS (when MBEDTLS_PSA_CRYPTO_C is defined) or
  TFM (when BUILD_WITH_TFM is selected). Therefore we could
  not make these new Kconfigs depending on MBEDTLS_PSA_CRYPTO_C.

- by default all PSA symbols are enabled, but they can be
  disabled by respective Kconfigs in order to reduce the image
  size.

- the new header file (config-psa-generic.h) mimics what
  config-tls-generic.h does for MbedTLS builtin symbols: it
  enables a build symbol for every Kconfig one. The name is
  kept identical in the 2 cases (a part from the initial CONFIG_
  in order to simplify the mechanism).

- MBEDTLS_PSA_CRYPTO_CONFIG is finally enabled whenever there
  is any PSA crypto provider (either MBEDTLS_PSA_CRYPTO_C or
  TFM)

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-05-23 11:53:02 -04:00
Hao Luo 266fb4c73a drivers: counter: Change apollo4p counter base address
Changed apollo4p counter base address to match the updated
counter driver.

Signed-off-by: Hao Luo <hluo@ambiq.com>
2024-05-23 11:52:37 -04:00
Hao Luo d7afd88e71 drivers: counter: Add support for Apollo3 SoCs counter
This commit adds support for the counter which
can be found in Apollo3 SoCs

Signed-off-by: Hao Luo <hluo@ambiq.com>
2024-05-23 11:52:37 -04:00
Fin Maaß 48a4269800 maintainers: ite: edit files
Only include dts bindings, that start with ite,
instead of all containing it.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-05-23 11:52:22 -04:00
Yong Cong Sin c118cd5a13 arch: make the max stack frames configurable
Current on x86 & risc-v that implement stack trace, the
maximum depth of the stack trace is defined by a macro.

Introduce a new Kconfig:EXCEPTION_STACK_TRACE_MAX_FRAMES
so that this is configurable in software.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-23 11:52:08 -04:00
Yong Cong Sin 2a3d9d0d90 arch: arm64: use symtab to print function name in stack trace
Selecting `CONFIG_SYMTAB` will
enable the symtab generation which will be used in the
stack trace to print the function name of the return
address.

Added `arm64` to the `arch.common.stack_unwind.symtab` test.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-23 11:52:08 -04:00
Yong Cong Sin eafc4eff04 arch: riscv: print symbol name of mepc if CONFIG_SYMTAB is enabled
The mepc register is the address of the instruction that was
interrupted, it will make debugging easier if we know the
name of the symbol, so print it if `CONFIG_SYMTAB` is enabled.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-23 11:52:08 -04:00
Yong Cong Sin c1a925de98 arch: riscv: use symtab to print function name in stack trace
Selecting `CONFIG_EXCEPTION_STACK_TRACE_SYMTAB` will
enable the symtab generation which will be used in the
stack trace to print the function name of the return
address.

Updated the `stack_unwind` test to test the symbols in a
stack trace.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-23 11:52:08 -04:00
Yong Cong Sin e1ce0aefff debug: implement symtab generation
Use pyelftools to extract the symbol table from the
link stage executable. Then, filter out the function names
and sort them based on their offsets before writing into the
`symtab.c`, this is similar to how the `isr_tables` works.

To access the structure, simply include the new header:
```c
#include <zephyr/debug/symtab.h>
```

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-23 11:52:08 -04:00
Jérémy LOCHE - MAKEEN Energy 0af906a533 gpio: imx: Added IRQ lock for RMW operations
The GPIO API performs unprotected RMW operations that
can cause glitching and race conditions when GPIOs are used by
different threads or ISRs.

Signed-off-by: Jérémy LOCHE - MAKEEN Energy <jlh@makeenenergy.com>
2024-05-23 11:51:51 -04:00
Piotr Kosycarz 146195a647 soc: nordic: configure run once for nrf54l15
Needed to support sysbuild (app + flpr) with --erase option.

Signed-off-by: Piotr Kosycarz <piotr.kosycarz@nordicsemi.no>
2024-05-23 11:51:31 -04:00
Aleksander Wasaznik 765b244c27 Bluetooth: host: tests: Switch to one-time adv
This patch removes all uses of the adv auto-resume feature in the host
bsim tests, except for the test of that feature itself, and instead
makes all adv starts explicit.

The auto-resume feature is planned for deprecation. And, explicit
starting of adv makes what happens in the test more explicit as well.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-05-23 11:51:07 -04:00
Kai Vehmanen 991b3623b0 soc: intel_adsp: ipc: don't call k_sem_init() multiple times
k_sem_init() is called for every IPC message sent in
intel_adsp_ipc_send_message(). This has not had any side-effects
in upstream configurations, but has been linked to a failing
run of test_obj_tracking_sanity test case in downstream Zephyr
use.

Replace k_sem_init() with k_sem_reset() as this is more appropriate
API to reset the semaphore count, and ensure deterministic
behaviour in case a thread is waiting on the semaphore at time
of reset.

Suggested-by: Peter Mitsis <peter.mitsis@intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-05-23 11:50:50 -04:00
Simon Hein ee669d084f MAINTAINERS: add doc/safety to documentation area
Add the missing doc/safety path to the area
documentation.

Signed-off-by: Simon Hein <Shein@baumer.com>
2024-05-23 11:50:36 -04:00
Ali Hozhabri ced9fba95c boards: st: steval_stwinbx1: Add BLE support for STEVAL-STWINBX1 board
Provide BLE support for STEVAL-STWINBX1 board.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2024-05-23 08:23:29 -04:00
Tomi Fontanilles d830446c91 modules: tf-m: nordic: remove problematic include path
It made the build of
`samples/tfm_integration/tfm_psa_test/sample.tfm.psa_test_crypto`
break since the update of Mbed TLS to 3.6.0 (#71118), apparently because
`${ZEPHYR_BASE}` wasn't set, and the include doesn't seem to be needed.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-05-23 08:22:47 -04:00
Roger Wang e79f7135af logging: backend: uart: fix coverity warning
This commit is to fix a warning which is reported in Coverity scan
after device runtime pm is enabled.

Signed-off-by: Roger Wang <roger1.wang@intel.com>
2024-05-23 08:22:32 -04:00
Phi Bang Nguyen ea02b93eea drivers: video: csi: Add support for i.MX RT11XX
On i.MX RT11XX which has MIPI CSI-2 Rx, image data from the camera sensor
after passing through the camera pipeline (MIPI CSI-2 Rx --> Video Mux -->
CSI) will be implicitly converted to a 32-bits pixel formats. For example,
an input in RGB565 / YUYV (2-bytes format) will become an XRGB32 / XYUV32
(4-bytes format), respectively. Make changes to support this.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-05-23 07:52:09 -04:00
Phi Bang Nguyen e3ad40f883 include: video: Add XYUV32 pixel format
Add XYUV32 pixel format

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-05-23 07:52:09 -04:00
Rick Bruyninckx 39f99d84d2 data: Use designated initializers consistently in macro's
This PR updates the json macros to be consistend with C++20
Signed-off-by: Rick Bruyninckx <xactme@gmail.com>
2024-05-23 07:51:56 -04:00