[ion/device] Share a RAM linker script

This commit is contained in:
Romain Goyet
2019-02-08 18:17:30 +01:00
parent 4c5636e738
commit 4eeffbd98c
3 changed files with 1 additions and 78 deletions

View File

@@ -58,7 +58,7 @@ openocd:
# fully filled
ifeq ($(EPSILON_USB_DFU_XIP)$(EPSILON_DEVICE_BENCH),10)
ion/src/$(PLATFORM)/shared/usb/flasher.o: SFLAGS += $(ION_DEVICE_SFLAGS)
flasher.$(EXE): LDSCRIPT = ion/src/$(PLATFORM)/$(MODEL)/ram.ld
flasher.$(EXE): LDSCRIPT = ion/src/$(PLATFORM)/shared/ram.ld
flasher.$(EXE): $(objs) ion/src/$(PLATFORM)/shared/usb/flasher.o
else
flasher.$(EXE):

View File

@@ -1,77 +0,0 @@
/* Create a USB DFU firmware that runs from RAM.
* Flashing using ST's ROMed DFU bootloader is reliable but very slow. To make
* flashing faster, we can leverage ST's bootloader to copy a small "flasher" in
* RAM, and run it from there.
* Caution: ST's bootloader uses some RAM, so we want to stay off of that memory
* region. Per AN2606, section 47, it's using 0x20003000 - 0x2003FFFF; We'll try
* to play safe and avoid the first 32KB of RAM. */
MEMORY {
RAM_BUFFER (rw) : ORIGIN = 0x20000000 + 32K, LENGTH = 256K - 32K
}
/* The stack is quite large, and should really be equal to Epsilon's. Indeed,
* we're making the Calculator object live on the stack, and it's quite large
* (about 4K just for this single object). Using a stack too small will result
* in some memory being overwritten (for instance, vtables that live in the
* .rodata section). */
STACK_SIZE = 32K;
SECTIONS {
.isr_vector_table ORIGIN(RAM_BUFFER) : {
KEEP(*(.isr_vector_table))
} >RAM_BUFFER
.text : {
. = ALIGN(4);
*(.text)
*(.text.*)
} >RAM_BUFFER
.init_array : {
. = ALIGN(4);
_init_array_start = .;
KEEP (*(.init_array*))
_init_array_end = .;
} >RAM_BUFFER
.rodata : {
. = ALIGN(4);
*(.rodata)
*(.rodata.*)
} >RAM_BUFFER
.data : {
. = ALIGN(4);
*(.data)
*(.data.*)
} >RAM_BUFFER
.bss : {
. = ALIGN(4);
_bss_section_start_ram = .;
*(.bss)
*(.bss.*)
*(COMMON)
_bss_section_end_ram = .;
} >RAM_BUFFER
.stack : {
. = ALIGN(8);
_stack_end = .;
. += (STACK_SIZE - 8);
. = ALIGN(8);
_stack_start = .;
} >RAM_BUFFER
.phony : {
/* We won't do dynamic memory allocation */
_heap_start = .;
_heap_end = .;
/* Effectively bypass copying .data to RAM */
_data_section_start_flash = .;
_data_section_start_ram = .;
_data_section_end_ram = .;
} >RAM_BUFFER
}