trezorhal: update linker scripts

This commit is contained in:
Pavol Rusnak 2017-04-01 12:48:15 +02:00
parent 435e96e1b3
commit a440f3d322
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
4 changed files with 16 additions and 6 deletions

View File

@ -405,7 +405,7 @@ $(BUILD)/$(TARGET).elf: $(OBJ)
$(Q)$(SIZE) $@ $(Q)$(SIZE) $@
$(BUILD)/$(TARGET).bin: $(BUILD)/$(TARGET).elf $(BUILD)/$(TARGET).bin: $(BUILD)/$(TARGET).elf
$(Q)$(OBJCOPY) -O binary -j .flash -j .data $^ $(BUILD)/$(TARGET).bin $(Q)$(OBJCOPY) -O binary -j .header -j .flash -j .data $^ $(BUILD)/$(TARGET).bin
$(BUILD)/%.o: %.S $(BUILD)/%.o: %.S
$(ECHO) "CC $<" $(ECHO) "CC $<"

View File

@ -139,7 +139,7 @@ $(BUILD)/$(TARGET).elf: $(OBJ)
$(Q)$(SIZE) $@ $(Q)$(SIZE) $@
$(BUILD)/$(TARGET).bin: $(BUILD)/$(TARGET).elf $(BUILD)/$(TARGET).bin: $(BUILD)/$(TARGET).elf
$(Q)$(OBJCOPY) -O binary -j .flash -j .data $^ $(BUILD)/$(TARGET).bin $(Q)$(OBJCOPY) -O binary -j .header -j .flash -j .data $^ $(BUILD)/$(TARGET).bin
$(BUILD)/%.o: %.S $(BUILD)/%.o: %.S
$(ECHO) "CC $<" $(ECHO) "CC $<"

View File

@ -25,11 +25,16 @@ ENTRY(Reset_Handler)
/* define output sections */ /* define output sections */
SECTIONS SECTIONS
{ {
/* Firmware Header */
.header :
{
KEEP(*(.header))
} > FLASH
/* The startup code goes first into FLASH */ /* The startup code goes first into FLASH */
.flash : .flash :
{ {
. = ALIGN(4); . = ALIGN(4);
KEEP(*(.header)) /* Firmware Header */
KEEP(*(.isr_vector)) /* Startup code */ KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4); . = ALIGN(4);
*(.text*) /* .text* sections (code) */ *(.text*) /* .text* sections (code) */
@ -87,7 +92,7 @@ SECTIONS
} }
/* RAM extents for the garbage collector */ /* RAM extents for the garbage collector */
_codelen = SIZEOF(.flash) + SIZEOF(.data) - 512; _codelen = SIZEOF(.flash) + SIZEOF(.data);
_ram_start = ORIGIN(RAM); _ram_start = ORIGIN(RAM);
_ram_end = ORIGIN(RAM) + LENGTH(RAM); _ram_end = ORIGIN(RAM) + LENGTH(RAM);
_heap_start = _ebss; /* heap starts just after statically allocated memory */ _heap_start = _ebss; /* heap starts just after statically allocated memory */

View File

@ -25,11 +25,16 @@ ENTRY(Reset_Handler)
/* define output sections */ /* define output sections */
SECTIONS SECTIONS
{ {
/* Firmware Header */
.header :
{
KEEP(*(.header))
} > FLASH
/* The startup code goes first into FLASH */ /* The startup code goes first into FLASH */
.flash : .flash :
{ {
. = ALIGN(4); . = ALIGN(4);
KEEP(*(.header)) /* Firmware Header */
KEEP(*(.isr_vector)) /* Startup code */ KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4); . = ALIGN(4);
*(.text*) /* .text* sections (code) */ *(.text*) /* .text* sections (code) */
@ -87,7 +92,7 @@ SECTIONS
} }
/* RAM extents for the garbage collector */ /* RAM extents for the garbage collector */
_codelen = SIZEOF(.flash) + SIZEOF(.data) - 512; _codelen = SIZEOF(.flash) + SIZEOF(.data);
_ram_start = ORIGIN(RAM); _ram_start = ORIGIN(RAM);
_ram_end = ORIGIN(RAM) + LENGTH(RAM); _ram_end = ORIGIN(RAM) + LENGTH(RAM);
_heap_start = _ebss; /* heap starts just after statically allocated memory */ _heap_start = _ebss; /* heap starts just after statically allocated memory */