Commit graph

16229 commits

Author SHA1 Message Date
Eve Redero
cb8b1cdc74 dts: atmel: add adc node to due
Add ADC0 node and associated pincontrols
in sam3x and Arduino Due device trees.

Signed-off-by: Eve Redero <eve.redero@gmail.com>
2025-04-17 00:56:30 +02:00
Keith Packard
db49cd3899 tests/kernel: Validate constructor execution order
Check the order of constructors, making sure those with a specified
priority are called in numeric order after which those without priority are
called.

Signed-off-by: Keith Packard <keithp@keithp.com>
2025-04-16 20:36:27 +02:00
Valerio Setti
843776035d tests: drivers: build_all: add support for "x-powers,axp2101-charger"
Extend the *.dtsi file to include also an "x-powers,axp2101-charger"
instance.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2025-04-16 17:07:20 +02:00
Marek Slowinski
ba8742c1b8 tests: robot: renode: Use precise pause for UART keywords
Remove the source of non-determinism during emulation
by keeping terminal events reproducible between runs.
By using the mechanism of precise pause in Renode emulator
every interaction with terminal happens at the same virtual time
from the perspective of an emulated system, hence makes it independent
of the host. Otherwise the result of a test is susceptible to
the load on the host and robot process keywords' timing.

Renode emulator supports precise pausing when specified sequence of
characters is received on a terminal. Besides that,
char delay parameter is specified to set time interval between
consecutive characters entered in the terminal.
'Start Emulation' keyword is redundant, because 'Wait For'
keywords automatically continue emulation up to the nearest pause
event (e.g. matched pattern on the terminal).

Signed-off-by: Marek Slowinski <mslowinski@antmicro.com>
2025-04-16 17:07:05 +02:00
Dipak Shetty
c9645c9d9c tests: drivers: stepper: remove downstream-specific boards not run in CI
Removed boards that are not exercised in the CI pipeline, as they are
highly downstream-specific and not relevant to upstream validation.

Signed-off-by: Dipak Shetty <shetty.dipak@gmx.com>
2025-04-16 14:53:19 +02:00
Huaqi Fang
86293ebe11 tests: kernel: gen_isr_table: Fix irq tests for rv64 targets
The element in _irq_vector_table is 64bit for 64bit cpu,
and 32bit for 32bit cpu

Signed-off-by: Huaqi Fang <578567190@qq.com>
2025-04-16 08:10:47 +02:00
Tien Nguyen
5cf65452c3 tests: drivers: gpio: Add support for RZ/G2LC-SMARC
Add support for RZ/G2LC-SMARC

Signed-off-by: Tien Nguyen <tien.nguyen.zg@renesas.com>
2025-04-16 08:10:38 +02:00
Derek Snell
331e0cef3f drivers: i2s_mcux_sai: control MCLK direction with DT property
For the SAI peripheral, the MCLK signal input/output direction is
independent from the TX or RX bit clocks directions (TCR2[BCD] and
RCR2[BCD]). Introduces mclk-output property.

Signed-off-by: Derek Snell <derek.snell@nxp.com>
2025-04-16 08:09:41 +02:00
Jukka Rissanen
8d0c16ef9c tests: net: npf: Add VLAN tests
Add tests for VLAN matching.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-04-16 08:07:34 +02:00
Chris Friedt
788369493d tests: posix: timer: do not skip tests
I just happened to try to run this testsuite manually today and
noticed that it was being skipped due to a copy-paste error.

This test was migrated from tests/posix/common, where tests
were skipped for non-dynamic threads, since it would mostly
duplicate tests that had already been run.

However, while migrating, the condition to skip tests was
mistakenly left in when it should not have been.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-04-16 08:04:36 +02:00
Chris Friedt
f5cf14cbb1 tests: posix: timers: provide at least 1 dynamic thread
timer_create() will error if there are no dynamic threads to
run the SIGEV_THREAD handler, causing the test to fail (where
it was previously expected to pass).

