Commit Graph

2809 Commits

Author SHA1 Message Date
Bjarki Arge Andreasen
2b0d1ae4d0 soc: nordic: nrf54h: transition from gpd to zephyr pinctrl and pds
Transition nrf54h away from the soc specific gpd
(global power domain) driver which mixed power domains, pinctrl
and gpio pin retention into a non scalable solution, forcing soc
specific logic to bleed into nrf drivers.

The new solution uses zephyrs PM_DEVICE based power domains to
properly model the hardware layout of device and pin power domains,
and moves pin retention logic out of drivers into pinctrl and
gpio, which are the components which manage pins (pads).

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-07-29 09:03:37 -04:00
Daniel Leung
4b15936329 tests: kernel/smp_boot_delay: workaround occassionally failures
test_smp_boot_delay sometimes fails due to thread started by IPI
not having started or not finished running:

* Using CPU mask to explicitly state which CPU to start the thread
  seems to fix the issue where the thread is not started quickly
  enough.
* When the host  system is under heavy load (e.g. twister-ing),
  emulators may not get enough CPU time to run the newly created
  thread. So extend the IPI delay a bit more to allow for this.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-07-28 21:03:43 -04:00
Daniel Leung
95c3b8e085 tests: kernel/smp: more timeout
The concurrency and switching tests take quite some time to
finish (relatively speaking). When running in emulator and
under a heavily loaded system (e.g. twister-ing), it may
time out as the emulator is not getting much CPU time. So
make the base timeout longer, which can then be further
adjusted by the board timeout multiplier.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-07-25 08:08:09 -04:00
Krzysztof Chruściński
26fe43dd36 tests: kernel: timer: timer_behavior: Fix max_stddev calculation
max_stddev calculation was previously patched to be more at least
1 system clock cycle to cover for platforms that use higher frequency
system clock (32kHz). On that platform (nRF52) system clock frequency
was the same as tick frequency but on nRF54x that is no longer true.
Initially, the intention was to use 1 system tick and not cycle.
Fixing it now.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-07-22 19:31:31 -04:00
Sebastian Głąb
1cf511edd9 tests: kernel: timer: timer_behavior: Cleanup after nRF54LM20 rename
Remove duplicated test configuration after
nrf54l20pdk/nrf54l20/cpuxxx was renamed to
nrf54lm20dk/nrf54lm20a/cpuxxx.

Signed-off-by: Sebastian Głąb <sebastian.glab@nordicsemi.no>
2025-07-21 13:04:27 -04:00
Jimmy Zheng
74ded5884f tests: kernel: gen_isr_table: add available IRQ number for AE350 CLIC
RISC-V CLIC can trigger edge-triggered interrupts by software, but the
available IRQ sources depend on the hardware implementation.
Clarifies the IRQ source for GD32VF103 and adds support for AE350 CLIC.

Signed-off-by: Jimmy Zheng <jimmyzhe@andestech.com>
2025-07-19 15:28:58 -04:00
Jimmy Zheng
24a1baeda3 tests: kernel: interrupt: adjust test for clic
For RISC-V CLIC, only edge-triggered interrupts can be triggered by
software. Add IRQ flag to set the trigger type for RISC-V CLIC.

Signed-off-by: Jimmy Zheng <jimmyzhe@andestech.com>
2025-07-19 15:28:58 -04:00
Tom Hughes
d732a51d56 tests: kernel: gen_isr_table: Don't use IRQ1 if already used
IRQ 1 is used by the LiteX timer, so we can't use it for the test:

gen_isr_tables.py: error: multiple registrations at table_index 1 for
irq 1 (0x1)

Existing section
['.irq.WEST_TOPDIR/zephyr/tests/kernel/gen_isr_table/src/main.c.0'],
new section .irq.WEST_TOPDIR/zephyr/drivers/timer/litex_timer.c.0

Has IRQ_CONNECT or IRQ_DIRECT_CONNECT accidentally been invoked on the
same irq multiple times?

Issue #92194

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-07-02 17:58:08 -05:00
Grzegorz Swiderski
d9c5545804 tests: kernel: interrupt: Fix for nRF54H20 FLPR
Use designated IRQ numbers, instead of generic defaults.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2025-07-02 17:57:45 -05:00
Abderrahmane JARMOUNI
dd594d54f5 tests: kernel: device: expand device api coverage
Enhance device z_device_get_all_static API test

Signed-off-by: Abderrahmane JARMOUNI <git@jarmouni.me>
2025-07-01 19:03:40 -05:00
Abderrahmane JARMOUNI
ddbc7efed6 tests: kernel: device: expand device api coverage
Add test coverage for device device_get_by_dt_nodelabel() API

