Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

projmgr: Fix linker script templates for Armv8-M TrustZone #1062

Merged
merged 1 commit into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 13 additions & 16 deletions tools/projmgr/templates/ac6_linker_script.sct
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
Stack seal size definition
*----------------------------------------------------------------------------*/
#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
#define __STACKSEAL_SIZE ( 8 )
#define __STACKSEAL_SIZE 8
#else
#define __STACKSEAL_SIZE ( 0 )
#define __STACKSEAL_SIZE 0
#endif

/*----------------------------------------------------------------------------
Expand All @@ -31,26 +31,23 @@

LR_ROM0 __ROM0_BASE __ROM0_SIZE {

#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
ER_CMSE_VENEER __ROM0_BASE+__ROM0_SIZE -__ROM0_SIZE {
*(Veneer$$CMSE)
ER_ROM0 __ROM0_BASE __ROM0_SIZE {
*.o (RESET, +First)
*(InRoot$$Sections)
*(+RO +XO)
}
#define ER_CMSE_VENEER_SIZE AlignExpr(ImageLength(ER_CMSE_VENEER), 8)
#else
#define ER_CMSE_VENEER_SIZE 0
#endif

ER_ROM0 __ROM0_BASE (__ROM0_SIZE - ER_CMSE_VENEER_SIZE) {
*.o (RESET, +First)
*(InRoot$$Sections)
*(+RO +XO)
#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
ER_CMSE_VENEER AlignExpr(+0, 32) (__ROM0_SIZE - AlignExpr(ImageLength(ER_ROM0), 32)) {
*(Veneer$$CMSE)
}
#endif

RW_NOINIT __RAM0_BASE UNINIT (__RAM0_SIZE - __HEAP_SIZE - __STACK_SIZE) {
RW_NOINIT __RAM0_BASE UNINIT (__RAM0_SIZE - __HEAP_SIZE - __STACK_SIZE - __STACKSEAL_SIZE) {
*(.bss.noinit)
}

RW_RAM0 AlignExpr(+0, 8) (__RAM0_SIZE - __HEAP_SIZE - __STACK_SIZE - AlignExpr(ImageLength(RW_NOINIT), 8)) {
RW_RAM0 AlignExpr(+0, 8) (__RAM0_SIZE - __HEAP_SIZE - __STACK_SIZE - __STACKSEAL_SIZE - AlignExpr(ImageLength(RW_NOINIT), 8)) {
*(+RW +ZI)
}

Expand All @@ -63,7 +60,7 @@ LR_ROM0 __ROM0_BASE __ROM0_SIZE {
}

#if __STACKSEAL_SIZE > 0
STACKSEAL +0 EMPTY 8 { ; Reserve empty region for stack seal immediately after stack
STACKSEAL +0 EMPTY __STACKSEAL_SIZE { ; Reserve empty region for stack seal immediately after stack
}
#endif

Expand Down
10 changes: 9 additions & 1 deletion tools/projmgr/templates/clang_linker_script.ld
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ SECTIONS

} >ROM0 AT>ROM0 :text

#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
.veneers :
{
. = ALIGN(32);
KEEP(*(.gnu.sgstubs))
} > ROM0 AT>ROM0 :text
#endif

.toc : {
*(.toc .toc.*)
} >ROM0 AT>ROM0 :text
Expand Down Expand Up @@ -277,7 +285,7 @@ SECTIONS
} >RAM0 :ram

#if __STACKSEAL_SIZE > 0
PROVIDE(__stack_seal = __stack)
PROVIDE(__stack_seal = __stack);
.stackseal (__stack) (NOLOAD) :
{
. += __STACKSEAL_SIZE;
Expand Down
Loading