Ensure that there is at least 1 dynamic thread available to
the POSIX API.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-04-16 08:04:36 +02:00
Krzysztof Chruściński
5f55fed4bb kernel: timeout: z_add_timeout to return expiration tick
Add return value to z_add_timeout. It returns system tick when timeout
will expire.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-04-15 19:09:33 +02:00
IBEN EL HADJ MESSAOUD Marwa
a2cb85295b tests: drivers: adc: adc_api: update adc_api test
Add nucleo_wba65ri overlay file

Signed-off-by: IBEN EL HADJ MESSAOUD Marwa <marwa.ibenelhadjmessaoud-ext@st.com>
2025-04-15 15:33:15 +02:00
Georgios Vasilakis
5c06558be2 samples: tests: Exclude nRF54L10 NS for unsupported tests/samples
The ADC and watchdog samples are not currently supported for the
non secure target of the nRF54L10 DK.

Add exclusions for these until they are supported.

Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
2025-04-14 20:05:17 +02:00
Luis Ubieda
7f6588877a tests: i2c_ram: Add testcase for i2c_rtio write with transactions
As it is a common pattern for drivers performing writes (e.g: write
reg-addr + write reg-data) without having to memcpy both into a buffer.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-04-14 20:04:47 +02:00
Peter Wang
393c8d1378 boards: frdm_mcxa166, frdm_mcxa276: add uart support
1. add uart support
2. enable the uart_async_api test example

Signed-off-by: Peter Wang <chaoyi.wang@nxp.com>
2025-04-14 20:03:54 +02:00
Piotr Krzyzanowski
b983b0441b tests: drivers: spi: Add NULL spi_buf_set tests
Add test cases where spi_transceive gets NULL spi_buf_set
once for tx and once for rx.

Signed-off-by: Piotr Krzyzanowski <piotr.krzyzanowski@nordicsemi.no>
2025-04-14 20:03:28 +02:00
Jordan Yates
ab34a9df48 zbus: remove k_malloc dependency for ZBUS_RUNTIME_OBSERVERS
Remove the dependency on the system heap existing when enabling
`ZBUS_RUNTIME_OBSERVERS`. Instead the previously allocated memory is
required to be provided to `zbus_chan_add_obs` (which can still be
allocated through malloc).

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-14 20:03:09 +02:00
Fin Maaß
1c788ba74d tests: storage: flash_map: add test for flash_area_copy()
add test for flash_area_copy().

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-04-14 16:07:35 +02:00
Théo Battrel
77bdc8a435 Bluetooth: Add usage of util_eq and util_memeq
Update `bt_irk_eq` to use `util_memeq` instead of `memcmp` and the
"disconnect" BabbleSim test to use `util_eq` instead of a first
assertion on the size followed by a `memcmp`.

This is done as an example usage of the two new functions.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2025-04-14 16:06:38 +02:00
Théo Battrel
716e6bfd20 Tests: Util: Add unit tests for util_eq/util_memeq
Add two unit tests for the newly added functions `util_eq` and
`util_memeq`.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2025-04-14 16:06:38 +02:00
Jordan Yates
97f2814b5e tests: drivers: mark rebooting tests with expect_reboot: true
Notify twister of tests that are expected to reboot in normal operation.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-14 13:05:46 +02:00
JP Hutchins
fe6366b804 lib: crc: add CRC-32K/4.2
This adds the best HD=4 CRC32 polynomial. The discovery
is the result of research by Philip Koopman of Carnegie
Mellon University, and is well documented at
https://users.ece.cmu.edu/~koopman/crc/.

The user is given the option of trading 1024B of RAM to
improve the execution speed. The unit tests are parameterized
with this KConfig option.

Signed-off-by: JP Hutchins <jp@intercreate.io>
2025-04-14 09:49:02 +02:00
Simone Orru
36ec017a38 uuid: Add sample for UUID utilities
Add a sample that showcases the usqge of the
UUID utilities.

Signed-off-by: Simone Orru <simone.orru@secomind.com>
2025-04-14 09:47:26 +02:00
Simone Orru
25c94a3019 uuid: Add tests for UUID utilities
Add some tests for the UUID utilities.

