From d8115a79929ea5aa469584dd1c4d9b4658e95583 Mon Sep 17 00:00:00 2001 From: Ondrej Mikle Date: Mon, 11 May 2020 15:43:43 +0200 Subject: [PATCH] core: firmware header for T1 port --- core/embed/firmware/header.S | 33 +++++++++++++++++++++++++++++++++ core/embed/firmware/memory_1.ld | 4 ++++ 2 files changed, 37 insertions(+) diff --git a/core/embed/firmware/header.S b/core/embed/firmware/header.S index 18a2bdaa4f..4a57caf065 100644 --- a/core/embed/firmware/header.S +++ b/core/embed/firmware/header.S @@ -7,6 +7,9 @@ .type g_header, %object .size g_header, .-g_header +#if TREZOR_MODEL != 1 + +// model T header g_header: .byte 'T','R','Z','F' // magic .word g_header_end - g_header // hdrlen @@ -26,3 +29,33 @@ g_header: .byte 0 // sigmask . = . + 64 // sig g_header_end: + +#else + +// model 1 header +g_header: + .byte 'T','R','Z','F' // magic + .word reset_handler // reset handler, replace later with : .word g_header_end - g_header // hdrlen + .word 0 // expiry + .word _codelen // codelen + .byte VERSION_MAJOR // vmajor + .byte VERSION_MINOR // vminor + .byte VERSION_PATCH // vpatch + .byte 0 // vbuild + .byte FIX_VERSION_MAJOR // fix_vmajor + .byte FIX_VERSION_MINOR // fix_vminor + .byte FIX_VERSION_PATCH // fix_vpatch + .byte 0 // fix_vbuild + . = . + 8 // reserved + . = . + 512 // hash1 ... hash16 + . = . + 64 // sig1 + . = . + 64 // sig2 + . = . + 64 // sig3 + .byte 0 // sigindex1 + .byte 0 // sigindex2 + .byte 0 // sigindex3 + . = . + 220 // reserved + . = . + 65 // reserved +g_header_end: + +#endif diff --git a/core/embed/firmware/memory_1.ld b/core/embed/firmware/memory_1.ld index 89de37e99b..0f46913580 100644 --- a/core/embed/firmware/memory_1.ld +++ b/core/embed/firmware/memory_1.ld @@ -33,6 +33,10 @@ _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);