1 /*
2 * Copyright (c) 2022, NXP
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 #include <zephyr/kernel.h>
8 #include <zephyr/sys/printk.h>
9 #include <zephyr/ztest.h>
10
11 __in_section(data, sram2, var) uint32_t var_file4_sram2_data = 10U;
__in_section(bss,sram2,var)12 __in_section(bss, sram2, var) uint32_t var_file4_sram2_bss;
13
14 ZTEST(code_relocation, test_function_genex_relocate_1)
15 {
16 extern uintptr_t __sram2_data_reloc_start;
17 extern uintptr_t __sram2_data_reloc_end;
18 extern uintptr_t __sram2_bss_reloc_start;
19 extern uintptr_t __sram2_bss_reloc_end;
20
21 printk("Address of var_file4_sram2_data %p\n", &var_file4_sram2_data);
22 printk("Address of var_file4_sram2_bss %p\n\n", &var_file4_sram2_bss);
23
24 zassert_between_inclusive((uintptr_t)&var_file4_sram2_data,
25 (uintptr_t)&__sram2_data_reloc_start,
26 (uintptr_t)&__sram2_data_reloc_end,
27 "var_file4_sram2_data not in sram2_data region");
28 zassert_between_inclusive((uintptr_t)&var_file4_sram2_bss,
29 (uintptr_t)&__sram2_bss_reloc_start,
30 (uintptr_t)&__sram2_bss_reloc_end,
31 "var_file4_sram2_bss not in sram2_bss region");
32 }
33