mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-13 08:50:56 +00:00
embed/firmware: update linker to use firmware_extra section
This commit is contained in:
parent
86461d0d6b
commit
23b019d592
6
Makefile
6
Makefile
@ -33,7 +33,9 @@ PRODTEST_START = 0x08040000
|
||||
|
||||
BOARDLOADER_MAXSIZE = 49152
|
||||
BOOTLOADER_MAXSIZE = 131072
|
||||
FIRMWARE_MAXSIZE = 786432
|
||||
FIRMWARE_P1_MAXSIZE = 786432
|
||||
FIRMWARE_P2_MAXSIZE = 917504
|
||||
FIRMWARE_MAXSIZE = 1703936
|
||||
|
||||
GITREV=$(shell git describe --always --dirty)
|
||||
CFLAGS += -DGITREV=$(GITREV)
|
||||
@ -187,6 +189,8 @@ bloaty: ## run bloaty size profiler
|
||||
sizecheck: ## check sizes of binary files
|
||||
test $(BOARDLOADER_MAXSIZE) -ge $(shell wc -c < $(BOARDLOADER_BUILD_DIR)/boardloader.bin)
|
||||
test $(BOOTLOADER_MAXSIZE) -ge $(shell wc -c < $(BOOTLOADER_BUILD_DIR)/bootloader.bin)
|
||||
test $(FIRMWARE_P1_MAXSIZE) -ge $(shell wc -c < $(FIRMWARE_BUILD_DIR)/firmware.bin.p1)
|
||||
test $(FIRMWARE_P2_MAXSIZE) -ge $(shell wc -c < $(FIRMWARE_BUILD_DIR)/firmware.bin.p2)
|
||||
test $(FIRMWARE_MAXSIZE) -ge $(shell wc -c < $(FIRMWARE_BUILD_DIR)/firmware.bin)
|
||||
|
||||
combine: ## combine boardloader + bootloader + prodtest into one combined image
|
||||
|
@ -298,6 +298,7 @@ env = Environment(ENV=os.environ, CFLAGS='%s -DPRODUCTION=%s -DPYOPT=%s' % (ARGU
|
||||
env.Tool('micropython')
|
||||
|
||||
env.Replace(
|
||||
CAT='cat',
|
||||
SED='sed',
|
||||
AS='arm-none-eabi-as',
|
||||
AR='arm-none-eabi-ar',
|
||||
@ -424,7 +425,9 @@ program_bin = env.Command(
|
||||
target='firmware.bin',
|
||||
source=program_elf,
|
||||
action=[
|
||||
'$OBJCOPY -O binary -j .vendorheader -j .header -j .flash -j .data $SOURCE $TARGET',
|
||||
'$OBJCOPY -O binary -j .vendorheader -j .header -j .flash -j .data --pad-to 0x08100000 $SOURCE ${TARGET}.p1',
|
||||
'$OBJCOPY -O binary -j .flash2 $SOURCE ${TARGET}.p2',
|
||||
'$CAT ${TARGET}.p1 ${TARGET}.p2 > $TARGET',
|
||||
'$BINCTL $TARGET -h',
|
||||
'$BINCTL $TARGET -s 1:2 `$KEYCTL sign firmware $TARGET 4747474747474747474747474747474747474747474747474747474747474747 4848484848484848484848484848484848484848484848484848484848484848`' if ARGUMENTS.get('PRODUCTION', '0') == '0' else '',
|
||||
], )
|
||||
|
@ -4,6 +4,7 @@ ENTRY(reset_handler)
|
||||
|
||||
MEMORY {
|
||||
FLASH (rx) : ORIGIN = 0x08040000, LENGTH = 768K
|
||||
FLASH2 (r) : ORIGIN = 0x08120000, LENGTH = 896K
|
||||
CCMRAM (wal) : ORIGIN = 0x10000000, LENGTH = 64K
|
||||
SRAM (wal) : ORIGIN = 0x20000000, LENGTH = 192K
|
||||
}
|
||||
@ -26,7 +27,7 @@ sram_end = ORIGIN(SRAM) + LENGTH(SRAM);
|
||||
_ram_start = sram_start;
|
||||
_ram_end = sram_end;
|
||||
|
||||
_codelen = SIZEOF(.flash) + SIZEOF(.data);
|
||||
_codelen = LENGTH(FLASH) - SIZEOF(.vendorheader) - SIZEOF(.header) + SIZEOF(.flash2);
|
||||
_flash_start = ORIGIN(FLASH);
|
||||
_flash_end = ORIGIN(FLASH) + LENGTH(FLASH);
|
||||
_heap_start = ADDR(.heap);
|
||||
@ -41,6 +42,11 @@ SECTIONS {
|
||||
KEEP(*(.header));
|
||||
} >FLASH AT>FLASH
|
||||
|
||||
.flash2 : ALIGN(512) {
|
||||
build/firmware/frozen_mpy.o(.rodata*);
|
||||
. = ALIGN(512);
|
||||
} >FLASH2 AT>FLASH2
|
||||
|
||||
.flash : ALIGN(512) {
|
||||
KEEP(*(.vector_table));
|
||||
. = ALIGN(4);
|
||||
|
Loading…
Reference in New Issue
Block a user