Signed-off-by: Abderrahmane JARMOUNI <git@jarmouni.me>
2025-07-01 19:03:40 -05:00
Abderrahmane JARMOUNI
1f4e78eb33 tests: kernel: device: add dev deinit api coverage
Add test coverage for device de-initialization API

Signed-off-by: Abderrahmane JARMOUNI <git@jarmouni.me>
2025-07-01 19:03:40 -05:00
Łukasz Stępnicki
d7fd99ecc6 tests: kernel: interrupt: generic ISR offset definition for nrf54h20 VPRs
All VPRs in nrf54h20 can have same ISR offset configuration.

Signed-off-by: Łukasz Stępnicki <lukasz.stepnicki@nordicsemi.no>
2025-07-01 05:55:36 -10:00
Karol Lasończyk
061036f9e3 tests: samples: Extend support for nRF54LM20A
Extends support and adds new overlays.

Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-06-27 18:26:57 -05:00
Duy Nguyen
f2d30ab55b tests: kernel_workq: Excluding test for qemu_rx
Excluding this test for qemu_rx because it's failing randomly
Root cause not identified yet, #92213 is created to keep track
of this
This test case is working fine on actual RX HW so issue might be
in the inside the qemu environment

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
2025-06-26 14:07:03 +02:00
Benjamin Cabé
f21f3b0d92 tests: do not use "sanity" word
Fix to align with guidelines regarding the use of inclusive language.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-25 16:00:10 -10:00
Carles Cufi
892ac07a4a cmake: Add a new no_deprecation_warning compiler flag
Commit be40d854c2ccacf14ca3fcfb01bffdc9b075c6c9 introduced the ability
of building Zephyr with deprecation warnings enabled, by making
COMPILER_WARNINGS_AS_ERRORS depend on the newly added DEPRECATION_TEST
Kconfig option. This has the downside of disabling **all** warnings, not
only the deprecation ones.

This patch instead makes DEPRECATION_TEST disable only the deprecation
warning, but leaves COMPILER_WARNINGS_AS_ERRORS enabled.
This has the advantage of being able to see other unrelated warnings
(and fail if they appear) but has the disadvantage of not printing out
the deprecation warnings themselves (since they are disabled).

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2025-06-23 12:38:07 -07:00
Benjamin Cabé
524e44fd79 tests: kernel: k_heap: add tests for k_heap_realloc
There was zero test for this new-ish kernel API so add them.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-23 12:35:33 -07:00
Benjamin Cabé
487bdb311e tests: kernel: k_heap: cleanup doxygen
Remove redundant wording from doxygen brief

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-23 12:35:33 -07:00
Aymen LAOUINI
8b4a29f1ed tests: kernel: interrupt: Add ISR offset definitions for nrf9280
- Correct test by adding ISR offset definitions for nrf9280 ppr.

Signed-off-by: Aymen LAOUINI <aymen.laouini@nordicsemi.no>
2025-06-23 09:46:25 +02:00
Aymen LAOUINI
07d9f151e7 tests: kernel: gen_isr_table: Add ISR offset definitions for nrf9280
- Correct test by adding ISR offset definitions for nrf9280 ppr.

Signed-off-by: Aymen LAOUINI <aymen.laouini@nordicsemi.no>
2025-06-23 09:46:25 +02:00
Jordan Yates
f11bddbf6e tests: kernel: k_heap_api: test k_heap_array_get
Add a basic test for the behaviour of `k_heap_array_get`.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-06-18 07:40:55 +02:00
Keith Packard
eb351f05fe test/kernel: Initialize stack_sem in obj_validation test
GCC 14.3 is not happy when this variable is left uninitialized, although
we don't actually care about the contents, just the address.

Signed-off-by: Keith Packard <keithp@keithp.com>
2025-06-17 16:06:21 +02:00
Mike J. Chen
9075d53355 kernel: fix timeout bugs
When CONFIG_TIMEOUT_64BIT is y, positive values are relative/delta
timeouts and negative values are absolute timeouts, except
for two special values. -1 is K_WAIT_FOREVER and 0 is K_NO_WAIT.
The reserved value of -1 means INT64_MAX is not a valid argument
to K_TIMEOUT_ABS_TICKS(), but there was no check. If a literal
was passed, a preprocessor/compiler warning would be generated
for overflow, but if a variable was passed as the argument,
then the code would compile but not work correctly since the
absolute timeout would be changed to a relative one. One
example of this is task_wdt_init() if no channels are enabled.

