diff --git a/Makefile b/Makefile index 25ef6aba..98a55739 100644 --- a/Makefile +++ b/Makefile @@ -75,7 +75,6 @@ build_bootloader: ## build bootloader build_firmware: res build_cross ## build firmware with frozen modules $(SCONS) CFLAGS="$(CFLAGS)" build/firmware/firmware.bin - $(SCONS) CFLAGS="$(CFLAGS)" build/firmware/firmware0.bin build_unix: ## build unix port $(SCONS) build/unix/micropython $(UNIX_PORT_OPTS) @@ -118,9 +117,6 @@ flash_bootloader: $(BOOTLOADER_BUILD_DIR)/bootloader.bin ## flash bootloader usi flash_firmware: $(FIRMWARE_BUILD_DIR)/firmware.bin ## flash firmware using OpenOCD $(OPENOCD) -c "init; reset halt; flash write_image erase $< 0x08020000; exit" -flash_firmware0: $(FIRMWARE_BUILD_DIR)/firmware0.bin ## flash firmware0 using OpenOCD - $(OPENOCD) -c "init; reset halt; flash write_image erase $< 0x08000000; exit" - flash_combine: $(FIRMWARE_BUILD_DIR)/combined.bin ## flash combined using OpenOCD $(OPENOCD) -c "init; reset halt; flash write_image erase $< 0x08000000; exit" @@ -166,7 +162,6 @@ sizecheck: ## check sizes of binary files test 32768 -ge $(shell stat -c%s $(BOARDLOADER_BUILD_DIR)/boardloader.bin) test 65536 -ge $(shell stat -c%s $(BOOTLOADER_BUILD_DIR)/bootloader.bin) test 917504 -ge $(shell stat -c%s $(FIRMWARE_BUILD_DIR)/firmware.bin) - test 1048576 -ge $(shell stat -c%s $(FIRMWARE_BUILD_DIR)/firmware0.bin) combine: ## combine boardloader + bootloader + firmware into one combined image ./tools/combine_firmware \ diff --git a/SConscript.firmware b/SConscript.firmware index ee6bc036..126eb6f0 100644 --- a/SConscript.firmware +++ b/SConscript.firmware @@ -328,7 +328,6 @@ env.Replace( CCFLAGS_QSTR='-DNO_QSTR -DN_X64 -DN_X86 -DN_THUMB', CCFLAGS_OPT='-O3', LINKFLAGS='-nostdlib -T embed/firmware/memory.ld --gc-sections', - LINKFLAGS0='-nostdlib -T embed/firmware/memory0.ld --gc-sections', CPPPATH=[ '.', 'embed/firmware', @@ -425,13 +424,6 @@ program_elf = env.Command( '$LINK -o $TARGET $LINKFLAGS $SOURCES `$CC $CFLAGS $CCFLAGS $_CCCOMCOM -print-libgcc-file-name`', ) -program0_elf = env.Command( - target='firmware0.elf', - source=obj_program, - action= - '$LINK -o $TARGET $LINKFLAGS0 $SOURCES `$CC $CFLAGS $CCFLAGS $_CCCOMCOM -print-libgcc-file-name`', -) - program_bin = env.Command( target='firmware.bin', source=program_elf, @@ -439,10 +431,3 @@ program_bin = env.Command( '$OBJCOPY -O binary -j .header -j .flash -j .data $SOURCE $TARGET', '$BINCTL $TARGET -s 1:2 4747474747474747474747474747474747474747474747474747474747474747:4848484848484848484848484848484848484848484848484848484848484848', ], ) - -program0_bin = env.Command( - target='firmware0.bin', - source=program0_elf, - action=[ - '$OBJCOPY -O binary -j .flash -j .data $SOURCE $TARGET', - ], ) diff --git a/embed/firmware/memory0.ld b/embed/firmware/memory0.ld deleted file mode 100644 index 0f9e60ab..00000000 --- a/embed/firmware/memory0.ld +++ /dev/null @@ -1,68 +0,0 @@ -/* TREZORv2 firmware0 linker script */ - -ENTRY(reset_handler) - -MEMORY { - FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K - CCMRAM (wal) : ORIGIN = 0x10000000, LENGTH = 64K - SRAM (wal) : ORIGIN = 0x20000000, LENGTH = 128K -} - -main_stack_base = ORIGIN(SRAM) + LENGTH(SRAM); /* 8-byte aligned full descending stack */ -_estack = main_stack_base; - -/* used by the startup code to populate variables used by the C code */ -data_lma = LOADADDR(.data); -data_vma = ADDR(.data); -data_size = SIZEOF(.data); - -/* used by the startup code to wipe memory */ -ccmram_start = ORIGIN(CCMRAM); -ccmram_end = ORIGIN(CCMRAM) + LENGTH(CCMRAM); - -/* used by the startup code to wipe memory */ -sram_start = ORIGIN(SRAM); -sram_end = ORIGIN(SRAM) + LENGTH(SRAM); -_ram_start = sram_start; -_ram_end = sram_end; - -_codelen = SIZEOF(.flash) + SIZEOF(.data); -_flash_start = ORIGIN(FLASH); -_flash_end = ORIGIN(FLASH) + LENGTH(FLASH); -_heap_start = ADDR(.heap); -_heap_end = ADDR(.heap) + SIZEOF(.heap); - -SECTIONS { - .header : ALIGN(4) { - KEEP(*(.vendorheader)) - KEEP(*(.header)); - } >FLASH AT>FLASH - - .flash : ALIGN(512) { - KEEP(*(.vector_table)); - . = ALIGN(4); - *(.text*); - . = ALIGN(4); - *(.rodata*); - . = ALIGN(512); - } >FLASH AT>FLASH - - .data : ALIGN(4) { - *(.data*); - . = ALIGN(512); - } >SRAM AT>FLASH - - .bss : ALIGN(4) { - *(.bss*); - . = ALIGN(4); - } >SRAM - - .heap : ALIGN(4) { - . = 37K; /* this acts as a build time assertion that at least this much memory is available for heap use */ - . = ABSOLUTE(sram_end - 16K); /* this explicitly sets the end of the heap effectively giving the stack at most 16K */ - } >SRAM - - .stack : ALIGN(8) { - . = 4K; /* this acts as a build time assertion that at least this much memory is available for stack use */ - } >SRAM -}