Commit Graph

218 Commits

Author SHA1 Message Date
Shaoan Li 813ee43c81 tests: arch: arm: move test arm_irq_vector_table to new ztest API
Migrate the testsuite tests/arch/arm/arm_irq_vector_table to the
new ztest API.

Signed-off-by: Shaoan Li <shaoanx.li@intel.com>
2022-07-05 12:18:08 +00:00
Keith Packard 9e698468ce tests/arm64: Run high_addr tests using picolibc
Picolibc enables TLS, which causes relocation errors with some of these
tests without changing the compiler code model.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-07-04 15:42:53 +00:00
Reto Schneider 7a6c5710ff cmake: Update cmake_minimum_required to 3.20.0
As Zephyr currently requires CMake version 3.20.0, update all
occurrences of cmake_minimum_required.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2022-07-04 10:18:45 +02:00
Enjia Mai e023a25a5a tests: arch: x86: move the test static_idt to new ztest API
Migrate the testsuite tests/arch/x86/static_idt to the new ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-07-01 06:28:56 -04:00
Enjia Mai 6956364ec9 tests: arch: x86: move the test pagetables to new ztest API
Migrate the testsuite tests/arch/x86/pagetables to the new ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-07-01 06:28:56 -04:00
Enjia Mai 1ba0721b18 tests: arch: x86: move the test NMI to new ztest API
Migrate the testsuite tests/arch/x86/nmi to the new ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-07-01 06:28:56 -04:00
Enjia Mai 12ab020105 tests: arch: x86: move the test cpu_scrubs_regs to new ztest API
Migrate the testsuite tests/arch/x86/cpu_scrubs_regs to the new
ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-07-01 06:28:56 -04:00
Enjia Mai 7c304d6c2d tests: arch: common: move test semihost to new ztest API
Migrate the testsuite tests/arch/common/semihost to the new ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-07-01 06:28:56 -04:00
Carlo Caione c817b2661f test: arm_irq_vector_table: Fix when !CONFIG_GEN_IRQ_VECTOR_TABLE
This test is based on the wrong assumption that the IRQ vector table
symbols are always placed by the linker script also when
CONFIG_GEN_IRQ_VECTOR_TABLE is not actually set.

This is of course broken with the reworked mechanism of the IRQ vector
table placement.

Fix the test by reintroducing the old behaviour by forcefully
reinstating the symbols in the linker script.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-06-28 12:29:42 +02:00
Francois Ramu 06d222d16d tests: arm: runtime nmi testcase is flushing DCACHE
On mcu with Data Cache, when it is enabled (CONFIG_DCACHE=y),
the DCACHE must be flushed after the NMI loop to trig all
the irq, else the last one is missing.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-06-20 10:27:27 +02:00
Stephanos Ioannidis 19ba592f07 global: Correct extern K_THREAD_STACK_DEFINE usage
This commit corrects all `extern K_THREAD_STACK_DEFINE` macro usages
to use the `K_THREAD_STACK_DECLARE` macro instead.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-06-20 10:25:52 +02:00
Øyvind Rønningstad 920028e03b tests: arm_thread_swap_tz: Explicitly set the TFM_PROFILE
to NOT_SET, in case the default is changed.

Add print of failing error code for psa_hash_compute().

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2022-06-05 14:48:31 +02:00
Hu Zhenyu 59357998d1 test: Remove the TC_XXX macro in tests/arch/arm/arm_runtime_nmi
As the test case is using ztest framework, so the TC_XXX macro
is never needed.

Signed-off-by: Hu Zhenyu <zhenyu.hu@intel.com>
2022-06-05 14:47:28 +02:00
Fabio Baltieri e24314f10f include: add more missing zephyr/ prefixes
Adds few missing zephyr/ prefixes to leftover #include statements that
either got added recently or were using double quote format.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-05-27 15:20:27 -07:00
Yuval Peress 86cadf9283 ztest: Fix userspace ztests in new API
Update the new API to use K_USER as the flags for both
CONFIG_USERSPACE and CONFIG_TEST_USERSPACE. Also, fix the linker
script to properly include the suites, tests, and rules.

