stm32/boards: Consolidate linker snippets to reduce duplication.
This commit uses the REGION_ALIAS GNU linker command to simplify the linker snippets and consolidate the duplication. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
edc92d18db
commit
fa57ee971b
@ -44,15 +44,12 @@ _micropy_hw_internal_flash_storage_ram_cache_end = ORIGIN(DTCM) + LENGTH(DTCM);
|
|||||||
_micropy_hw_internal_flash_storage_start = ORIGIN(FLASH_FS);
|
_micropy_hw_internal_flash_storage_start = ORIGIN(FLASH_FS);
|
||||||
_micropy_hw_internal_flash_storage_end = ORIGIN(FLASH_FS) + LENGTH(FLASH_FS);
|
_micropy_hw_internal_flash_storage_end = ORIGIN(FLASH_FS) + LENGTH(FLASH_FS);
|
||||||
|
|
||||||
|
REGION_ALIAS("FLASH_COMMON", FLASH_TEXT);
|
||||||
|
|
||||||
/* define output sections */
|
/* define output sections */
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
.isr_vector :
|
INCLUDE common_isr.ld
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
KEEP(*(.isr_vector))
|
|
||||||
. = ALIGN(4);
|
|
||||||
} >FLASH_TEXT
|
|
||||||
|
|
||||||
.text :
|
.text :
|
||||||
{
|
{
|
||||||
@ -65,6 +62,6 @@ SECTIONS
|
|||||||
_etext = .;
|
_etext = .;
|
||||||
} >FLASH_TEXT
|
} >FLASH_TEXT
|
||||||
|
|
||||||
INCLUDE common_extratext_data_in_flash_text.ld
|
INCLUDE common_extratext_data_in_flash.ld
|
||||||
INCLUDE common_bss_heap_stack.ld
|
INCLUDE common_bss_heap_stack.ld
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,8 @@ _heap_end = _sstack;
|
|||||||
|
|
||||||
ENTRY(Reset_Handler)
|
ENTRY(Reset_Handler)
|
||||||
|
|
||||||
|
REGION_ALIAS("FLASH_COMMON", FLASH_APP);
|
||||||
|
|
||||||
/* Define output sections */
|
/* Define output sections */
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
@ -56,22 +58,8 @@ SECTIONS
|
|||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
} >FLASH_EXT
|
} >FLASH_EXT
|
||||||
|
|
||||||
.isr_vector :
|
INCLUDE common_isr.ld
|
||||||
{
|
INCLUDE common_text.ld
|
||||||
. = ALIGN(4);
|
INCLUDE common_extratext_data_in_flash.ld
|
||||||
KEEP(*(.isr_vector))
|
|
||||||
. = ALIGN(4);
|
|
||||||
} >FLASH_APP
|
|
||||||
|
|
||||||
.text :
|
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
*(.text*)
|
|
||||||
*(.rodata*)
|
|
||||||
. = ALIGN(4);
|
|
||||||
_etext = .;
|
|
||||||
} >FLASH_APP
|
|
||||||
|
|
||||||
INCLUDE common_extratext_data_in_flash_app.ld
|
|
||||||
INCLUDE common_bss_heap_stack.ld
|
INCLUDE common_bss_heap_stack.ld
|
||||||
}
|
}
|
||||||
|
@ -41,15 +41,12 @@ _heap_end = _sstack;
|
|||||||
|
|
||||||
ENTRY(Reset_Handler)
|
ENTRY(Reset_Handler)
|
||||||
|
|
||||||
|
REGION_ALIAS("FLASH_COMMON", FLASH_APP);
|
||||||
|
|
||||||
/* Define output sections */
|
/* Define output sections */
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
.isr_vector :
|
INCLUDE common_isr.ld
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
KEEP(*(.isr_vector))
|
|
||||||
. = ALIGN(4);
|
|
||||||
} >FLASH_APP
|
|
||||||
|
|
||||||
.text :
|
.text :
|
||||||
{
|
{
|
||||||
@ -62,6 +59,6 @@ SECTIONS
|
|||||||
_etext = .;
|
_etext = .;
|
||||||
} >FLASH_APP
|
} >FLASH_APP
|
||||||
|
|
||||||
INCLUDE common_extratext_data_in_flash_app.ld
|
INCLUDE common_extratext_data_in_flash.ld
|
||||||
INCLUDE common_bss_heap_stack.ld
|
INCLUDE common_bss_heap_stack.ld
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,8 @@ _heap_end = _sstack;
|
|||||||
|
|
||||||
ENTRY(Reset_Handler)
|
ENTRY(Reset_Handler)
|
||||||
|
|
||||||
|
REGION_ALIAS("FLASH_COMMON", FLASH_APP);
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
/* Define the code that goes in QSPI flash */
|
/* Define the code that goes in QSPI flash */
|
||||||
@ -50,24 +52,8 @@ SECTIONS
|
|||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
} >FLASH_QSPI
|
} >FLASH_QSPI
|
||||||
|
|
||||||
/* The startup code goes first into main flash */
|
INCLUDE common_isr.ld
|
||||||
.isr_vector :
|
INCLUDE common_text.ld
|
||||||
{
|
INCLUDE common_extratext_data_in_flash.ld
|
||||||
. = ALIGN(4);
|
|
||||||
KEEP(*(.isr_vector))
|
|
||||||
. = ALIGN(4);
|
|
||||||
} >FLASH_APP
|
|
||||||
|
|
||||||
/* The program code and other data goes into flash */
|
|
||||||
.text :
|
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
*(.text*)
|
|
||||||
*(.rodata*)
|
|
||||||
. = ALIGN(4);
|
|
||||||
_etext = .;
|
|
||||||
} >FLASH_APP
|
|
||||||
|
|
||||||
INCLUDE common_extratext_data_in_flash_app.ld
|
|
||||||
INCLUDE common_bss_heap_stack.ld
|
INCLUDE common_bss_heap_stack.ld
|
||||||
}
|
}
|
||||||
|
@ -12,31 +12,13 @@
|
|||||||
|
|
||||||
ENTRY(Reset_Handler)
|
ENTRY(Reset_Handler)
|
||||||
|
|
||||||
|
REGION_ALIAS("FLASH_COMMON", FLASH);
|
||||||
|
|
||||||
/* define output sections */
|
/* define output sections */
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
/* The startup code goes first into FLASH */
|
INCLUDE common_isr.ld
|
||||||
.isr_vector :
|
INCLUDE common_text.ld
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
KEEP(*(.isr_vector)) /* Startup code */
|
|
||||||
|
|
||||||
. = ALIGN(4);
|
|
||||||
} >FLASH
|
|
||||||
|
|
||||||
/* The program code and other data goes into FLASH */
|
|
||||||
.text :
|
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
*(.text*) /* .text* sections (code) */
|
|
||||||
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
|
|
||||||
/* *(.glue_7) */ /* glue arm to thumb code */
|
|
||||||
/* *(.glue_7t) */ /* glue thumb to arm code */
|
|
||||||
|
|
||||||
. = ALIGN(4);
|
|
||||||
_etext = .; /* define a global symbol at end of code */
|
|
||||||
} >FLASH
|
|
||||||
|
|
||||||
INCLUDE common_extratext_data_in_flash.ld
|
INCLUDE common_extratext_data_in_flash.ld
|
||||||
INCLUDE common_bss_heap_stack.ld
|
INCLUDE common_bss_heap_stack.ld
|
||||||
}
|
}
|
||||||
|
@ -12,31 +12,13 @@
|
|||||||
|
|
||||||
ENTRY(Reset_Handler)
|
ENTRY(Reset_Handler)
|
||||||
|
|
||||||
|
REGION_ALIAS("FLASH_COMMON", FLASH_APP);
|
||||||
|
|
||||||
/* define output sections */
|
/* define output sections */
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
/* The startup code goes first into FLASH */
|
INCLUDE common_isr.ld
|
||||||
.isr_vector :
|
INCLUDE common_text.ld
|
||||||
{
|
INCLUDE common_extratext_data_in_flash.ld
|
||||||
. = ALIGN(4);
|
|
||||||
KEEP(*(.isr_vector)) /* Startup code */
|
|
||||||
|
|
||||||
. = ALIGN(4);
|
|
||||||
} >FLASH_APP
|
|
||||||
|
|
||||||
/* The program code and other data goes into FLASH */
|
|
||||||
.text :
|
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
*(.text*) /* .text* sections (code) */
|
|
||||||
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
|
|
||||||
/* *(.glue_7) */ /* glue arm to thumb code */
|
|
||||||
/* *(.glue_7t) */ /* glue thumb to arm code */
|
|
||||||
|
|
||||||
. = ALIGN(4);
|
|
||||||
_etext = .; /* define a global symbol at end of code */
|
|
||||||
} >FLASH_APP
|
|
||||||
|
|
||||||
INCLUDE common_extratext_data_in_flash_app.ld
|
|
||||||
INCLUDE common_bss_heap_stack.ld
|
INCLUDE common_bss_heap_stack.ld
|
||||||
}
|
}
|
||||||
|
@ -12,31 +12,13 @@
|
|||||||
|
|
||||||
ENTRY(Reset_Handler)
|
ENTRY(Reset_Handler)
|
||||||
|
|
||||||
|
REGION_ALIAS("FLASH_COMMON", FLASH_TEXT);
|
||||||
|
|
||||||
/* define output sections */
|
/* define output sections */
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
/* The startup code goes first into FLASH */
|
INCLUDE common_isr.ld
|
||||||
.isr_vector :
|
INCLUDE common_text.ld
|
||||||
{
|
INCLUDE common_extratext_data_in_flash.ld
|
||||||
. = ALIGN(4);
|
|
||||||
KEEP(*(.isr_vector)) /* Startup code */
|
|
||||||
|
|
||||||
. = ALIGN(4);
|
|
||||||
} >FLASH_TEXT
|
|
||||||
|
|
||||||
/* The program code and other data goes into FLASH */
|
|
||||||
.text :
|
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
*(.text*) /* .text* sections (code) */
|
|
||||||
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
|
|
||||||
/* *(.glue_7) */ /* glue arm to thumb code */
|
|
||||||
/* *(.glue_7t) */ /* glue thumb to arm code */
|
|
||||||
|
|
||||||
. = ALIGN(4);
|
|
||||||
_etext = .; /* define a global symbol at end of code */
|
|
||||||
} >FLASH_TEXT
|
|
||||||
|
|
||||||
INCLUDE common_extratext_data_in_flash_text.ld
|
|
||||||
INCLUDE common_bss_heap_stack.ld
|
INCLUDE common_bss_heap_stack.ld
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
__exidx_start = .;
|
__exidx_start = .;
|
||||||
*(.ARM.exidx*)
|
*(.ARM.exidx*)
|
||||||
__exidx_end = .;
|
__exidx_end = .;
|
||||||
} >FLASH
|
} >FLASH_COMMON
|
||||||
|
|
||||||
/* Used by the start-up code to initialise data */
|
/* Used by the start-up code to initialise data */
|
||||||
_sidata = LOADADDR(.data);
|
_sidata = LOADADDR(.data);
|
||||||
@ -19,4 +19,4 @@ _sidata = LOADADDR(.data);
|
|||||||
*(.data*)
|
*(.data*)
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_edata = .;
|
_edata = .;
|
||||||
} >RAM AT> FLASH
|
} >RAM AT> FLASH_COMMON
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
/* This linker script fragment is intended to be included in SECTIONS. */
|
|
||||||
|
|
||||||
/* For C++ exception handling */
|
|
||||||
.ARM :
|
|
||||||
{
|
|
||||||
__exidx_start = .;
|
|
||||||
*(.ARM.exidx*)
|
|
||||||
__exidx_end = .;
|
|
||||||
} >FLASH_APP
|
|
||||||
|
|
||||||
/* Used by the start-up code to initialise data */
|
|
||||||
_sidata = LOADADDR(.data);
|
|
||||||
|
|
||||||
/* Initialised data section, start-up code will copy it from flash to RAM */
|
|
||||||
.data :
|
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
_sdata = .;
|
|
||||||
*(.data*)
|
|
||||||
. = ALIGN(4);
|
|
||||||
_edata = .;
|
|
||||||
} >RAM AT> FLASH_APP
|
|
@ -1,22 +0,0 @@
|
|||||||
/* This linker script fragment is intended to be included in SECTIONS. */
|
|
||||||
|
|
||||||
/* For C++ exception handling */
|
|
||||||
.ARM :
|
|
||||||
{
|
|
||||||
__exidx_start = .;
|
|
||||||
*(.ARM.exidx*)
|
|
||||||
__exidx_end = .;
|
|
||||||
} >FLASH_TEXT
|
|
||||||
|
|
||||||
/* Used by the start-up code to initialise data */
|
|
||||||
_sidata = LOADADDR(.data);
|
|
||||||
|
|
||||||
/* Initialised data section, start-up code will copy it from flash to RAM */
|
|
||||||
.data :
|
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
_sdata = .;
|
|
||||||
*(.data*)
|
|
||||||
. = ALIGN(4);
|
|
||||||
_edata = .;
|
|
||||||
} >RAM AT> FLASH_TEXT
|
|
@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
ENTRY(Reset_Handler)
|
ENTRY(Reset_Handler)
|
||||||
|
|
||||||
|
REGION_ALIAS("FLASH_COMMON", FLASH_TEXT);
|
||||||
|
|
||||||
/* define output sections */
|
/* define output sections */
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
@ -41,19 +43,7 @@ SECTIONS
|
|||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
} >FLASH_ISR
|
} >FLASH_ISR
|
||||||
|
|
||||||
/* The program code and other data goes into FLASH */
|
INCLUDE common_text.ld
|
||||||
.text :
|
INCLUDE common_extratext_data_in_flash.ld
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
*(.text*) /* .text* sections (code) */
|
|
||||||
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
|
|
||||||
/* *(.glue_7) */ /* glue arm to thumb code */
|
|
||||||
/* *(.glue_7t) */ /* glue thumb to arm code */
|
|
||||||
|
|
||||||
. = ALIGN(4);
|
|
||||||
_etext = .; /* define a global symbol at end of code */
|
|
||||||
} >FLASH_TEXT
|
|
||||||
|
|
||||||
INCLUDE common_extratext_data_in_flash_text.ld
|
|
||||||
INCLUDE common_bss_heap_stack.ld
|
INCLUDE common_bss_heap_stack.ld
|
||||||
}
|
}
|
||||||
|
9
ports/stm32/boards/common_isr.ld
Normal file
9
ports/stm32/boards/common_isr.ld
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
/* This linker script fragment is intended to be included in SECTIONS. */
|
||||||
|
|
||||||
|
/* The startup code goes first into FLASH */
|
||||||
|
.isr_vector :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
KEEP(*(.isr_vector)) /* Startup code */
|
||||||
|
. = ALIGN(4);
|
||||||
|
} >FLASH_COMMON
|
14
ports/stm32/boards/common_text.ld
Normal file
14
ports/stm32/boards/common_text.ld
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/* This linker script fragment is intended to be included in SECTIONS. */
|
||||||
|
|
||||||
|
/* The program code and other data goes into FLASH */
|
||||||
|
.text :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
*(.text*) /* .text* sections (code) */
|
||||||
|
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
|
||||||
|
/* *(.glue_7) */ /* glue arm to thumb code */
|
||||||
|
/* *(.glue_7t) */ /* glue thumb to arm code */
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
_etext = .; /* define a global symbol at end of code */
|
||||||
|
} >FLASH_COMMON
|
Loading…
x
Reference in New Issue
Block a user