mirror of
https://github.com/candle-usb/candleLight_fw.git
synced 2025-01-28 06:02:52 +08:00
dfdcb38336
startup files generated by stm32cubeIDE do this. Mostly useless since none of our code uses that; the linking step gets rid of those sections anyway. objdump before: 200000a8 l .data 00000000 __fini_array_end 200000a4 l .data 00000000 __fini_array_start 200000a4 l .data 00000000 __init_array_end 200000a0 l .data 00000000 __preinit_array_end 200000a0 l .data 00000000 __init_array_start 200000a0 l .data 00000000 __preinit_array_start after: 0800419c l .fini_array 00000000 __fini_array_end 08004198 l .fini_array 00000000 __fini_array_start 08004198 l .init_array 00000000 __init_array_end 08004194 l .preinit_array 00000000 __preinit_array_end 08004194 l .init_array 00000000 __init_array_start 08004194 l .preinit_array 00000000 __preinit_array_start
159 lines
2.9 KiB
PHP
159 lines
2.9 KiB
PHP
/**
|
|
* The following is a template linker script since most of this is identical accross targets.
|
|
*
|
|
* the cmake build sys will process this with 'configure_file()' into a cpu-specific header.
|
|
*
|
|
* It would be possible to use gcc to preprocess a common .ld file (and therefore leverage
|
|
* #ifdef and other mechanisms), but has certain limitations and challenges that I decided to avoid.
|
|
*
|
|
*
|
|
* fenugrec 2022
|
|
*/
|
|
|
|
__STACK_SIZE = @LDV_STACK_SIZE@;
|
|
__HEAP_SIZE = @LDV_HEAP_SIZE@;
|
|
|
|
__FLASH_SIZE = @LDV_FLASH_SIZE@;
|
|
__RAM_SIZE = @LDV_RAM_SIZE@;
|
|
|
|
MEMORY
|
|
{
|
|
FLASH (rx) : ORIGIN = @LDV_FLASH_START@, LENGTH = __FLASH_SIZE
|
|
RAM (rw) : ORIGIN = @LDV_RAM_START@, LENGTH = __RAM_SIZE
|
|
}
|
|
|
|
ENTRY(Reset_Handler)
|
|
|
|
SECTIONS
|
|
{
|
|
.text :
|
|
{
|
|
KEEP(*(.vectors))
|
|
*(.text*)
|
|
|
|
KEEP(*(.init))
|
|
KEEP(*(.fini))
|
|
|
|
/* .ctors */
|
|
*crtbegin.o(.ctors)
|
|
*crtbegin?.o(.ctors)
|
|
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
|
|
*(SORT(.ctors.*))
|
|
*(.ctors)
|
|
|
|
/* .dtors */
|
|
*crtbegin.o(.dtors)
|
|
*crtbegin?.o(.dtors)
|
|
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
|
|
*(SORT(.dtors.*))
|
|
*(.dtors)
|
|
|
|
*(.rodata*)
|
|
|
|
KEEP(*(.eh_frame*))
|
|
} > FLASH
|
|
|
|
.ARM.extab :
|
|
{
|
|
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
|
} > FLASH
|
|
|
|
__exidx_start = .;
|
|
.ARM.exidx :
|
|
{
|
|
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
|
} > FLASH
|
|
__exidx_end = .;
|
|
|
|
.copy.table :
|
|
{
|
|
. = ALIGN(4);
|
|
__copy_table_start__ = .;
|
|
LONG (__etext)
|
|
LONG (__data_start__)
|
|
LONG (__data_end__ - __data_start__)
|
|
__copy_table_end__ = .;
|
|
} > FLASH
|
|
|
|
|
|
.preinit_array :
|
|
{
|
|
. = ALIGN(4);
|
|
/* preinit data */
|
|
PROVIDE_HIDDEN (__preinit_array_start = .);
|
|
KEEP(*(.preinit_array))
|
|
PROVIDE_HIDDEN (__preinit_array_end = .);
|
|
. = ALIGN(4);
|
|
} >FLASH
|
|
|
|
.init_array :
|
|
{
|
|
. = ALIGN(4);
|
|
/* init data */
|
|
PROVIDE_HIDDEN (__init_array_start = .);
|
|
KEEP(*(SORT(.init_array.*)))
|
|
KEEP(*(.init_array))
|
|
PROVIDE_HIDDEN (__init_array_end = .);
|
|
. = ALIGN(4);
|
|
} >FLASH
|
|
|
|
.fini_array :
|
|
{
|
|
. = ALIGN(4);
|
|
PROVIDE_HIDDEN (__fini_array_start = .);
|
|
KEEP (*(SORT(.fini_array.*)))
|
|
KEEP (*(.fini_array*))
|
|
PROVIDE_HIDDEN (__fini_array_end = .);
|
|
. = ALIGN(4);
|
|
} >FLASH
|
|
|
|
__etext = ALIGN (4);
|
|
|
|
.data : AT (__etext)
|
|
{
|
|
__data_start__ = .;
|
|
*(vtable)
|
|
*(.data)
|
|
*(.data.*)
|
|
|
|
|
|
. = ALIGN(4);
|
|
/* All data end */
|
|
__data_end__ = .;
|
|
|
|
} > RAM
|
|
|
|
.bss :
|
|
{
|
|
. = ALIGN(4);
|
|
__bss_start__ = .;
|
|
*(.bss)
|
|
*(.bss.*)
|
|
*(COMMON)
|
|
. = ALIGN(4);
|
|
__bss_end__ = .;
|
|
} > RAM AT > RAM
|
|
|
|
.heap (COPY) :
|
|
{
|
|
. = ALIGN(8);
|
|
__end__ = .;
|
|
PROVIDE(end = .);
|
|
. = . + __HEAP_SIZE;
|
|
. = ALIGN(8);
|
|
__HeapLimit = .;
|
|
} > RAM
|
|
|
|
.stack (ORIGIN(RAM) + LENGTH(RAM) - __STACK_SIZE) (COPY) :
|
|
{
|
|
. = ALIGN(8);
|
|
__StackLimit = .;
|
|
. = . + __STACK_SIZE;
|
|
. = ALIGN(8);
|
|
__StackTop = .;
|
|
} > RAM
|
|
PROVIDE(__stack = __StackTop);
|
|
|
|
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
|
|
}
|