Fixes #44108

Signed-off-by: Yuval Peress <peress@google.com>
2022-05-25 11:20:13 +09:00
Anas Nashif a6f924db7f twister: add support for platform_type filter
Instead of relying on runtime filter to limit scope to emulation
platforms, use the type attribute for each platform and do the filtering
very early on. This will speed things up for tests where we only run on
emulation platforms.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-05-14 14:49:59 -04:00
Christoph Coenen b3dfc244ad arch: arm: Add support for multiple zero-latency irq priorities
Add the ability to have multiple irq priority levels which are not
masked by irq_lock() by adding CONFIG_ZERO_LATENCY_LEVELS.

If CONFIG_ZERO_LATENCY_LEVELS is set to a value > 1 then multiple zero
latency irqs are reserved by the kernel (and not only one). The priority
of the zero-latency interrupt can be configured by IRQ_CONNECT.

To be backwards compatible the prio argument in IRQ_CONNECT is still
ignored and the target prio set to zero if CONFIG_ZERO_LATENCY_LEVELS
is 1 (default).

Implements #45276

Signed-off-by: Christoph Coenen <ccoenen@baumer.com>
2022-05-13 08:38:28 -05:00
TLIG Dhaou 4de1d01956 boards: stm32: use size helpers to describe size of storage partition
The goal of this commit is to update existing STM32 boards descriptions
to use these size "DT_SIZE" macros to enhance readability. To realize this
i used a python script, which will detect the STM32 Boards
/zephyr/board/arm, and then will update in the dts files the partition
description using "DT_SIZE_K" and "DT_SIZE_M" macros.
Check manually and modify in .overlay files in samples and tests.

Signed-off-by: TLIG Dhaou <dhaou.tlig-ext@st.com>
2022-05-10 09:22:43 -05:00
Gerard Marull-Paretas 4b91c2d79f asm: update files with <zephyr/...> include prefix
Assembler files were not migrated with the new <zephyr/...> prefix.
Note that the conversion has been scripted, refer to #45388 for more
details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-09 12:45:29 -04:00
Gerard Marull-Paretas ade7ccb918 tests: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all tests to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 20:02:14 +02:00
Daniel Leung 5a38451332 tests: x86/info: make it work with CONFIG_COUNTER_CMOS=n
There are boards without CMOS RTC, where blind accesses to
the RTC registers will freeze the system. So make the test
works with these boards if CONFIG_COUNTER_CMOS=n.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-05-04 09:42:26 -05:00
Jordan Yates 685e53231f tests: lib: semihost: test file operations
Add tests for basic file operations under semihosting.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-04-21 13:04:52 +02:00
Ryan McClelland f7ddcd2713 arch: arm: aarch32: initialize FPSCR to reset value for ARMv8.1
With GCC 11 now supporting low overhead branching in ARMv8.1, ASM "LE"
(loop-end) instructions would trigger an INVSTATE hard-fault after
FPSCR was set to 0. This was due to the FPSCR getting a new field in
ARMv8.1. LTPSIZE is now set to it's reset value of Tail predication not
applied.

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2022-04-15 10:33:48 -07:00
Katarzyna Giadla 681e3a16c7 tests: Change duplicated names of the test cases
Some names of the test cases are duplicated within the project.
This commit contains the proposed names of the test scenarios.

Signed-off-by: Katarzyna Giadla <katarzyna.giadla@nordicsemi.no>
2022-03-30 17:42:01 -04:00
Nazar Kazakov f483b1bc4c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-18 13:24:08 -04:00
Bradley Bolen c0dd594d4d arch: arm: aarch32: Change CPU_CORTEX_R kconfig option
Change the CPU_CORTEX_R kconfig option to CPU_AARCH32_CORTEX_R to
distinguish the armv7 version from the armv8 version of Cortex-R.