Rather than just fixing task_wdt, and trying to find other cases
in an adhoc way, this CL changes K_TIMEOUT_ABS_TICKS() to
limit the larges value to (INT64_MAX-1). It does so silently,
but given the range of int64_t, there should be no practical
difference.

Also, change the implementation for Z_IS_TIMEOUT_RELATIVE() to
fix the case where INT64_MAX relative timeout was being
improperly reported as being not a relative timeout. This was
again due to the -1 reserved value.

Add some tests for these changes to the timer_api test.

Signed-off-by: Mike J. Chen <mjchen@google.com>
2025-06-11 09:56:13 +02:00
Keith Packard
513e6ed5d2 arch/common: Mark interrupt tables const when !DYNAMIC_INTERRUPTS
When not using dynamic interrupt mapping, various interrupt tables are
configured to be stored in read-only memory in the linker script.. Mark
them const so that the linker doesn't complain.

This affects _sw_isr_table, _irq_vector_table, and z_shared_sw_isr_table in
arch/common along with _VectorTable in arch/arc.

Signed-off-by: Keith Packard <keithp@keithp.com>
2025-06-10 22:13:09 +02:00
Tom Hughes
6f433a93ab arch: riscv: core: Add support for CONFIG_ISR_TABLES_LOCAL_DECLARATION
Adjust the linker scripts to use the same setup as ARM for
CONFIG_ISR_TABLES_LOCAL_DECLARATION.

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-06-10 08:47:51 +02:00
Adam Kondraciuk
d0785ce58f tests: kernel: timer: cycle64: Add support for GRTC
For GRTC timer a longer timeout is required:
(2 ^ 32) * 2 * 1us

Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
2025-06-06 14:48:53 +01:00
Bjarki Arge Andreasen
73bf428ea1 tests: kernel: workq: work_queue: add work timeout test
Add workqueue work timeout test to work_queue test suite.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-06-06 08:42:53 +02:00
Nhut Nguyen
49f520fcd9 tests: kernel: tickless: Add support for RZ/G3S-SMARC
Add test support for System Timer driver of RZ/G3S-SMARC

Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
Signed-off-by: Hoang Nguyen <hoang.nguyen.jx@bp.renesas.com>
2025-06-03 17:08:30 +02:00
Filip Kokosinski
ba562ee684 tests: add min_ram for heap-using testcases
Two testcases have an implicit minimum memory requirement due to heap usage
and are failing with `ENOMEM` for some platforms:
* portability.xsi.single_process.newlib
* kernel.message_queue.usage

This commit filters out platform that can't satisfy this requirement.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2025-06-02 17:37:32 +02:00
Bjarki Arge Andreasen
3d24070890 kernel: work: add k_work_queue_run()
Add the ability to block and process a work queue by invoking
`k_work_queue_run` from an existing thread. This can be particularly useful
for using the main thread to process work items, in the same vein as the
system work queue, but from a lower priority/preemptible thread.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
Co-authored-by: Peter Johanson <peter@peterjohanson.com>
2025-05-30 16:37:02 +02:00
Daniel Leung
ee8bb8d473 tests: timer_api: unused var when CONFIG_ZTEST_ASSERT_VERBOSE=0
When CONFIG_ZTEST_ASSERT_VERBOSE is 0, the array round_s is not
being used by zassert_true(). So mark it __maybe_unused to
avoid compiler warnings.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-05-29 20:18:34 -04:00
Krzysztof Chruściński
5acd29e651 tests: all: Fix remaining issues reported by string validation
Fix issues reported by string validation which was added to strings
used in zassert macros.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-05-27 09:16:08 +02:00
Keith Packard
3cdc5a9f9a tests/kernel: Disable -Werror when testing deprecated pipe APIs
These two tests are validating that deprecated APIs still work
correctly. Which means they will definitely generate compile warnings.

To disable -Werror while letting it be enabled for other tests, create a
new Kconfig variable, DEPRECATION_TEST and make
COMPILER_WARNINGS_AS_ERRORS depend on that option being unselected. Add
this option to the two tests so that the resulting configuration
disables -Werror.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-05-23 17:41:40 -04:00
Adam Kondraciuk
bc06d8522e tests: kernel: timer: Align timer tests to nRF54
The new Nordic platforms use GRTC instead of RTC
as the system timer.
Also the nrf54h20 CPUPPR target does not have enough memory
to execute the `timer_behavior` test.

Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
2025-05-23 14:04:29 +02:00
Krzysztof Chruściński
96e2f8bcd0 tests: lib: Fix zassert string
Fix wrong parameter used in zassert macros.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-05-22 16:17:23 +02:00
Keith Packard
47f2136e3c tests/kernel: Adapt to picolibc 1.8.10 symbol changes
Picolibc changed things like _WANT_MINIMAL_IO_LONG_LONG to
__IO_MINIMAL_LONG_LONG in an attempt to regularize the exposed names and
eliminate names that weren't prefixed with even a single underscore.

