Skip to content

Commit 8ba3999

Browse files
PetervdPerk-NXPkartben
authored andcommitted
tests: vector_table_relocation: Add DTCM and ITCM testcases
Expand vector table relocation with DTCM and ITCM veriants if applicable Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
1 parent 7d9e892 commit 8ba3999

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

tests/application_development/vector_table_relocation/src/main.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,20 @@
1111
#include <zephyr/kernel.h>
1212
#include <zephyr/sys/printk.h>
1313
#include <zephyr/ztest.h>
14+
#include <zephyr/devicetree.h>
15+
16+
#if defined(CONFIG_ARM_VECTOR_TABLE_DTCM)
17+
#define DTCM_NODE DT_CHOSEN(zephyr_dtcm)
18+
#define SRAM_VT_BASE DT_REG_ADDR(DTCM_NODE)
19+
#define SRAM_VT_SIZE DT_REG_SIZE(DTCM_NODE)
20+
#elif defined(CONFIG_ARM_VECTOR_TABLE_ITCM)
21+
#define ITCM_NODE DT_CHOSEN(zephyr_itcm)
22+
#define SRAM_VT_BASE DT_REG_ADDR(ITCM_NODE)
23+
#define SRAM_VT_SIZE DT_REG_SIZE(ITCM_NODE)
24+
#else
25+
#define SRAM_VT_BASE CONFIG_SRAM_BASE_ADDRESS
26+
#define SRAM_VT_SIZE (CONFIG_SRAM_SIZE * 1024U)
27+
#endif
1428

1529
#ifdef SCB_VTOR_TBLBASE_Msk
1630
#define VTOR_MASK (SCB_VTOR_TBLBASE_Msk | SCB_VTOR_TBLOFF_Msk)
@@ -54,8 +68,7 @@ ZTEST(vector_table_relocation, test_vector_table_in_ram)
5468
volatile uint32_t vtor_address = SCB->VTOR & VTOR_MASK;
5569

5670
printf("VTOR address: 0x%x\n", vtor_address);
57-
zassert_true(vtor_address >= CONFIG_SRAM_BASE_ADDRESS &&
58-
vtor_address <= CONFIG_SRAM_BASE_ADDRESS + CONFIG_SRAM_SIZE * 1024U,
71+
zassert_true(vtor_address >= SRAM_VT_BASE && vtor_address <= SRAM_VT_BASE + SRAM_VT_SIZE,
5972
"Vector table is not in RAM! Address: 0x%x", vtor_address);
6073
}
6174

tests/application_development/vector_table_relocation/testcase.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,15 @@ tests:
1111
- mps3/corstone310/fvp
1212
- mps4/corstone315/fvp
1313
- mps4/corstone320/fvp
14+
15+
application_development.vector_table_relocation.dtcm:
16+
arch_allow: arm
17+
filter: CONFIG_CPU_CORTEX_M_HAS_VTOR and dt_chosen_enabled("zephyr,dtcm")
18+
extra_configs:
19+
- CONFIG_ARM_VECTOR_TABLE_DTCM=y
20+
21+
application_development.vector_table_relocation.itcm:
22+
arch_allow: arm
23+
filter: CONFIG_CPU_CORTEX_M_HAS_VTOR and dt_chosen_enabled("zephyr,itcm")
24+
extra_configs:
25+
- CONFIG_ARM_VECTOR_TABLE_ITCM=y

0 commit comments

Comments
 (0)