diff --git a/ion/src/device/shared/ram20008000-20032000.ld b/ion/src/device/shared/ram20008000-20032000.ld deleted file mode 100644 index ce579d756..000000000 --- a/ion/src/device/shared/ram20008000-20032000.ld +++ /dev/null @@ -1,81 +0,0 @@ -/* Create a firmware that runs from RAM. - * Caution: ST's bootloader uses some RAM, so we want to stay off of that memory - * region. Per AN2606, sections 31.1 and 36.1, it's using 16Kbytes form address - * 0x20000000. We'll try to play safe and avoid the first 32KB of RAM. - * - * This is used to: - * - Flash faster. 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. - * - Run the bench software from the RAM. */ - -MEMORY { - RAM_BUFFER (rw) : ORIGIN = 0x20000000 + 32K, LENGTH = 200K - 32K -} - -/* The stack is quite large: we put it equal to Epsilon's. - * Indeed, when building the flasher, we're making the USB::Calculator object - * live on the stack, and it's quite large (about 4K just for this single - * object). Using a stack too small would 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) : { - _isr_start = .; /* Used in ion/src/device/bench/command/reset.cpp */ - 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 -} diff --git a/ion/src/device/shared/ram20008000.ld b/ion/src/device/shared/ram20008000.ld deleted file mode 100644 index e196513ba..000000000 --- a/ion/src/device/shared/ram20008000.ld +++ /dev/null @@ -1,80 +0,0 @@ -/* Create a firmware that runs from RAM. - * Caution: ST's bootloader uses some RAM, so we want to stay off of that memory - * region. Per AN2606, sections 31.1 and 36.1, it's using 16Kbytes form address - * 0x20000000. We'll try to play safe and avoid the first 32KB of RAM. - * - * This is used to: - * - Flash faster. 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. - * - Run the bench software from the RAM. */ - -MEMORY { - RAM_BUFFER (rw) : ORIGIN = 0x20000000 + 32K, LENGTH = 256K - 32K -} - -/* The stack is quite large: we put it equal to Epsilon's. - * Indeed, when building the flasher, we're making the USB::Calculator object - * live on the stack, and it's quite large (about 4K just for this single - * object). Using a stack too small would 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 -} diff --git a/ion/src/device/shared/ram20032000.ld b/ion/src/device/shared/ram20032000.ld deleted file mode 100644 index 397b1221e..000000000 --- a/ion/src/device/shared/ram20032000.ld +++ /dev/null @@ -1,80 +0,0 @@ -/* Create a firmware that runs from RAM. - * Caution: ST's bootloader uses some RAM, so we want to stay off of that memory - * region. Per AN2606, sections 31.1 and 36.1, it's using 16Kbytes form address - * 0x20000000. We'll try to play safe and avoid the first 32KB of RAM. - * - * This is used to: - * - Flash faster. 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. - * - Run the bench software from the RAM. */ - -MEMORY { - RAM_BUFFER (rw) : ORIGIN = 0x20000000 + 200K, LENGTH = 256K - 200K -} - -/* The stack is quite large: we put it equal to Epsilon's. - * Indeed, when building the flasher, we're making the USB::Calculator object - * live on the stack, and it's quite large (about 4K just for this single - * object). Using a stack too small would 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 -} diff --git a/ion/src/device/shared/ramConfig20008000-20032000.ld b/ion/src/device/shared/ramConfig20008000-20032000.ld new file mode 100644 index 000000000..e16a1e534 --- /dev/null +++ b/ion/src/device/shared/ramConfig20008000-20032000.ld @@ -0,0 +1,6 @@ +/* Config file for a ram binary linked at address 0x20008000, up to 0x20032000. + * This is used to build benchRAM. In what is left of the device's RAM, we might + * put a flasher. */ + +CONFIG_OFFSET = 0x0; +CONFIG_LENGTH = 200K - 32K; diff --git a/ion/src/device/shared/ramConfig20032000.ld b/ion/src/device/shared/ramConfig20032000.ld new file mode 100644 index 000000000..f5b922cbb --- /dev/null +++ b/ion/src/device/shared/ramConfig20032000.ld @@ -0,0 +1,6 @@ +/* Config file for a ram binary linked at address 0x20032000, taking all the RAM + * space available. It is used to build flasher that can write both in flash and + * in RAM up to the address 0x20032000. */ + +CONFIG_OFFSET = 200K - 32K; +CONFIG_LENGTH = 256K - 200K; diff --git a/scripts/targets.device.mak b/scripts/targets.device.mak index 7ece1b807..2782afea8 100644 --- a/scripts/targets.device.mak +++ b/scripts/targets.device.mak @@ -54,7 +54,8 @@ openocd: # fully filled ifeq ($(EPSILON_USB_DFU_XIP)$(EPSILON_DEVICE_BENCH),10) $(BUILD_DIR)/ion/src/$(PLATFORM)/shared/usb/flasher.o: SFLAGS += $(ION_DEVICE_SFLAGS) -$(BUILD_DIR)/flasher.$(EXE): LDSCRIPT = ion/src/$(PLATFORM)/shared/ram20032000.ld +$(BUILD_DIR)/flasher.$(EXE): LDSCRIPT = ion/src/$(PLATFORM)/shared/ram.ld +$(BUILD_DIR)/flasher.$(EXE): LDFLAGS += -Wl,ion/src/$(PLATFORM)/shared/ramConfig20032000.ld $(BUILD_DIR)/flasher.$(EXE): $(objs) $(BUILD_DIR)/ion/src/$(PLATFORM)/shared/usb/flasher.o else $(BUILD_DIR)/flasher.$(EXE): @@ -63,7 +64,8 @@ endif #TODO Do not build all apps... Put elsewhere? ifeq ($(EPSILON_USB_DFU_XIP)$(EPSILON_DEVICE_BENCH),11) -$(BUILD_DIR)/benchRAM.$(EXE): LDSCRIPT = ion/src/$(PLATFORM)/shared/ram20008000-20032000.ld +$(BUILD_DIR)/benchRAM.$(EXE): LDSCRIPT = ion/src/$(PLATFORM)/shared/ram.ld +$(BUILD_DIR)/benchRAM.$(EXE): LDFLAGS += -Wl,ion/src/$(PLATFORM)/shared/ramConfig20008000-20032000.ld $(BUILD_DIR)/benchRAM.$(EXE): $(objs) $(call object_for,$(bench_src)) else $(BUILD_DIR)/benchRAM.$(EXE):