Signed-off-by: Simone Orru <simone.orru@secomind.com>
2025-04-14 09:47:26 +02:00
Daniel Leung
781011b911 tests: kernel/pending: fix incorrect test names
These tests should be named "kernel.pending" instead of
"kernel.objects".

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-04-12 00:02:59 +02:00
Andrej Butok
c4b92123d3 tests: littlefs: add .conf and .overlay for nxp boards
Adds littlefs test .conf and .overlay files for 18 nxp boards.

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2025-04-11 22:07:03 +02:00
Chris Friedt
2ec7af3474 test: posix: c_lib_ext: reduce memory requirements for testsuite
Previously, these tests were part of tests/posix/common.
In an effort to tie feature tests to specific POSIX features
(Option Groups), these tests were moved to a separate suite in a
previous commit.

However, the memory requirements for the legacy
tests/posix/common testsuite were significantly higher while the
memory requirements for tests in tests/posix/c_lib_ext are
significantly lower.

Remove the minimum flash and ram requirements to run the test so
that it passes tests on the integration platform qemu_cortex_m0.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-04-11 22:06:55 +02:00
Olivier Lesage
7b61bd6518 bluetooth: gatt: Add BT_GATT_CCC_WITH_WRITE_CB()
Add simple helper macro so users can define a CCCD with a write cb
without having to combine BT_GATT_CCC_MANAGED() and
BT_GATT_CCC_INITIALIZER() themselves.

Unlike the changed callback the write callback has a return value
that can be used to reject the write request.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2025-04-11 16:17:42 +02:00
Jeppe Odgaard
231b2a0c19 drivers: sensor: rename tmp116 to tmp11x
The tmp116 sensor driver also supports tmp117 and tmp119. Therefore rename
to indicate that is supports a range of tmp devices.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-04-11 16:17:35 +02:00
Jordan Yates
52415ed94f tests: pm: device_driver_init: test state_get during init
Test the value returned by `pm_device_state_get` during device driver
initialisation.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-11 14:53:53 +02:00
Utsav Munendra
12cba7addf portability: cmsis: Bugfix osThreadFlagsWait behavior
The osFlagsWaitAny option is not handled correctly.  It returns once any
flag at all is set, whereas it is supposed to only return once one of
the flags specified in flags is set.

Signed-off-by: Utsav Munendra <utsavm@meta.com>
2025-04-11 06:34:06 +02:00
Pavel Vasilyev
f46fd075d4 tests: bsim: bluetooth: host: hfc_multilink: Run test on nRF5340
Run test on nRF5340 to check if recombination works with HCI IPC
driver.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-04-11 06:32:58 +02:00
Pavel Vasilyev
82a7110406 tests: bsim: bluetooth: host: hfc: Run test for nRF5340
Run test for nRF5340 to check that it works with a different HCI driver.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-04-11 06:32:58 +02:00
Christoph Winklhofer
a5e295c452 json: improve parsing and serializing of integers
Add support for parsing and serializing of following integer types:
'int8_t', 'uint8_t', 'int16_t', 'uint16_t' and 'uint32_t'.

The generic integer token JSON_TOK_INT and JSON_TOK_UINT, in combination
with the field size (set by JSON_OBJ_DESCR_PRIM) allows to parse different
integer types, for example:

struct foo {
  int64_t i64;
  uint32_t u32;
  int16_t i16;
  uint8_t u8;
};

struct json_obj_descr foo_descr[] = {
  JSON_OBJ_DESCR_PRIM(struct foo, i64, JSON_TOK_INT),
  JSON_OBJ_DESCR_PRIM(struct foo, u32, JSON_TOK_UINT),
  JSON_OBJ_DESCR_PRIM(struct foo, i16, JSON_TOK_INT),
  JSON_OBJ_DESCR_PRIM(struct foo, u8, JSON_TOK_UINT),
};

These tokens also support parsing and serializing enums:

enum unsigned_enum { UA=0, UB=1, UC=2 };
enum signed_enum { SA=-1, SB=0, SC=1 };

