scripts: gen_relocate_app.py: Give sections unique names

The code_relocation feature creates generic section names that sometimes
conflict with already existing names.

This patch adds a '_reloc_' word to the created names to reduce the risk
of conflict.

This solves #54785.

Signed-off-by: Björn Stenberg <bjorn@haxx.se>
This commit is contained in:
Björn Stenberg 2023-02-14 14:48:37 +01:00 committed by Carles Cufí
commit 234fec579a
7 changed files with 68 additions and 68 deletions

View file

@ -29,14 +29,14 @@ void function_in_custom_section(void);
ZTEST(code_relocation, test_function_in_sram2)
{
extern uintptr_t __sram2_text_start;
extern uintptr_t __sram2_text_end;
extern uintptr_t __sram2_data_start;
extern uintptr_t __sram2_data_end;
extern uintptr_t __sram2_bss_start;
extern uintptr_t __sram2_bss_end;
extern uintptr_t __sram2_rodata_start;
extern uintptr_t __sram2_rodata_end;
extern uintptr_t __sram2_text_reloc_start;
extern uintptr_t __sram2_text_reloc_end;
extern uintptr_t __sram2_data_reloc_start;
extern uintptr_t __sram2_data_reloc_end;
extern uintptr_t __sram2_bss_reloc_start;
extern uintptr_t __sram2_bss_reloc_end;
extern uintptr_t __sram2_rodata_reloc_start;
extern uintptr_t __sram2_rodata_reloc_end;
extern uintptr_t __custom_section_start;
extern uintptr_t __custom_section_end;
@ -47,20 +47,20 @@ ZTEST(code_relocation, test_function_in_sram2)
printk("Address of var_sram2_bss %p\n\n", &var_sram2_bss);
zassert_between_inclusive((uintptr_t)&var_sram2_data,
(uintptr_t)&__sram2_data_start,
(uintptr_t)&__sram2_data_end,
(uintptr_t)&__sram2_data_reloc_start,
(uintptr_t)&__sram2_data_reloc_end,
"var_sram2_data not in sram2 region");
zassert_between_inclusive((uintptr_t)&k_sem_give,
(uintptr_t)&__sram2_text_start,
(uintptr_t)&__sram2_text_end,
(uintptr_t)&__sram2_text_reloc_start,
(uintptr_t)&__sram2_text_reloc_end,
"k_sem_give not in sram_text region");
zassert_between_inclusive((uintptr_t)&var_sram2_rodata,
(uintptr_t)&__sram2_rodata_start,
(uintptr_t)&__sram2_rodata_end,
(uintptr_t)&__sram2_rodata_reloc_start,
(uintptr_t)&__sram2_rodata_reloc_end,
"var_sram2_rodata not in sram2_rodata region");
zassert_between_inclusive((uintptr_t)&var_sram2_bss,
(uintptr_t)&__sram2_bss_start,
(uintptr_t)&__sram2_bss_end,
(uintptr_t)&__sram2_bss_reloc_start,
(uintptr_t)&__sram2_bss_reloc_end,
"var_sram2_bss not in sram2_bss region");
/* Print values from sram */

View file

@ -15,8 +15,8 @@ ZTEST(code_relocation, test_function_in_split_multiple)
{
extern uintptr_t __data_start;
extern uintptr_t __data_end;
extern uintptr_t __sram2_bss_start;
extern uintptr_t __sram2_bss_end;
extern uintptr_t __sram2_bss_reloc_start;
extern uintptr_t __sram2_bss_reloc_end;
printk("Address of var_file3_sram_data %p\n", &var_file3_sram_data);
printk("Address of var_file3_sram2_bss %p\n\n", &var_file3_sram2_bss);
@ -26,7 +26,7 @@ ZTEST(code_relocation, test_function_in_split_multiple)
(uintptr_t)&__data_end,
"var_file3_sram_data not in sram_data region");
zassert_between_inclusive((uintptr_t)&var_file3_sram2_bss,
(uintptr_t)&__sram2_bss_start,
(uintptr_t)&__sram2_bss_end,
(uintptr_t)&__sram2_bss_reloc_start,
(uintptr_t)&__sram2_bss_reloc_end,
"var_file3_sram2_bss not in sram2_bss region");
}

View file

