/* TREZORv1 firmware linker script */ ENTRY(reset_handler) MEMORY { FLASH (rx) : ORIGIN = 0x08010000, LENGTH = 1024K - 64K SRAM (wal) : ORIGIN = 0x20000000, LENGTH = 128K } main_stack_base = ORIGIN(SRAM) + SIZEOF(.stack); /* 8-byte aligned full descending stack */ _sstack = ORIGIN(SRAM); _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 */ /* we have no CCMRAM, so erase the first word of SRAM as hack */ ccmram_start = ORIGIN(SRAM); ccmram_end = ORIGIN(SRAM) + 4; /* 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) + SIZEOF(.exidx); _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(*(.header)); } >FLASH AT>FLASH .flash : ALIGN(512) { KEEP(*(.vector_table)); . = ALIGN(4); *(.text*); . = ALIGN(4); *(.rodata*); . = ALIGN(512); } >FLASH AT>FLASH /* exception handling info generated by llvm which should consist of 8 bytes of "cantunwind" */ .exidx : ALIGN(4) { *(.ARM.exidx*); . = ALIGN(4); } >FLASH AT>FLASH .stack : ALIGN(8) { . = 16K; /* Exactly 16K allocated for stack. Overflow causes MemManage fault (when using MPU). */ } >SRAM .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 - 8); /* this explicitly sets the end of the heap, T1 bootloader had 8 bytes reserved at end */ } >SRAM }