mirror of
https://github.com/candle-usb/candleLight_fw.git
synced 2025-01-14 05:42:53 +08:00
05fe629e5c
This had probably been accidentally reverted in 2ebc665109887bfe95a4ad63ebe5e1d7d13c0fef ? flash_data_rom ended up on the same flash page as other unrelated data, which meant flash_flush() would've erased too much. Also reduce nvm area to 1k and use variables to calculate area. (F042 devices only have 1kB pages vs 2k for the F072)
152 lines
2.6 KiB
Plaintext
152 lines
2.6 KiB
Plaintext
__STACK_SIZE = 2K;
|
|
__HEAP_SIZE = 10K;
|
|
|
|
__FLASH_SIZE = 128K;
|
|
__NVM_SIZE = 1K;
|
|
|
|
MEMORY
|
|
{
|
|
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = __FLASH_SIZE - __NVM_SIZE
|
|
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 16K
|
|
DATA (xrw) : ORIGIN = 0x08000000 + __FLASH_SIZE - __NVM_SIZE, LENGTH = __NVM_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
|
|
|
|
.zero.table :
|
|
{
|
|
. = ALIGN(4);
|
|
__zero_table_start__ = .;
|
|
__zero_table_end__ = .;
|
|
} > FLASH
|
|
|
|
__etext = ALIGN (4);
|
|
|
|
.user_data :
|
|
{
|
|
. = ALIGN(4);
|
|
*(.user_data)
|
|
. = ALIGN(4);
|
|
} > DATA
|
|
|
|
.data : AT (__etext)
|
|
{
|
|
__data_start__ = .;
|
|
*(vtable)
|
|
*(.data)
|
|
*(.data.*)
|
|
|
|
. = ALIGN(4);
|
|
/* preinit data */
|
|
PROVIDE_HIDDEN (__preinit_array_start = .);
|
|
KEEP(*(.preinit_array))
|
|
PROVIDE_HIDDEN (__preinit_array_end = .);
|
|
|
|
. = ALIGN(4);
|
|
/* init data */
|
|
PROVIDE_HIDDEN (__init_array_start = .);
|
|
KEEP(*(SORT(.init_array.*)))
|
|
KEEP(*(.init_array))
|
|
PROVIDE_HIDDEN (__init_array_end = .);
|
|
|
|
|
|
. = ALIGN(4);
|
|
/* finit data */
|
|
PROVIDE_HIDDEN (__fini_array_start = .);
|
|
KEEP(*(SORT(.fini_array.*)))
|
|
KEEP(*(.fini_array))
|
|
PROVIDE_HIDDEN (__fini_array_end = .);
|
|
|
|
KEEP(*(.jcr*))
|
|
. = 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")
|
|
}
|