struct foo {
  enum unsigned_enum u;
  enum signed_enum s;
};

struct json_obj_descr foo_descr[] = {
  JSON_OBJ_DESCR_PRIM(struct foo, u, JSON_TOK_UINT),
  JSON_OBJ_DESCR_PRIM(struct foo, s, JSON_TOK_INT),
};

Signed-off-by: Christoph Winklhofer <cj.winklhofer@gmail.com>
2025-04-11 06:32:50 +02:00
Christoph Winklhofer
63d33e631c json: support parsing and serializing of strings with char arrays
Support parsing and serializing of struct fields that are defined as a
char array.

Use the token JSON_TOK_STRING_BUF to parse and serialize a string for a
char array, for example:

struct foo {
  const char *str;
  char str_buf[30];
};

struct json_obj_descr foo_descr[] = {
  JSON_OBJ_DESCR_PRIM(struct foo, str, JSON_TOK_STRING),
  JSON_OBJ_DESCR_PRIM(struct foo, str_buf, JSON_TOK_STRING_BUF),
};

The struct 'json_obj_descr' now has an additional union member 'field'
to store the size of the struct field, which is used with the token
'JSON_TOK_STRING_BUF' to determine the element size.

Fixes: #65200
Signed-off-by: Christoph Winklhofer <cj.winklhofer@gmail.com>
2025-04-11 06:32:50 +02:00
Hake Huang
98458e2220 tests: uart: add extra_conf to disable CONFIG_USERSPACE
while disable USERSPACE we need set
CONFIG_TEST_ENABLE_USERSPACE=n

fixes: #82758

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2025-04-10 18:01:18 +02:00
Kiara Navarro
77c1414082 drivers: charger: add driver for bq25713
Create a driver implementation for the battery charge controller
TI BQ25713.

It includes the ability to enable / disable the controller and also
to setup max current and voltage charge parameters at initialization
time but also at run time.

On the other hand, it is possible to assign / obtain input voltage
and current regulation.

Signed-off-by: Kiara Navarro <knavarro@paltatech.com>
2025-04-10 18:01:02 +02:00
Troels Nilsson
c3df8fcd92 Bluetooth: Controller: Add validation of received LL_CIS_REQ
Validate that a received LL_CIS_REQ is valid and reject if it is not

Fixes EBQ test failure in LL/CIS/PER/BI-07-C

Signed-off-by: Troels Nilsson <trnn@demant.com>
2025-04-10 15:51:54 +02:00
Benjamin Cabé
975b8e137f tests: json: fix tests involving double numbers
Update the JSON test cases to explicitly cast NAN and INFINITY to double
type to avoid implicit promotion.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-04-10 14:43:19 +02:00
Tim Lin
327f8df862 test: drivers/gpio: ite: it515xx_evb: Add gpio test
Add GPIO node for it515xx_evb test.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2025-04-10 12:58:01 +02:00
Sebastian Głąb
3c34f88678 tests: drivers: uart: uart_elementary: Run test on nRF54L* FLPR
Add overlays required to run the test on:
- nrf54l09pdk/nrf54l09/cpuflpr,
- nrf54l20pdk/nrf54l20/cpuflpr.

Signed-off-by: Sebastian Głąb <sebastian.glab@nordicsemi.no>
2025-04-10 12:57:27 +02:00
Sebastian Głąb
a9e822ee29 tests: drivers: watchdog: wdt_basic_api: Enable test on nRF54L09 and L20
Enable wdt_basic_api test on:
- nrf54l09pdk/nrf54l09/cpuapp (missing supported),
- nrf54l09pdk/nrf54l09/cpuflpr (missing overlay),
- nrf54l20pdk/nrf54l20/cpuflpr (missing supported and overlay).

Signed-off-by: Sebastian Głąb <sebastian.glab@nordicsemi.no>
2025-04-10 12:57:27 +02:00
Sebastian Głąb
729e39a0a7 tests: boards: nrf: qdec: Enable test on nRF54L20 FLPR
Add overlay required to run qdec tests
on nrf54l20pdk/nrf54l20/cpuflpr.

