1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 06:18:07 +00:00

Merge pull request #995 from trezor/omikle/t1-core-port

core port to Trezor One
This commit is contained in:
Pavol Rusnak 2020-05-14 16:48:18 +02:00 committed by GitHub
commit 6704ed86a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 2 deletions

View File

@ -626,7 +626,8 @@ if env.get('TREZOR_MODEL') == 'T':
]
else:
action_bin=[
'$OBJCOPY -O binary -j .flash -j .data $SOURCE $TARGET',
'$OBJCOPY -O binary -j .header -j .flash -j .data $SOURCE $TARGET',
'../legacy/bootloader/firmware_sign.py -f $TARGET',
]
program_bin = env.Command(

View File

@ -7,6 +7,9 @@
.type g_header, %object
.size g_header, .-g_header
// Firmware header for both Trezor One and Trezor T.
// Trezor One must have bootloader version >= 1.8.0 (before that version the hdrlen used to be reset vector)
g_header:
.byte 'T','R','Z','F' // magic
.word g_header_end - g_header // hdrlen
@ -22,7 +25,23 @@ g_header:
.byte FIX_VERSION_BUILD // fix_vbuild
. = . + 8 // reserved
. = . + 512 // hash1 ... hash16
#if TREZOR_MODEL != 1
// model T header specifics
. = . + 415 // reserved
.byte 0 // sigmask
. = . + 64 // sig
#else
// model 1 header specifics
. = . + 64 // sig1
. = . + 64 // sig2
. = . + 64 // sig3
.byte 0 // sigindex1
.byte 0 // sigindex2
.byte 0 // sigindex3
. = . + 220 // reserved
. = . + 65 // reserved
#endif
g_header_end:

View File

@ -26,13 +26,17 @@ sram_end = ORIGIN(SRAM) + LENGTH(SRAM);
_ram_start = sram_start;
_ram_end = sram_end;
_codelen = LENGTH(FLASH);
_codelen = SIZEOF(.flash) + SIZEOF(.data) + SIZEOF(.ARM.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);

View File

@ -5,6 +5,14 @@
.global reset_handler
.type reset_handler, STT_FUNC
reset_handler:
#if TREZOR_MODEL == 1
ldr r0, =_estack - 8 // r0 = stack pointer, T1 bootloader had 8 bytes reserved at end
msr msp, r0 // set stack pointer
dsb
isb
#endif
// setup environment for subsequent stage of code
ldr r0, =ccmram_start // r0 - point to beginning of CCMRAM
ldr r1, =ccmram_end // r1 - point to byte after the end of CCMRAM