Signed-off-by: Bradley Bolen <bbolen@lexmark.com>
2022-02-23 08:14:15 -06:00
Daniel Leung e510dba95e tests: x86/info: only tests PC compatible platforms
This adds a filter to only tests platforms that has
CONFIG_X86_PC_COMPATIBLE enabled. ACPI, multiboot and
CMOS RTC are usually all present on PC compatible and
not embedded ones. So limit the scope here.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-02-21 21:56:32 -05:00
Joakim Andersson 17f8932f16 modules: trusted-firmware-m: Use TF-M install headers as interface
Use the set of headers that the TF-M build system places in the
install output. Not all public header files are available in the
interface/include directory and the TF-M build system uses the install
mechanism of cmake to include additional headers based on platform
or configuration.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2022-02-01 11:31:36 +01:00
Mahesh Mahadevan 27cf263673 tests: arch: arm_irq_vector_table: Update to run on MXRT595
Update the custom vector table to add the OS Event timer
interrupt which is used on RT595 as the kernel system timer

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-01-19 13:35:09 -06:00
Daniel Leung 8f7f62869a tests: remove @return doc for void functions
For functions returning nothing, there is no need to document
with @return, as Doxgen complains about "documented empty
return type of ...".

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-12 16:02:16 -05:00
Tomasz Bursztyka 20b653f387 tests/x86: Improve ACPI output on info test
Print out DMAR's device id for each device scopes.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Sebastian Bøe 5536e6198b tests: arm_thread_swap_tx: nucleo_l552ze_q: Update flash partition
Due to a recent change in TFM, some more space should be allocated
to mcuboot flash partition (some space should be allocated for OTP)
(Cf commit db07170a34f ("Platform: Allocate space in flash for OTP")
in trusted-firmware-m repo)
Take this into account and increase mcuboot flash partition for
nucleo_l552ze_q_ns target.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2022-01-04 12:33:23 +01:00
Jimmy Brisson 2e1f26fd77 Tests: disable mps3_an547_ns fpu sharing test
TFM disables the FPU on this target, so the test will usagefault
with a NOCP exception type when run.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Signed-off-by: Jimmy Brisson <jimmy.brisson@linaro.org>
2022-01-04 12:33:23 +01:00
Daniel DeGrasse 1067c2fdb7 tests: arch: arm: irq_vector_table Add correct ISR table for iMX.RT SOCs
RT1xxx SOCs using the GPT timer require a custom ISR table for the arm
irq_vector_table test, since they use a custom system timer implemented
using the GPT peripheral. Implement the required vector tables within
the irq_vector_table test to enable it to run.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-13 20:13:21 -05:00
Ryan McClelland a000acca5f tests: fix double promotion warning
With -Wdouble-promotion added to the warning base, fix warnings given
by the compiler.

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2021-11-24 17:14:25 -05:00
Joakim Andersson dda3a5ad0d modules: tfm: Split trusted-firmware-m repository
Split the zephyr project maintained repository trusted-firmware-m into
forks of the individual upstream repositories.

https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git
Upstream: TF-Mv1.4.1
Additions:
zephyr: module: Add zephyr module file
trusted-firmware-m: platform: lpcxpresso55s69: Update SDK

https://git.trustedfirmware.org/TF-M/tf-m-tests.git
Upstream: 51ff2bdfae043f6dd0813b000d928c4bda172660
Additions:
zephyr: module: Add module file for tf-m-tests

https://github.com/ARM-software/psa-arch-tests.git
Upstream: 60faad2ead1b967ec8e73accd793d3ed0e5c56bd
Additions:
zephyr: module: Add module file for psa-arch-tests
psa-arch-tests: Allow overriding of toolchain file