Signed-off-by: Sebastian Głąb <sebastian.glab@nordicsemi.no>
2025-04-10 12:57:27 +02:00
Sebastian Głąb
6a782cf31f tests: drivers: timer: Enable test on nRF54L* cpuflpr
Enable nrf_grtc_timer test on:
- nrf54l09pdk/nrf54l09/cpuflpr and
- nrf54l20pdk/nrf54l20/cpuflpr.

Signed-off-by: Sebastian Głąb <sebastian.glab@nordicsemi.no>
2025-04-10 12:57:27 +02:00
Sebastian Głąb
fb1d730f5c tests: drivers: gpio: gpio_basic_api: Enable test on nRF54L* cpuflpr
Add overlay required to run gpio_basic_api test on
- nrf54l09pdk/nrf54l09/cpuflpr and
- nrf54l20pdk/nrf54l20/cpuflpr.

Signed-off-by: Sebastian Głąb <sebastian.glab@nordicsemi.no>
2025-04-10 12:57:27 +02:00
Tomasz Moń
b3eb6f2d11 usb: device_next: Reduce code size on Full-Speed only configuration
Allow compiler optimizations to remove High-Speed handling code. Knowing
that maximum operating speed is Full-Speed allows to reduce bulk buffers
from 512 to 64 bytes. More RAM optimizations are possible but this
commit only gets the low hanging fruits.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2025-04-10 12:57:19 +02:00
Luca Burelli
a90870da4c cmake: yaml: improve escaping of strings with backslashes and quotes
Switching the intermediate file format from JSON to YAML has a very
significant benefit: the file is now loaded via yaml_load(), which
internally calls Python to parse the file into the JSON format that
CMake expects. This means that the file contents are now automatically
escaped properly for JSON; it is a huge improvement over the previous
implementation, which was escaping everything given as input to
to_yaml().

With the removal of the now-redundant call in to_yaml(), escaping is
applied exactly once per value or list, when it is passed to yaml_set().
This allows to convert the logic in zephyr_string(ESCAPE ...) to a more
robust "escape everything" approach.

These changes fix the handling of strings with backslashes and different
types of quotes passed either directly or via generator expression. The
existing tests are updated to cover these cases.

Two other small changes are made in this commit:

- a small check in internal_yaml_list_append() is removed, as the same
  issue is already detected by the caller yaml_set() logic.

- the to_yaml() function is modified to initialize the YAML output
  variable at the top level, which is the expected behavior. This
  resulted in genex temp files sometimes having duplicate lines.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-04-10 10:11:47 +02:00
Luca Burelli
4a50fbf804 cmake: yaml: properly store strings
Store strings in YAML as single-quoted entries to avoid issues with
special characters. This also fixes a quirk with the current test
suite where the quotes in the expected value are filtered out by the
YAML import.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-04-10 10:11:47 +02:00
Christoph Winklhofer
fc37c02eb1 json: improve parsing and serializing of 'float' and 'double'
Up to now, the handling of type float was offloaded to the users of the
JSON utility, with the token JSON_TOK_FLOAT.

Improve handling of floating point types and support the types 'float'
and 'double' in a built-in way so that they can be directly parsed to
and serialized from variables (of type float or double).

The types are serialized in the shortest representation, either as a
decimal number or in scientific notation:
  * float (with JSON_TOK_FLOAT_FP): encoded with maximal 9 digits
  * double (with JSON_TOK_DOUBLE_FP): encoded with maximal 16 digits
  * NaN, Infinity, -Infinity: encoded and decoded as:
    {"nan_val":NaN,"inf_pos":Infinity,"inf_neg":-Infinity}

Enable the floating point functionality with the Kconfig option:
  JSON_LIBRARY_FP_SUPPORT=y

It requires a libc implementation with support for floating point
functions: strtof(), strtod(), isnan() and isinf().

Fixes: #59412
Signed-off-by: Christoph Winklhofer <cj.winklhofer@gmail.com>
2025-04-09 22:05:14 +02:00