Adapt to this change by looking for both old and new symbols.

Signed-off-by: Keith Packard <keithp@keithp.com>
2025-05-22 02:21:01 +02:00
Alberto Escolar Piedras
7be8872e6b tests/kernel: Fix code compliance issues
Fix issues detected by checkpatch

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-05-21 12:35:28 +02:00
Daniel Mangum
71c4476332 tests: kernel: usage: turn off time slicing in thread runtime stats tests
Turns off time slicing as these tests do not expect time slicing and
previously operated without time slicing, but now fallback to the new
default of a time slice size of 20 added in e337b7b. This explicitly sets
the time slice size to 0.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
2025-05-17 14:10:13 +02:00
Daniel Mangum
f47330edd8 tests: kernel: set timeslice size to 0 in tests that do not exercise it
Sets CONFIG_TIMESLICE_SIZE=0 for tests that previously expected to run
without timeslicing enabled, and now fail with the default
CONFIG_TIMESLICE_SIZE=20. Note that timeslicing functionality is still
included, but no actual timeslicing is performed.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
2025-05-16 22:55:49 +02:00
Anas Nashif
e48c90700d doc: remove more occurances of Nios II
Remove all occurances of Nios II from docs and code.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-05-15 20:01:05 -04:00
Anas Nashif
5fe84d5b69 arch: nios2: remove arch
Remove architecture and dependencies.
Remove altera HAL supporting nios2

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-05-15 20:01:05 -04:00
Duy Nguyen
e0e90375da test: Skip kernel stack protect test for RX arch
Skip kernel stack protect as the compiler not support
-fstack-protector

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
2025-05-02 09:18:16 +02:00
Duy Nguyen
d104ebaf63 test: fatal_exception: Add support for RX test
Add RX exception instruction

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
2025-05-02 09:18:16 +02:00
Arkadiusz Cholewinski
515c98139f tests: kernel/sleep: exclude npcx platforms from the test
According the specification, in extreme cases, the deviation of the APB
clock and LFCLK clock can reach up to +/-1% (+/- 10ms).
Therefore, exclude npcx platforms from the test because it required 1ms
accuracy.

fixes: #66185

Signed-off-by: Arkadiusz Cholewinski <arkadiuszx.cholewinski@intel.com>
2025-04-29 20:10:14 -04:00
Daniel Leung
4655ae3a27 tests: userspace/mem_protect: more CONFIG_SYS_HEAP_ALLOC_LOOPS
Due to the constant alloc/free cycles during the stress test,
it is possible that the heap can become fragmented enough to
prevent successful allocation, and thus failing the test.
So we change the CONFIG_SYS_HEAP_ALLOC_LOOPS to a higher value
so the allocation code will try harder to find a space.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-04-29 19:04:23 +02:00
Daniel Leung
6ccf0eb7ad tests: mem_protect/syscalls: more explicit error messages
There are lots of copy and paste error message which does not
really tell you which part fails. So make those messages more
explcitly on where it is emitting the error message.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-04-29 19:04:23 +02:00
Daniel Leung
f08c9fe2c2 tests: mem_protect/syscalls: test k_yield while in syscalls
The syscall stress test relies on timeslicing to switch between
threads, which utilizes the interrupt handling path to perform
context switching. It is also possible for kernel to switch
threads due to, for example, taking a mutex. This adds a bit of
code to the syscalls test to simulate this by yielding while
inside syscall handlers. This is to cover more scenarios so we
can catch issues earlier.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-04-29 19:04:23 +02:00
Daniel Leung
9ade47bbef tests: mem_protect/syscall: join stress threads after abort
Add a loop to join the stress threads after calling abort.
This is to make sure all stress threads have already stopped
before moving on. Simply for test hygiene.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-04-29 19:04:23 +02:00
Daniel Leung
2b13c780cb tests: mem_protect/syscalls: move torture test to another group
This moves the syscall torture test into another test group or
suite so that we run the individual syscall tests first before
the torture test. If individual test fails, it is easier to see
the error. Especially under SMP where multiple CPUs can report
the same error, cluttering the output.

Also rename the test to syscall_switch_stress to better describe
its purpose.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2025-04-29 19:04:23 +02:00