@ -13,20 +13,20 @@ __in_section(bss, sram2, var) uint32_t var_file4_sram2_bss;
ZTEST(code_relocation, test_function_genex_relocate_1)
{
extern uintptr_t __sram2_data_start;
extern uintptr_t __sram2_data_end;
extern uintptr_t __sram2_bss_start;
extern uintptr_t __sram2_bss_end;
extern uintptr_t __sram2_data_reloc_start;
extern uintptr_t __sram2_data_reloc_end;
extern uintptr_t __sram2_bss_reloc_start;
extern uintptr_t __sram2_bss_reloc_end;
printk("Address of var_file4_sram2_data %p\n", &var_file4_sram2_data);
printk("Address of var_file4_sram2_bss %p\n\n", &var_file4_sram2_bss);
zassert_between_inclusive((uintptr_t)&var_file4_sram2_data,
(uintptr_t)&__sram2_data_start,
(uintptr_t)&__sram2_data_end,
(uintptr_t)&__sram2_data_reloc_start,
(uintptr_t)&__sram2_data_reloc_end,
"var_file4_sram2_data not in sram2_data region");
zassert_between_inclusive((uintptr_t)&var_file4_sram2_bss,
(uintptr_t)&__sram2_bss_start,
(uintptr_t)&__sram2_bss_end,
(uintptr_t)&__sram2_bss_reloc_start,
(uintptr_t)&__sram2_bss_reloc_end,
"var_file4_sram2_bss not in sram2_bss region");
}

View file

@ -13,20 +13,20 @@ __in_section(bss, sram2, var) uint32_t var_file5_sram2_bss;
ZTEST(code_relocation, test_function_genex_relocate_2)
{
extern uintptr_t __sram2_data_start;
extern uintptr_t __sram2_data_end;
extern uintptr_t __sram2_bss_start;
extern uintptr_t __sram2_bss_end;
extern uintptr_t __sram2_data_reloc_start;
extern uintptr_t __sram2_data_reloc_end;
extern uintptr_t __sram2_bss_reloc_start;
extern uintptr_t __sram2_bss_reloc_end;
printk("Address of var_file5_sram2_data %p\n", &var_file5_sram2_data);
printk("Address of var_file5_sram2_bss %p\n\n", &var_file5_sram2_bss);
zassert_between_inclusive((uintptr_t)&var_file5_sram2_data,
(uintptr_t)&__sram2_data_start,
(uintptr_t)&__sram2_data_end,
(uintptr_t)&__sram2_data_reloc_start,
(uintptr_t)&__sram2_data_reloc_end,
"var_file5_sram2_data not in sram2_data region");
zassert_between_inclusive((uintptr_t)&var_file5_sram2_bss,
(uintptr_t)&__sram2_bss_start,
(uintptr_t)&__sram2_bss_end,
(uintptr_t)&__sram2_bss_reloc_start,
(uintptr_t)&__sram2_bss_reloc_end,
"var_file5_sram2_bss not in sram2_bss region");
}

View file

@ -16,28 +16,28 @@ extern void relocated_helper(void);
void relocated_library(void)
{
extern uintptr_t __sram2_text_start;
extern uintptr_t __sram2_text_end;
extern uintptr_t __sram2_data_start;
extern uintptr_t __sram2_data_end;
extern uintptr_t __sram2_bss_start;
extern uintptr_t __sram2_bss_end;
extern uintptr_t __sram2_text_reloc_start;
extern uintptr_t __sram2_text_reloc_end;
extern uintptr_t __sram2_data_reloc_start;
extern uintptr_t __sram2_data_reloc_end;
extern uintptr_t __sram2_bss_reloc_start;
extern uintptr_t __sram2_bss_reloc_end;
printk("Address of var_lib1_sram2_data %p\n", &var_lib1_sram2_data);
printk("Address of var_lib1_sram2_bss %p\n", &var_lib1_sram2_bss);
printk("Address of relocated_lib_helper %p\n\n", &relocated_helper);
zassert_between_inclusive((uintptr_t)&var_lib1_sram2_data,
(uintptr_t)&__sram2_data_start,
(uintptr_t)&__sram2_data_end,
(uintptr_t)&__sram2_data_reloc_start,
(uintptr_t)&__sram2_data_reloc_end,
"var_lib1_sram2_data not in sram2_data region");
zassert_between_inclusive((uintptr_t)&var_lib1_sram2_bss,
(uintptr_t)&__sram2_bss_start,
(uintptr_t)&__sram2_bss_end,
(uintptr_t)&__sram2_bss_reloc_start,
(uintptr_t)&__sram2_bss_reloc_end,
"var_lib1_sram2_bss not in sram2_bss region");
zassert_between_inclusive((uintptr_t)&relocated_helper,
(uintptr_t)&__sram2_text_start,
(uintptr_t)&__sram2_text_end,
(uintptr_t)&__sram2_text_reloc_start,
(uintptr_t)&__sram2_text_reloc_end,
"relocated_helper not in sram2_text region");
relocated_helper();
}