The organization of folders remain the same with the following
exceptions:
Moved:
root folder moved from modules/tee/tfm to modules/tee/tf-m to avoid
problems with west update.
zephyr/module.yml to trusted-firmware-m/zephyr/module.yml and
${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR} points to what was previously
${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/trusted-firmware-m.
Added:
psa-arch-tests/zephyr/module.yml and ${ZEPHYR_PSA_ARCH_TESTS_MODULE_DIR}
tf-m-tests/zephyr/module/ and ${ZEPHYR_TF_M_TESTS_MODULE_DIR}
Removed:
init-git.sh
README.rst

Fixes: #39353

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-11-01 11:20:06 -04:00
Neil Armstrong 481b5a2424 tests: arm64: add GICv3 ITS test suite
Add a simple ITS driver test allocating 8192 LPIs over 256 DeviceIDS
and 32 EventIDs per DeviceID to exercise the ITS for the MSI/MSI-X
usecase.

The test is set as `build_only: true` and whitelisted to the
fvp_base_revc_2xaemv8a board until the shipped Zephyr QEMU
has the ITS support.
Since `fvp_base_revc_2xaemv8a` needs FIP & BL1 files, test is marked
as `skip: true`.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2021-09-28 19:45:29 -04:00
Neil Armstrong 0619e96e87 boards: fvp_base_revc_2xaemv8a: reserve HEAP for GICv3 ITS tables
The ITS needs a number of table, so HEAP must be reserved for runtime
allocation (1MiB is a round and convenient value):
- Redistributor:
* 64K table for all redistributors
* 64k for each redistributors
- ITS:
* 4K collection table aligned on 4K
* 4K x 128 device table aligned on 4K

This makes 11x64K to permit all allocations to success.

Note, will need 64K HEAP_MEM per CPUs added.

This doesn't necessarily include the Interrupt Translation Table,
which are 256bytes aligned tables, for reference a 32 ITEs table
needs 256bytes.
With 14x64K HEAP, up to 116 ITT tables of 32 ITEs can be allocated.

A specific HEAP_MEM_POOL_SIZE as been added to arm64_gicv3_its test
for the fvp_base_revc_2xaemv8a board to satisfy all memory allocation
constraints for 256 ITT tables with 32 ITEs allocations.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2021-09-28 19:45:29 -04:00
Carlo Caione 0f3d2d9230 test: Add arm64_high_addresses test
Latel we have had several failures and regressions due to the setting of
CONFIG_SRAM_BASE_ADDRESS to really high values (over the 4GB boundary).
To try to catch these problems as early as possible we add a build-only
test based on the hello_world_user sample that tries to compile the test
using a combination of CONFIG_SRAM_BASE_ADDRESS and
CONFIG_KERNEL_VM_BASE set to high values in memory.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-08-30 13:38:07 -04:00
Torsten Rasmussen 3d82c7c828 linker: align _image_text_start/end/size linker symbols name
Cleanup and preparation commit for linker script generator.

Zephyr linker scripts provides start and end symbols for each larger
areas in the linker script.

The symbols _image_text_start and _image_text_end sometimes includes
linker/kobject-text.ld. This mean there must be both the regular
__text_start and __text_end symbols for the pure text section, as well
as <group>_start and <group>_end symbols.

The symbols describing the text region which covers more than just the
text section itself will thus be changed to:
_image_text_start -> __text_region_start
_image_text_end   -> __text_region_end

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-08-28 08:48:03 -04:00
Torsten Rasmussen c6aded2dcb linker: align _image_rodata and _image_rom start/end/size linker symbols
Cleanup and preparation commit for linker script generator.

Zephyr linker scripts provides start and end symbols for each larger
areas in the linker script.

The symbols _image_rom_start and _image_rom_end corresponds to the group
ROMABLE_REGION defined in the ld linker scripts.

The symbols _image_rodata_start and _image_rodata_end is not placed as
independent group but covers common-rom.ld, thread-local-storage.ld,
kobject-rom.ld and snippets-rodata.ld.

This commit align those names and prepares for generation of groups in
linker scripts.

The symbols describing the ROMABLE_REGION will be renamed to:
_image_rom_start -> __rom_region_start
_image_rom_end   -> __rom_region_end

The rodata will also use the group symbol notation as:
_image_rodata_start -> __rodata_region_start
_image_rodata_end   -> __rodata_region_end

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-08-28 08:48:03 -04:00
Torsten Rasmussen 510d7dbfb6 linker: align _ramfunc_ram/rom_start/size linker symbol names
Cleanup and preparation commit for linker script generator.

Zephyr linker scripts provides start and end symbols for each section,
and sometimes even size and LMA start symbols.

Generally, start and end symbols uses the following pattern, as:
Section name:             foo
Section start symbol:     __foo_start
Section end symbol:       __foo_end

However, this pattern is not followed consistently.
To allow for linker script generation and ensure consistent naming of
symbols then the following pattern is introduced consistently to allow
for cleaner linker script generation.
Section name:             foo
Section start symbol:     __foo_start
Section end symbol:       __foo_end
Section size symbol:      __foo_size
Section LMA start symbol: __foo_load_start

This commit aligns the symbols for _ramfunc_ram/rom to other symbols and
in such a way they follow consistent pattern which allows for linker
script and scatter file generation.

The symbols are named according to the section name they describe.
Section name is `ramfunc`

The following symbols are aligned in this commit:
-  _ramfunc_ram_start  -> __ramfunc_start
-  _ramfunc_ram_end    -> __ramfunc_end
-  _ramfunc_ram_size   -> __ramfunc_size
-  _ramfunc_rom_start  -> __ramfunc_load_start

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-08-28 08:48:03 -04:00
Daniel Leung 6a58c34aa6 tests: x86/pagetables: limit permission test under demand paging
When demand paging is enabled and not all generic sections are
in physical memory at boot, only tests the permission up to the end
of the pinned section.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-26 21:16:22 -04:00
Stephanos Ioannidis 58dbd41b96 tests: arch: arm_no_multithreading: Run on mps3_an547 board
This commit updates the `arm_no_multithreading` test to run on the
recently added `mps3_an547` board.

The `mps3_an547` SoC includes the Cortex-M55 processor which implements
the ARMv8.1-M architecture that is not covered by any of the boards in
the current "allowed platforms" list for this test.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2021-08-25 18:05:01 -04:00
Stephanos Ioannidis ba7fda70ff tests: arch: arm_no_multithreading: Fix FPSCR validation for ARMv8.1-M
This commit fixes the FPSCR register initialisation validation test
for the ARMv8.1-M architecture.

For ARMv8.1-M, the newly added LTPSIZE field in the FPSCR may always
read the value of 4 when the M-Profile Vector Extension (MVE) is not
implemented or FP context is not active, so we must ignore its value
when validating the FPSCR register initialisation.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2021-08-25 18:05:01 -04:00
Stephanos Ioannidis 06b1501694 tests: arch: arm_thread_swap: Fix FPSCR validation for ARMv8.1-M
This commit fixes the FPSCR register initialisation validation test
for the ARMv8.1-M architecture.

For ARMv8.1-M, the newly added LTPSIZE field in the FPSCR may always
read the value of 4 when the M-Profile Vector Extension (MVE) is not
implemented or FP context is not active, so we must ignore its value
when validating the FPSCR register initialisation.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2021-08-25 18:05:01 -04:00
Torsten Rasmussen 1cccc8a8fe cmake: increase minimal required version to 3.20.0
Move to CMake 3.20.0.

At the Toolchain WG it was decided to move to CMake 3.20.0.

The main reason for increasing CMake version is better toolchain
support.

Better toolchain support is added in the following CMake versions:
- armclang, CMake 3.15
- Intel oneAPI, CMake 3.20
- IAR, CMake 3.15 and 3.20

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-08-20 09:47:34 +02:00
Bradley Bolen 5accf3596a tests: arm_mem_protect: Add a test for stack pointer manipulation
The Cortex-R architecture uses the threads stack to save context.
However, that is a security hole since a userspace thread could
manipulate the stack pointer before performing a system call and cause
the kernel to write to memory that it should not.  This test will sanity
check that the Cortex-R svc and isr routines do not write to a userspace
supplied stack.

Signed-off-by: Bradley Bolen <bbolen@lexmark.com>
2021-08-17 06:06:33 -04:00
Ioannis Glaropoulos 453ce7b593 tests: arm: adding a new test-suite for HardFault validation
Adding a new test-suite for HardFault validation,
for Cortex-M Mainline architecture.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2021-07-28 21:08:18 -04:00
Ioannis Glaropoulos ab7258a9d5 test: arm: no-multithreading: test triggering PendSV
Add a test case to verify that triggering a
PendSV will lead to a Reserved Exception and
a CPU error, in the no-multithreading case.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2021-07-28 21:08:18 -04:00