mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 15:38:11 +00:00
chore(core): bootloader_ci - decouple file links from original bootloader
This commit is contained in:
parent
e4c406822c
commit
22d01b6ff4
@ -21,6 +21,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
### Older changelog:
|
||||
|
||||
Version 1.0.1 [Jan 2021]
|
||||
* decouple files from original bootloader as it will be reworked and symlink
|
||||
magic will break
|
||||
* version in version.h must be kept to match the original bootloader,
|
||||
otherwise firmware update will fail (bootloader will look too old)
|
||||
|
||||
Version 1.0.0 [Aug 2020]
|
||||
* initial version
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
../bootloader/bootui.c
|
374
core/embed/bootloader_ci/bootui.c
Normal file
374
core/embed/bootloader_ci/bootui.c
Normal file
@ -0,0 +1,374 @@
|
||||
/*
|
||||
* This file is part of the Trezor project, https://trezor.io/
|
||||
*
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "display.h"
|
||||
#include "mini_printf.h"
|
||||
|
||||
#include "bootui.h"
|
||||
#include "touch.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "icon_cancel.h"
|
||||
#include "icon_confirm.h"
|
||||
#include "icon_done.h"
|
||||
#include "icon_fail.h"
|
||||
#include "icon_info.h"
|
||||
#include "icon_install.h"
|
||||
#include "icon_wipe.h"
|
||||
|
||||
#include "icon_logo.h"
|
||||
#include "icon_safeplace.h"
|
||||
#include "icon_welcome.h"
|
||||
|
||||
#define BACKLIGHT_NORMAL 150
|
||||
|
||||
#define COLOR_BL_FAIL RGB16(0xFF, 0x00, 0x00) // red
|
||||
#define COLOR_BL_DONE RGB16(0x00, 0xAE, 0x0B) // green
|
||||
#define COLOR_BL_PROCESS RGB16(0x4A, 0x90, 0xE2) // blue
|
||||
#define COLOR_BL_GRAY RGB16(0x99, 0x99, 0x99) // gray
|
||||
|
||||
// common shared functions
|
||||
|
||||
static void ui_confirm_cancel_buttons(void) {
|
||||
display_bar_radius(9, 184, 108, 50, COLOR_BL_FAIL, COLOR_WHITE, 4);
|
||||
display_icon(9 + (108 - 16) / 2, 184 + (50 - 16) / 2, 16, 16,
|
||||
toi_icon_cancel + 12, sizeof(toi_icon_cancel) - 12, COLOR_WHITE,
|
||||
COLOR_BL_FAIL);
|
||||
display_bar_radius(123, 184, 108, 50, COLOR_BL_DONE, COLOR_WHITE, 4);
|
||||
display_icon(123 + (108 - 19) / 2, 184 + (50 - 16) / 2, 20, 16,
|
||||
toi_icon_confirm + 12, sizeof(toi_icon_confirm) - 12,
|
||||
COLOR_WHITE, COLOR_BL_DONE);
|
||||
}
|
||||
|
||||
static const char *format_ver(const char *format, uint32_t version) {
|
||||
static char ver_str[64];
|
||||
mini_snprintf(ver_str, sizeof(ver_str), format, (int)(version & 0xFF),
|
||||
(int)((version >> 8) & 0xFF), (int)((version >> 16) & 0xFF)
|
||||
// ignore build field (int)((version >> 24) & 0xFF)
|
||||
);
|
||||
return ver_str;
|
||||
}
|
||||
|
||||
// boot UI
|
||||
|
||||
static uint16_t boot_background;
|
||||
|
||||
void ui_screen_boot(const vendor_header *const vhdr,
|
||||
const image_header *const hdr) {
|
||||
const int show_string = ((vhdr->vtrust & VTRUST_STRING) == 0);
|
||||
if ((vhdr->vtrust & VTRUST_RED) == 0) {
|
||||
boot_background = COLOR_BL_FAIL;
|
||||
} else {
|
||||
boot_background = COLOR_BLACK;
|
||||
}
|
||||
|
||||
const uint8_t *vimg = vhdr->vimg;
|
||||
const uint32_t fw_version = hdr->version;
|
||||
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, boot_background);
|
||||
|
||||
int image_top = show_string ? 30 : (DISPLAY_RESY - 120) / 2;
|
||||
|
||||
// check whether vendor image is 120x120
|
||||
if (memcmp(vimg, "TOIf\x78\x00\x78\x00", 4) == 0) {
|
||||
uint32_t datalen = *(uint32_t *)(vimg + 8);
|
||||
display_image((DISPLAY_RESX - 120) / 2, image_top, 120, 120, vimg + 12,
|
||||
datalen);
|
||||
}
|
||||
|
||||
if (show_string) {
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 5 - 50, vhdr->vstr,
|
||||
vhdr->vstr_len, FONT_NORMAL, COLOR_WHITE,
|
||||
boot_background);
|
||||
const char *ver_str = format_ver("%d.%d.%d", fw_version);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 5 - 25, ver_str, -1,
|
||||
FONT_NORMAL, COLOR_WHITE, boot_background);
|
||||
}
|
||||
}
|
||||
|
||||
void ui_screen_boot_wait(int wait_seconds) {
|
||||
char wait_str[16];
|
||||
mini_snprintf(wait_str, sizeof(wait_str), "starting in %d s", wait_seconds);
|
||||
display_bar(0, DISPLAY_RESY - 5 - 20, DISPLAY_RESX, 5 + 20, boot_background);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 5, wait_str, -1,
|
||||
FONT_NORMAL, COLOR_WHITE, boot_background);
|
||||
}
|
||||
|
||||
void ui_screen_boot_click(void) {
|
||||
display_bar(0, DISPLAY_RESY - 5 - 20, DISPLAY_RESX, 5 + 20, boot_background);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 5,
|
||||
"click to continue ...", -1, FONT_NORMAL, COLOR_WHITE,
|
||||
boot_background);
|
||||
}
|
||||
|
||||
// welcome UI
|
||||
|
||||
void ui_screen_first(void) {
|
||||
display_icon(0, 0, 240, 240, toi_icon_logo + 12, sizeof(toi_icon_logo) - 12,
|
||||
COLOR_BLACK, COLOR_WHITE);
|
||||
}
|
||||
|
||||
void ui_screen_second(void) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_icon((DISPLAY_RESX - 200) / 2, (DISPLAY_RESY - 60) / 2, 200, 60,
|
||||
toi_icon_safeplace + 12, sizeof(toi_icon_safeplace) - 12,
|
||||
COLOR_BLACK, COLOR_WHITE);
|
||||
}
|
||||
|
||||
void ui_screen_third(void) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_icon((DISPLAY_RESX - 180) / 2, (DISPLAY_RESY - 30) / 2 - 5, 180, 30,
|
||||
toi_icon_welcome + 12, sizeof(toi_icon_welcome) - 12,
|
||||
COLOR_BLACK, COLOR_WHITE);
|
||||
display_text_center(120, 220, "Go to trezor.io/start", -1, FONT_NORMAL,
|
||||
COLOR_BLACK, COLOR_WHITE);
|
||||
}
|
||||
|
||||
// info UI
|
||||
|
||||
static int display_vendor_string(const char *text, int textlen,
|
||||
uint16_t fgcolor) {
|
||||
int split = display_text_split(text, textlen, FONT_NORMAL, DISPLAY_RESX - 55);
|
||||
if (split >= textlen) {
|
||||
display_text(55, 95, text, textlen, FONT_NORMAL, fgcolor, COLOR_WHITE);
|
||||
return 120;
|
||||
} else {
|
||||
display_text(55, 95, text, split, FONT_NORMAL, fgcolor, COLOR_WHITE);
|
||||
if (text[split] == ' ') {
|
||||
split++;
|
||||
}
|
||||
display_text(55, 120, text + split, textlen - split, FONT_NORMAL, fgcolor,
|
||||
COLOR_WHITE);
|
||||
return 145;
|
||||
}
|
||||
}
|
||||
|
||||
void ui_screen_info(secbool buttons, const vendor_header *const vhdr,
|
||||
const image_header *const hdr) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
const char *ver_str = format_ver("Bootloader %d.%d.%d", VERSION_UINT32);
|
||||
display_text(16, 32, ver_str, -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
display_bar(16, 44, DISPLAY_RESX - 14 * 2, 1, COLOR_BLACK);
|
||||
display_icon(16, 54, 32, 32, toi_icon_info + 12, sizeof(toi_icon_info) - 12,
|
||||
COLOR_BL_GRAY, COLOR_WHITE);
|
||||
if (vhdr && hdr) {
|
||||
ver_str = format_ver("Firmware %d.%d.%d by", (hdr->version));
|
||||
display_text(55, 70, ver_str, -1, FONT_NORMAL, COLOR_BL_GRAY, COLOR_WHITE);
|
||||
display_vendor_string(vhdr->vstr, vhdr->vstr_len, COLOR_BL_GRAY);
|
||||
} else {
|
||||
display_text(55, 70, "No Firmware", -1, FONT_NORMAL, COLOR_BL_GRAY,
|
||||
COLOR_WHITE);
|
||||
}
|
||||
|
||||
if (sectrue == buttons) {
|
||||
display_text_center(120, 170, "Connect to host?", -1, FONT_NORMAL,
|
||||
COLOR_BLACK, COLOR_WHITE);
|
||||
ui_confirm_cancel_buttons();
|
||||
} else {
|
||||
display_text_center(120, 220, "Go to trezor.io/start", -1, FONT_NORMAL,
|
||||
COLOR_BLACK, COLOR_WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
void ui_screen_info_fingerprint(const image_header *const hdr) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_text(16, 32, "Firmware fingerprint", -1, FONT_NORMAL, COLOR_BLACK,
|
||||
COLOR_WHITE);
|
||||
display_bar(16, 44, DISPLAY_RESX - 14 * 2, 1, COLOR_BLACK);
|
||||
|
||||
static const char *hexdigits = "0123456789abcdef";
|
||||
char fingerprint_str[64];
|
||||
for (int i = 0; i < 32; i++) {
|
||||
fingerprint_str[i * 2] = hexdigits[(hdr->fingerprint[i] >> 4) & 0xF];
|
||||
fingerprint_str[i * 2 + 1] = hexdigits[hdr->fingerprint[i] & 0xF];
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
display_text_center(120, 70 + i * 25, fingerprint_str + i * 16, 16,
|
||||
FONT_MONO, COLOR_BLACK, COLOR_WHITE);
|
||||
}
|
||||
|
||||
display_bar_radius(9, 184, 222, 50, COLOR_BL_DONE, COLOR_WHITE, 4);
|
||||
display_icon(9 + (222 - 19) / 2, 184 + (50 - 16) / 2, 20, 16,
|
||||
toi_icon_confirm + 12, sizeof(toi_icon_confirm) - 12,
|
||||
COLOR_WHITE, COLOR_BL_DONE);
|
||||
}
|
||||
|
||||
// install UI
|
||||
|
||||
void ui_screen_install_confirm_upgrade(const vendor_header *const vhdr,
|
||||
const image_header *const hdr) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_text(16, 32, "Firmware update", -1, FONT_NORMAL, COLOR_BLACK,
|
||||
COLOR_WHITE);
|
||||
display_bar(16, 44, DISPLAY_RESX - 14 * 2, 1, COLOR_BLACK);
|
||||
display_icon(16, 54, 32, 32, toi_icon_info + 12, sizeof(toi_icon_info) - 12,
|
||||
COLOR_BLACK, COLOR_WHITE);
|
||||
display_text(55, 70, "Update firmware by", -1, FONT_NORMAL, COLOR_BLACK,
|
||||
COLOR_WHITE);
|
||||
int next_y = display_vendor_string(vhdr->vstr, vhdr->vstr_len, COLOR_BLACK);
|
||||
const char *ver_str = format_ver("to version %d.%d.%d?", hdr->version);
|
||||
display_text(55, next_y, ver_str, -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
ui_confirm_cancel_buttons();
|
||||
}
|
||||
|
||||
void ui_screen_install_confirm_newvendor_or_downgrade_wipe(
|
||||
const vendor_header *const vhdr, const image_header *const hdr,
|
||||
secbool downgrade_wipe) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_text(
|
||||
16, 32,
|
||||
(sectrue == downgrade_wipe) ? "Firmware downgrade" : "Vendor change", -1,
|
||||
FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
display_bar(16, 44, DISPLAY_RESX - 14 * 2, 1, COLOR_BLACK);
|
||||
display_icon(16, 54, 32, 32, toi_icon_info + 12, sizeof(toi_icon_info) - 12,
|
||||
COLOR_BLACK, COLOR_WHITE);
|
||||
display_text(55, 70, "Install firmware by", -1, FONT_NORMAL, COLOR_BLACK,
|
||||
COLOR_WHITE);
|
||||
int next_y = display_vendor_string(vhdr->vstr, vhdr->vstr_len, COLOR_BLACK);
|
||||
const char *ver_str = format_ver("(version %d.%d.%d)?", hdr->version);
|
||||
display_text(55, next_y, ver_str, -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
display_text_center(120, 170, "Seed will be erased!", -1, FONT_NORMAL,
|
||||
COLOR_BL_FAIL, COLOR_WHITE);
|
||||
ui_confirm_cancel_buttons();
|
||||
}
|
||||
|
||||
void ui_screen_install(void) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_loader(0, false, -20, COLOR_BL_PROCESS, COLOR_WHITE, toi_icon_install,
|
||||
sizeof(toi_icon_install), COLOR_BLACK);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24,
|
||||
"Installing firmware", -1, FONT_NORMAL, COLOR_BLACK,
|
||||
COLOR_WHITE);
|
||||
}
|
||||
|
||||
void ui_screen_install_progress_erase(int pos, int len) {
|
||||
display_loader(250 * pos / len, false, -20, COLOR_BL_PROCESS, COLOR_WHITE,
|
||||
toi_icon_install, sizeof(toi_icon_install), COLOR_BLACK);
|
||||
}
|
||||
|
||||
void ui_screen_install_progress_upload(int pos) {
|
||||
display_loader(pos, false, -20, COLOR_BL_PROCESS, COLOR_WHITE,
|
||||
toi_icon_install, sizeof(toi_icon_install), COLOR_BLACK);
|
||||
}
|
||||
|
||||
// wipe UI
|
||||
|
||||
void ui_screen_wipe_confirm(void) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_text(16, 32, "Wipe device", -1, FONT_NORMAL, COLOR_BLACK,
|
||||
COLOR_WHITE);
|
||||
display_bar(16, 44, DISPLAY_RESX - 14 * 2, 1, COLOR_BLACK);
|
||||
display_icon(16, 54, 32, 32, toi_icon_info + 12, sizeof(toi_icon_info) - 12,
|
||||
COLOR_BLACK, COLOR_WHITE);
|
||||
display_text(55, 70, "Do you want to", -1, FONT_NORMAL, COLOR_BLACK,
|
||||
COLOR_WHITE);
|
||||
display_text(55, 95, "wipe the device?", -1, FONT_NORMAL, COLOR_BLACK,
|
||||
COLOR_WHITE);
|
||||
|
||||
display_text_center(120, 170, "Seed will be erased!", -1, FONT_NORMAL,
|
||||
COLOR_BL_FAIL, COLOR_WHITE);
|
||||
ui_confirm_cancel_buttons();
|
||||
}
|
||||
|
||||
void ui_screen_wipe(void) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_loader(0, false, -20, COLOR_BL_PROCESS, COLOR_WHITE, toi_icon_wipe,
|
||||
sizeof(toi_icon_wipe), COLOR_BLACK);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24, "Wiping device", -1,
|
||||
FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
}
|
||||
|
||||
void ui_screen_wipe_progress(int pos, int len) {
|
||||
display_loader(1000 * pos / len, false, -20, COLOR_BL_PROCESS, COLOR_WHITE,
|
||||
toi_icon_wipe, sizeof(toi_icon_wipe), COLOR_BLACK);
|
||||
}
|
||||
|
||||
// done UI
|
||||
|
||||
void ui_screen_done(int restart_seconds, secbool full_redraw) {
|
||||
const char *str;
|
||||
char count_str[24];
|
||||
if (restart_seconds >= 1) {
|
||||
mini_snprintf(count_str, sizeof(count_str), "Done! Restarting in %d s",
|
||||
restart_seconds);
|
||||
str = count_str;
|
||||
} else {
|
||||
str = "Done! Unplug the device.";
|
||||
}
|
||||
if (sectrue == full_redraw) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
}
|
||||
display_loader(1000, false, -20, COLOR_BL_DONE, COLOR_WHITE, toi_icon_done,
|
||||
sizeof(toi_icon_done), COLOR_BLACK);
|
||||
if (secfalse == full_redraw) {
|
||||
display_bar(0, DISPLAY_RESY - 24 - 18, 240, 23, COLOR_WHITE);
|
||||
}
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24, str, -1, FONT_NORMAL,
|
||||
COLOR_BLACK, COLOR_WHITE);
|
||||
}
|
||||
|
||||
// error UI
|
||||
|
||||
void ui_screen_fail(void) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_loader(1000, false, -20, COLOR_BL_FAIL, COLOR_WHITE, toi_icon_fail,
|
||||
sizeof(toi_icon_fail), COLOR_BLACK);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24,
|
||||
"Failed! Please, reconnect.", -1, FONT_NORMAL,
|
||||
COLOR_BLACK, COLOR_WHITE);
|
||||
}
|
||||
|
||||
// general functions
|
||||
|
||||
void ui_fadein(void) { display_fade(0, BACKLIGHT_NORMAL, 1000); }
|
||||
|
||||
void ui_fadeout(void) {
|
||||
display_fade(BACKLIGHT_NORMAL, 0, 500);
|
||||
display_clear();
|
||||
}
|
||||
|
||||
int ui_user_input(int zones) {
|
||||
for (;;) {
|
||||
uint32_t evt = touch_click();
|
||||
uint16_t x = touch_unpack_x(evt);
|
||||
uint16_t y = touch_unpack_y(evt);
|
||||
// clicked on Cancel button
|
||||
if ((zones & INPUT_CANCEL) && x >= 9 && x < 9 + 108 && y > 184 &&
|
||||
y < 184 + 50) {
|
||||
return INPUT_CANCEL;
|
||||
}
|
||||
// clicked on Confirm button
|
||||
if ((zones & INPUT_CONFIRM) && x >= 123 && x < 123 + 108 && y > 184 &&
|
||||
y < 184 + 50) {
|
||||
return INPUT_CONFIRM;
|
||||
}
|
||||
// clicked on Long Confirm button
|
||||
if ((zones & INPUT_LONG_CONFIRM) && x >= 9 && x < 9 + 222 && y > 184 &&
|
||||
y < 184 + 50) {
|
||||
return INPUT_LONG_CONFIRM;
|
||||
}
|
||||
// clicked on Info icon
|
||||
if ((zones & INPUT_INFO) && x >= 16 && x < 16 + 32 && y > 54 &&
|
||||
y < 54 + 32) {
|
||||
return INPUT_INFO;
|
||||
}
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
../bootloader/bootui.h
|
68
core/embed/bootloader_ci/bootui.h
Normal file
68
core/embed/bootloader_ci/bootui.h
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* This file is part of the Trezor project, https://trezor.io/
|
||||
*
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __BOOTUI_H__
|
||||
#define __BOOTUI_H__
|
||||
|
||||
#include "image.h"
|
||||
#include "secbool.h"
|
||||
|
||||
void ui_screen_boot(const vendor_header* const vhdr,
|
||||
const image_header* const hdr);
|
||||
void ui_screen_boot_wait(int wait_seconds);
|
||||
void ui_screen_boot_click(void);
|
||||
|
||||
void ui_screen_first(void);
|
||||
void ui_screen_second(void);
|
||||
void ui_screen_third(void);
|
||||
|
||||
void ui_screen_info(secbool buttons, const vendor_header* const vhdr,
|
||||
const image_header* const hdr);
|
||||
void ui_screen_info_fingerprint(const image_header* const hdr);
|
||||
|
||||
void ui_screen_install_confirm_upgrade(const vendor_header* const vhdr,
|
||||
const image_header* const hdr);
|
||||
void ui_screen_install_confirm_newvendor_or_downgrade_wipe(
|
||||
const vendor_header* const vhdr, const image_header* const hdr,
|
||||
secbool downgrade_wipe);
|
||||
void ui_screen_install(void);
|
||||
void ui_screen_install_progress_erase(int pos, int len);
|
||||
void ui_screen_install_progress_upload(int pos);
|
||||
|
||||
void ui_screen_wipe_confirm(void);
|
||||
void ui_screen_wipe(void);
|
||||
void ui_screen_wipe_progress(int pos, int len);
|
||||
|
||||
void ui_screen_done(int restart_seconds, secbool full_redraw);
|
||||
|
||||
void ui_screen_fail(void);
|
||||
|
||||
void ui_fadein(void);
|
||||
void ui_fadeout(void);
|
||||
|
||||
// clang-format off
|
||||
#define INPUT_CANCEL 0x01 // Cancel button
|
||||
#define INPUT_CONFIRM 0x02 // Confirm button
|
||||
#define INPUT_LONG_CONFIRM 0x04 // Long Confirm button
|
||||
#define INPUT_INFO 0x08 // Info icon
|
||||
// clang-format on
|
||||
|
||||
int ui_user_input(int zones);
|
||||
|
||||
#endif
|
@ -1 +0,0 @@
|
||||
../bootloader/header.S
|
28
core/embed/bootloader_ci/header.S
Normal file
28
core/embed/bootloader_ci/header.S
Normal file
@ -0,0 +1,28 @@
|
||||
.syntax unified
|
||||
|
||||
#include "version.h"
|
||||
|
||||
.section .header, "a"
|
||||
|
||||
.type g_header, %object
|
||||
.size g_header, .-g_header
|
||||
|
||||
g_header:
|
||||
.byte 'T','R','Z','B' // magic
|
||||
.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 VERSION_BUILD // vbuild
|
||||
.byte FIX_VERSION_MAJOR // fix_vmajor
|
||||
.byte FIX_VERSION_MINOR // fix_vminor
|
||||
.byte FIX_VERSION_PATCH // fix_vpatch
|
||||
.byte FIX_VERSION_BUILD // fix_vbuild
|
||||
. = . + 8 // reserved
|
||||
. = . + 512 // hash1 ... hash16
|
||||
. = . + 415 // reserved
|
||||
.byte 0 // sigmask
|
||||
. = . + 64 // sig
|
||||
g_header_end:
|
@ -1 +0,0 @@
|
||||
../bootloader/icon_cancel.h
|
11
core/embed/bootloader_ci/icon_cancel.h
Normal file
11
core/embed/bootloader_ci/icon_cancel.h
Normal file
@ -0,0 +1,11 @@
|
||||
// clang-format off
|
||||
static const uint8_t toi_icon_cancel[] = {
|
||||
// magic
|
||||
'T', 'O', 'I', 'g',
|
||||
// width (16-bit), height (16-bit)
|
||||
0x10, 0x00, 0x10, 0x00,
|
||||
// compressed data length (32-bit)
|
||||
0x52, 0x00, 0x00, 0x00,
|
||||
// compressed data
|
||||
0x45, 0x4d, 0xc1, 0x09, 0x80, 0x30, 0x10, 0x4b, 0xeb, 0x02, 0x5d, 0x40, 0xb8, 0x01, 0x2c, 0xb8, 0xff, 0x47, 0x70, 0x81, 0xa2, 0x0b, 0x74, 0x10, 0x7b, 0xc4, 0x48, 0x5b, 0x0c, 0x1c, 0x09, 0xe1, 0x92, 0x60, 0x4b, 0x40, 0x38, 0x11, 0xeb, 0x0d, 0x64, 0xb7, 0x4c, 0xb7, 0x58, 0x79, 0x1f, 0xe4, 0xb5, 0x92, 0x8f, 0xce, 0xab, 0x74, 0x2c, 0x14, 0x9a, 0x21, 0x7f, 0xac, 0xdf, 0x20, 0xd7, 0xd3, 0xcf, 0xc3, 0x57, 0x56, 0x70, 0x9b, 0xb9, 0xd2, 0x7b, 0xda, 0xec, 0x5d, 0xfa, 0xce, 0x8e, 0xb1, 0xfb, 0x02,
|
||||
};
|
@ -1 +0,0 @@
|
||||
../bootloader/icon_confirm.h
|
11
core/embed/bootloader_ci/icon_confirm.h
Normal file
11
core/embed/bootloader_ci/icon_confirm.h
Normal file
@ -0,0 +1,11 @@
|
||||
// clang-format off
|
||||
static const uint8_t toi_icon_confirm[] = {
|
||||
// magic
|
||||
'T', 'O', 'I', 'g',
|
||||
// width (16-bit), height (16-bit)
|
||||
0x14, 0x00, 0x10, 0x00,
|
||||
// compressed data length (32-bit)
|
||||
0x69, 0x00, 0x00, 0x00,
|
||||
// compressed data
|
||||
0x63, 0x60, 0x80, 0x80, 0xa9, 0x50, 0x9a, 0x81, 0xf3, 0x7f, 0x00, 0x94, 0xd5, 0xff, 0xff, 0x2b, 0x84, 0xc1, 0xf1, 0xff, 0xff, 0x2f, 0x08, 0xab, 0xfe, 0xff, 0xff, 0x0d, 0x60, 0x06, 0xfb, 0xff, 0xff, 0xbf, 0x19, 0x18, 0x58, 0x26, 0x30, 0x30, 0xe4, 0x83, 0x85, 0xfc, 0x7f, 0x32, 0xb0, 0x01, 0x85, 0x04, 0x18, 0x58, 0xfe, 0xff, 0x6f, 0xcc, 0xfb, 0xff, 0x7f, 0x23, 0x03, 0x03, 0x17, 0x90, 0xff, 0x1e, 0x24, 0xc4, 0xc0, 0xb8, 0xff, 0x3f, 0x10, 0x6c, 0x02, 0xe9, 0x93, 0x06, 0x32, 0x7e, 0x2b, 0x80, 0x58, 0x20, 0xc1, 0x43, 0x10, 0x53, 0xb5, 0xff, 0xff, 0x31, 0x80, 0xb0, 0x98, 0xf6, 0x1f, 0x86, 0xb9, 0xc3, 0xca, 0x01, 0x4c, 0x01, 0x00,
|
||||
};
|
@ -1 +0,0 @@
|
||||
../bootloader/icon_done.h
|
11
core/embed/bootloader_ci/icon_done.h
Normal file
11
core/embed/bootloader_ci/icon_done.h
Normal file
@ -0,0 +1,11 @@
|
||||
// clang-format off
|
||||
static const uint8_t toi_icon_done[] = {
|
||||
// magic
|
||||
'T', 'O', 'I', 'g',
|
||||
// width (16-bit), height (16-bit)
|
||||
0x40, 0x00, 0x40, 0x00,
|
||||
// compressed data length (32-bit)
|
||||
0xce, 0x00, 0x00, 0x00,
|
||||
// compressed data
|
||||
0xed, 0x92, 0xdf, 0x11, 0xc1, 0x40, 0x10, 0x87, 0x77, 0x26, 0xe3, 0xef, 0x93, 0x12, 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x9d, 0x68, 0x18, 0x53, 0x9d, 0x8a, 0xe5, 0x09,
|
||||
};
|
@ -1 +0,0 @@
|
||||
../bootloader/icon_fail.h
|
11
core/embed/bootloader_ci/icon_fail.h
Normal file
11
core/embed/bootloader_ci/icon_fail.h
Normal file
@ -0,0 +1,11 @@
|
||||
// clang-format off
|
||||
static const uint8_t toi_icon_fail[] = {
|
||||
// magic
|
||||
'T', 'O', 'I', 'g',
|
||||
// width (16-bit), height (16-bit)
|
||||
0x40, 0x00, 0x40, 0x00,
|
||||
// compressed data length (32-bit)
|
||||
0x21, 0x01, 0x00, 0x00,
|
||||
// compressed data
|
||||
0xed, 0x52, 0xb9, 0x0d, 0xc2, 0x40, 0x10, 0x34, 0xf8, 0x89, 0xa9, 0x00, 0xd1, 0x00, 0xe8, 0x2a, 0x00, 0x17, 0x80, 0xc0, 0x1d, 0xe0, 0x0e, 0x28, 0x91, 0x84, 0x1c, 0x89, 0x12, 0x80, 0xdc, 0xc1, 0xd9, 0x24, 0xa0, 0x5b, 0xb0, 0x7d, 0xe7, 0xbd, 0x67, 0xe4, 0x98, 0x80, 0x89, 0x46, 0x3b, 0xde, 0xf5, 0xcd, 0xee, 0x44, 0xd1, 0x1f, 0x3f, 0x81, 0xe9, 0x99, 0xf9, 0x76, 0x11, 0xea, 0x73, 0x2a, 0x0d, 0xcd, 0xe8, 0x16, 0xb6, 0x57, 0x54, 0x1b, 0xbe, 0x27, 0x15, 0x0c, 0x58, 0x12, 0x51, 0xd1, 0xd3, 0xf4, 0x4b, 0xaf, 0x61, 0x3b, 0x51, 0xd3, 0xf3, 0xc3, 0x97, 0xfa, 0x03, 0xda, 0x76, 0xa2, 0xbc, 0xa5, 0x49, 0x47, 0xdd, 0x01, 0x93, 0xaa, 0x2b, 0x3e, 0x5b, 0x7e, 0xec, 0xa8, 0x9a, 0xd9, 0xfa, 0x8a, 0xc8, 0x0c, 0x48, 0x34, 0x75, 0x2c, 0x9c, 0x74, 0xb1, 0x6e, 0x1f, 0xdf, 0xe3, 0x65, 0xeb, 0x1b, 0x5d, 0xa4, 0x32, 0x33, 0x4c, 0xda, 0xba, 0x19, 0x4a, 0xb5, 0x69, 0xef, 0xdf, 0x3a, 0x60, 0xad, 0xab, 0xaa, 0xd2, 0xe4, 0xee, 0xfa, 0x8b, 0xc9, 0x83, 0xf0, 0x16, 0xb4, 0x73, 0xe5, 0x87, 0xbf, 0xdf, 0x78, 0xbc, 0x9d, 0x7d, 0x19, 0x9f, 0xc1, 0x80, 0x8a, 0x65, 0x25, 0x40, 0x40, 0x36, 0xac, 0x4b, 0x14, 0xa0, 0x64, 0x18, 0xa0, 0x72, 0x98, 0x30, 0xb3, 0x03, 0xdf, 0x7b, 0x60, 0xf1, 0x01, 0xe5, 0x8c, 0xff, 0x5f, 0x22, 0x7d, 0x3f, 0x6a, 0x8f, 0x4f, 0x14, 0x1e, 0x27, 0xe2, 0xd8, 0x68, 0x3c, 0xc7, 0xdb, 0xc1, 0x80, 0x83, 0xab, 0x37, 0x9e, 0x9c, 0xfa, 0xf7, 0xcd, 0xf1, 0x72, 0x87, 0x7c, 0x48, 0xdc, 0x2e, 0x87, 0x2b, 0x14, 0xd0, 0x7b, 0x91, 0xc2, 0x1d, 0x5c, 0xc2, 0x7c, 0xbf, 0xd1, 0xef, 0x05, 0x07, 0x49, 0x82, 0x74, 0x35, 0x96, 0x53, 0x01, 0x6e, 0x2b, 0xf8, 0x5b, 0x94, 0xef, 0xc6, 0x5a, 0x95, 0x00, 0xe1, 0xc8, 0x79, 0xd5, 0x77, 0x90, 0x6f, 0x69, 0xbd, 0x56, 0x80, 0x78, 0x16, 0xbc, 0x2d, 0x10, 0xd0, 0xf8, 0xcc, 0x7c, 0x2b, 0xa2, 0x3f, 0x7e, 0x03, 0x1f,
|
||||
};
|
@ -1 +0,0 @@
|
||||
../bootloader/icon_info.h
|
11
core/embed/bootloader_ci/icon_info.h
Normal file
11
core/embed/bootloader_ci/icon_info.h
Normal file
@ -0,0 +1,11 @@
|
||||
// clang-format off
|
||||
static const uint8_t toi_icon_info[] = {
|
||||
// magic
|
||||
'T', 'O', 'I', 'g',
|
||||
// width (16-bit), height (16-bit)
|
||||
0x20, 0x00, 0x20, 0x00,
|
||||
// compressed data length (32-bit)
|
||||
0xd9, 0x00, 0x00, 0x00,
|
||||
// compressed data
|
||||
0x7d, 0x91, 0x3d, 0x0a, 0xc2, 0x40, 0x10, 0x85, 0x47, 0xfc, 0x47, 0x59, 0x72, 0x10, 0x21, 0x85, 0x1e, 0x20, 0xe0, 0x41, 0x62, 0x6d, 0xa3, 0x37, 0xd0, 0xde, 0x26, 0x37, 0x88, 0xb5, 0x4d, 0xac, 0xd4, 0x5b, 0xd8, 0x59, 0xaa, 0x17, 0x10, 0x23, 0x18, 0x62, 0x34, 0xe6, 0xb9, 0xd9, 0x1f, 0x8c, 0xab, 0x38, 0xc5, 0xce, 0x7e, 0x30, 0x3b, 0xb3, 0xf3, 0x1e, 0x11, 0x8f, 0xf2, 0x6c, 0x7f, 0xda, 0x38, 0xa4, 0xa3, 0x01, 0x11, 0x9e, 0xc2, 0x1a, 0x54, 0x4c, 0x25, 0x6f, 0x81, 0x75, 0xbf, 0x37, 0x04, 0x9e, 0x02, 0x19, 0x30, 0x56, 0x65, 0x97, 0x3c, 0x9f, 0xb1, 0x94, 0x75, 0x4d, 0xc0, 0x22, 0x6a, 0x21, 0xd6, 0x7d, 0x5d, 0x1c, 0x89, 0x46, 0xa2, 0xda, 0xbd, 0xf3, 0xa3, 0x8a, 0x1b, 0x11, 0x1e, 0xfc, 0x56, 0x02, 0x06, 0x3c, 0xf9, 0xb0, 0xea, 0x08, 0xf9, 0xa5, 0x22, 0xa7, 0x33, 0x78, 0x4c, 0x4e, 0x05, 0x1c, 0xf1, 0x20, 0xb4, 0x21, 0x5a, 0x75, 0x76, 0x22, 0x21, 0x9a, 0xa4, 0x54, 0x88, 0x20, 0x09, 0xe2, 0x22, 0xbb, 0xe9, 0x36, 0xa2, 0x77, 0x7f, 0xb2, 0xb3, 0xc3, 0xf5, 0x3f, 0x9b, 0xf5, 0xb2, 0x9f, 0x66, 0x37, 0x95, 0xf3, 0x34, 0xfb, 0x89, 0xfc, 0x8f, 0x66, 0x44, 0x4c, 0xac, 0xa7, 0x98, 0xff, 0x57, 0xee, 0xa3, 0x98, 0x61, 0x6e, 0xee, 0xab, 0xf4, 0x58, 0x2c, 0x1c, 0xa5, 0x47, 0xdb, 0xd0, 0xcb, 0xd4, 0xf3, 0x4b, 0xef, 0xdc, 0x8f, 0x55, 0xbf, 0xcb, 0xfd, 0xc8, 0xac, 0x9f, 0x7e, 0x99, 0x7e, 0x7e, 0xf8, 0xfd, 0x02,
|
||||
};
|
@ -1 +0,0 @@
|
||||
../bootloader/icon_install.h
|
11
core/embed/bootloader_ci/icon_install.h
Normal file
11
core/embed/bootloader_ci/icon_install.h
Normal file
@ -0,0 +1,11 @@
|
||||
// clang-format off
|
||||
static const uint8_t toi_icon_install[] = {
|
||||
// magic
|
||||
'T', 'O', 'I', 'g',
|
||||
// width (16-bit), height (16-bit)
|
||||
0x40, 0x00, 0x40, 0x00,
|
||||
// compressed data length (32-bit)
|
||||
0xb8, 0x00, 0x00, 0x00,
|
||||
// compressed data
|
||||
0x63, 0x60, 0x18, 0x05, 0xa3, 0x80, 0x58, 0x60, 0xe2, 0xe2, 0xe2, 0x8c, 0x4f, 0xfe, 0xfc, 0xff, 0xff, 0x7f, 0x46, 0xe5, 0xc9, 0x93, 0x5f, 0x83, 0x90, 0x3f, 0x85, 0x45, 0x9a, 0xeb, 0xff, 0x05, 0x98, 0x3c, 0xef, 0xff, 0x05, 0x98, 0xf2, 0xeb, 0xff, 0xff, 0x86, 0xc9, 0xef, 0xff, 0xff, 0x0b, 0x43, 0x9a, 0xe7, 0xff, 0x7f, 0xa0, 0x01, 0x60, 0x79, 0x5e, 0x20, 0xf3, 0x00, 0xba, 0x3c, 0x0b, 0x50, 0xf0, 0x8f, 0x00, 0x48, 0x9e, 0x11, 0x48, 0xfc, 0x77, 0xc0, 0x30, 0xc0, 0x1f, 0x28, 0x7a, 0x09, 0x24, 0xaf, 0x0b, 0x64, 0x7c, 0xc1, 0xb4, 0x9f, 0x09, 0x28, 0xfc, 0xef, 0x3d, 0x04, 0xff, 0x57, 0xc0, 0xe2, 0x01, 0x90, 0x01, 0x50, 0xf0, 0x05, 0x9b, 0xff, 0x99, 0x10, 0xf2, 0x0a, 0x58, 0x03, 0x48, 0x1f, 0x26, 0xfd, 0x09, 0x7b, 0x00, 0x32, 0xc3, 0xe4, 0x0d, 0x70, 0x84, 0xb0, 0x1d, 0x44, 0xfa, 0x11, 0xae, 0x18, 0x60, 0x02, 0x39, 0xfd, 0xff, 0x3f, 0x05, 0x9c, 0xd1, 0x27, 0x0b, 0x92, 0xbf, 0x88, 0x3b, 0x7a, 0x19, 0xef, 0xff, 0xff, 0xff, 0x57, 0x00, 0x4f, 0xfc, 0xcb, 0xfc, 0xff, 0x7f, 0x90, 0x01, 0x6f, 0x02, 0xc1, 0x9b, 0x7c, 0x80, 0x06, 0xe0, 0xd7, 0xce, 0xc0, 0x28, 0xc0, 0x30, 0x0a, 0x46, 0x01, 0xf1, 0x00, 0x00,
|
||||
};
|
@ -1 +0,0 @@
|
||||
../bootloader/icon_logo.h
|
11
core/embed/bootloader_ci/icon_logo.h
Normal file
11
core/embed/bootloader_ci/icon_logo.h
Normal file
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
../bootloader/icon_safeplace.h
|
11
core/embed/bootloader_ci/icon_safeplace.h
Normal file
11
core/embed/bootloader_ci/icon_safeplace.h
Normal file
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
../bootloader/icon_welcome.h
|
11
core/embed/bootloader_ci/icon_welcome.h
Normal file
11
core/embed/bootloader_ci/icon_welcome.h
Normal file
@ -0,0 +1,11 @@
|
||||
// clang-format off
|
||||
static const uint8_t toi_icon_welcome[] = {
|
||||
// magic
|
||||
'T', 'O', 'I', 'g',
|
||||
// width (16-bit), height (16-bit)
|
||||
0xb4, 0x00, 0x1e, 0x00,
|
||||
// compressed data length (32-bit)
|
||||
0x31, 0x03, 0x00, 0x00,
|
||||
// compressed data
|
||||
0xc5, 0x52, 0x3d, 0x53, 0x13, 0x51, 0x14, 0xbd, 0x01, 0x24, 0x42, 0x20, 0xa1, 0x56, 0x07, 0xe8, 0x9c, 0xf1, 0x63, 0x42, 0xa9, 0x33, 0xce, 0x40, 0x8b, 0x85, 0xf0, 0x0f, 0x42, 0x45, 0x9b, 0xd8, 0x21, 0xe3, 0x0c, 0x58, 0x51, 0x39, 0xa1, 0xb3, 0x33, 0xf9, 0x07, 0xf1, 0x17, 0x88, 0x76, 0xb1, 0x11, 0x28, 0x2c, 0x6c, 0x08, 0xd2, 0xa1, 0x33, 0x2e, 0x10, 0x3e, 0x43, 0xd8, 0xe3, 0xb9, 0xf7, 0x6d, 0x36, 0x9b, 0x05, 0x66, 0x1c, 0xc9, 0x8c, 0xb7, 0xd8, 0xbd, 0xef, 0xbd, 0x7b, 0xce, 0xbb, 0xef, 0xdc, 0x23, 0xf2, 0x9f, 0x02, 0x38, 0xba, 0x09, 0x7c, 0x12, 0x98, 0xe2, 0x6f, 0x1d, 0x07, 0xfc, 0x66, 0x80, 0xe5, 0x9b, 0x31, 0x47, 0x30, 0x24, 0x2b, 0x84, 0x3b, 0x59, 0x60, 0xb6, 0x6b, 0xcc, 0x43, 0x40, 0x59, 0xa4, 0x0f, 0x38, 0xe3, 0x22, 0x07, 0x8c, 0x74, 0x8d, 0x79, 0x00, 0xd8, 0x10, 0x49, 0x02, 0x4d, 0x2e, 0x8a, 0xf0, 0xa5, 0x6b, 0xcc, 0xfd, 0xc0, 0x9e, 0x48, 0x0a, 0x00, 0x17, 0x6b, 0x68, 0x74, 0x8f, 0xb9, 0x07, 0xa8, 0x8b, 0xa4, 0xc9, 0x3c, 0x21, 0xe2, 0xe1, 0xa4, 0x7b, 0xcc, 0xcc, 0x8f, 0x6d, 0x74, 0x1c, 0x64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0xb9, 0x8d, 0xf1, 0xf4, 0x3c, 0x0c, 0xf6, 0xb1, 0xe1, 0x9a, 0xad, 0xeb, 0x45, 0x35, 0x2b, 0x3a, 0x77, 0x6a, 0x98, 0x48, 0x8c, 0x4d, 0xca, 0xe8, 0x59, 0xb6, 0x73, 0x05, 0x73, 0x1b, 0xd3, 0xc9, 0x5c, 0x71, 0xa6, 0x99, 0xb1, 0x61, 0x51, 0x2a, 0xab, 0x2a, 0x04, 0xcc, 0xf2, 0x4c, 0x57, 0x0d, 0x3d, 0x78, 0x68, 0xe8, 0xf1, 0x2b, 0x98, 0xdb, 0x98, 0x0e, 0x35, 0x64, 0x09, 0xd0, 0xa9, 0x8e, 0x39, 0x5b, 0x89, 0xdc, 0xff, 0x88, 0x5f, 0x2f, 0xa5, 0xc5, 0x2c, 0xd3, 0x5b, 0x7e, 0x75, 0xdc, 0x0e, 0x9e, 0x6e, 0xf9, 0xdf, 0xa7, 0xe4, 0x2a, 0xe6, 0x10, 0x13, 0x4c, 0xf0, 0x0f,
|
||||
};
|
@ -1 +0,0 @@
|
||||
../bootloader/icon_wipe.h
|
11
core/embed/bootloader_ci/icon_wipe.h
Normal file
11
core/embed/bootloader_ci/icon_wipe.h
Normal file
@ -0,0 +1,11 @@
|
||||
// clang-format off
|
||||
static const uint8_t toi_icon_wipe[] = {
|
||||
// magic
|
||||
'T', 'O', 'I', 'g',
|
||||
// width (16-bit), height (16-bit)
|
||||
0x40, 0x00, 0x40, 0x00,
|
||||
// compressed data length (32-bit)
|
||||
0x2e, 0x01, 0x00, 0x00,
|
||||
// compressed data
|
||||
0xed, 0xd2, 0x31, 0x4e, 0x02, 0x41, 0x14, 0x06, 0xe0, 0x07, 0x2a, 0x1a, 0x85, 0x95, 0xce, 0x92, 0x3d, 0x00, 0x09, 0x7a, 0x00, 0x83, 0xd1, 0x03, 0x58, 0x5a, 0xc2, 0x0d, 0xdc, 0xc4, 0xda, 0xe8, 0x11, 0xbc, 0x01, 0x54, 0xb6, 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0x39, 0x9e, 0xd9, 0x1b, 0xd0, 0x40, 0x99, 0x8d, 0x49, 0x45, 0xd9, 0x9b, 0x04, 0xb7, 0x67, 0x14, 0xe9, 0xc2, 0x46, 0xb8, 0x3f, 0x52, 0xbf, 0xb4, 0x51, 0x35, 0x0e, 0x07, 0x6c, 0xc0, 0x7c, 0x77, 0x46, 0xc6, 0xdf, 0x09, 0xf7, 0xb7, 0x9d, 0x1d, 0x24, 0x46, 0xbe, 0x9d, 0x1d, 0xab, 0x89, 0xaa, 0x63, 0x2b, 0xd8, 0xb5, 0x85, 0x6a, 0x63, 0xdf, 0xb2, 0x65, 0x19, 0x28, 0xf2, 0xa4, 0x2e, 0x1b, 0x6f, 0x4e, 0x63, 0x9f, 0xd3, 0xb5, 0xbe, 0xf6, 0x12, 0x2f, 0x53, 0x41, 0xbf, 0x5a, 0xa4, 0x75, 0x56, 0x28, 0x73,
|
||||
};
|
@ -1 +0,0 @@
|
||||
../bootloader/memory.ld
|
55
core/embed/bootloader_ci/memory.ld
Normal file
55
core/embed/bootloader_ci/memory.ld
Normal file
@ -0,0 +1,55 @@
|
||||
/* Trezor v2 bootloader linker script */
|
||||
|
||||
ENTRY(reset_handler)
|
||||
|
||||
MEMORY {
|
||||
FLASH (rx) : ORIGIN = 0x08020000, LENGTH = 128K
|
||||
CCMRAM (wal) : ORIGIN = 0x10000000, LENGTH = 64K
|
||||
SRAM (wal) : ORIGIN = 0x20000000, LENGTH = 192K
|
||||
}
|
||||
|
||||
main_stack_base = ORIGIN(CCMRAM) + LENGTH(CCMRAM); /* 8-byte aligned full descending stack */
|
||||
|
||||
/* 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);
|
||||
|
||||
_codelen = SIZEOF(.flash) + SIZEOF(.data);
|
||||
|
||||
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
|
||||
|
||||
.data : ALIGN(4) {
|
||||
*(.data*);
|
||||
. = ALIGN(512);
|
||||
} >CCMRAM AT>FLASH
|
||||
|
||||
.bss : ALIGN(4) {
|
||||
*(.bss*);
|
||||
. = ALIGN(4);
|
||||
} >CCMRAM
|
||||
|
||||
.stack : ALIGN(8) {
|
||||
. = 4K; /* this acts as a build time assertion that at least this much memory is available for stack use */
|
||||
} >CCMRAM
|
||||
}
|
@ -1 +0,0 @@
|
||||
../bootloader/messages.h
|
51
core/embed/bootloader_ci/messages.h
Normal file
51
core/embed/bootloader_ci/messages.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* This file is part of the Trezor project, https://trezor.io/
|
||||
*
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __MESSAGES_H__
|
||||
#define __MESSAGES_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include "image.h"
|
||||
#include "secbool.h"
|
||||
|
||||
#define USB_TIMEOUT 500
|
||||
#define USB_PACKET_SIZE 64
|
||||
|
||||
#define FIRMWARE_UPLOAD_CHUNK_RETRY_COUNT 2
|
||||
|
||||
secbool msg_parse_header(const uint8_t *buf, uint16_t *msg_id,
|
||||
uint32_t *msg_size);
|
||||
|
||||
void send_user_abort(uint8_t iface_num, const char *msg);
|
||||
|
||||
void process_msg_Initialize(uint8_t iface_num, uint32_t msg_size, uint8_t *buf,
|
||||
const vendor_header *const vhdr,
|
||||
const image_header *const hdr);
|
||||
void process_msg_GetFeatures(uint8_t iface_num, uint32_t msg_size, uint8_t *buf,
|
||||
const vendor_header *const vhdr,
|
||||
const image_header *const hdr);
|
||||
void process_msg_Ping(uint8_t iface_num, uint32_t msg_size, uint8_t *buf);
|
||||
void process_msg_FirmwareErase(uint8_t iface_num, uint32_t msg_size,
|
||||
uint8_t *buf);
|
||||
int process_msg_FirmwareUpload(uint8_t iface_num, uint32_t msg_size,
|
||||
uint8_t *buf);
|
||||
int process_msg_WipeDevice(uint8_t iface_num, uint32_t msg_size, uint8_t *buf);
|
||||
void process_msg_unknown(uint8_t iface_num, uint32_t msg_size, uint8_t *buf);
|
||||
|
||||
#endif
|
@ -1 +0,0 @@
|
||||
../bootloader/startup.s
|
41
core/embed/bootloader_ci/startup.s
Normal file
41
core/embed/bootloader_ci/startup.s
Normal file
@ -0,0 +1,41 @@
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
.global reset_handler
|
||||
.type reset_handler, STT_FUNC
|
||||
reset_handler:
|
||||
// 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
|
||||
ldr r2, =0 // r2 - the word-sized value to be written
|
||||
bl memset_reg
|
||||
|
||||
ldr r0, =sram_start // r0 - point to beginning of SRAM
|
||||
ldr r1, =sram_end // r1 - point to byte after the end of SRAM
|
||||
ldr r2, =0 // r2 - the word-sized value to be written
|
||||
bl memset_reg
|
||||
|
||||
// copy data in from flash
|
||||
ldr r0, =data_vma // dst addr
|
||||
ldr r1, =data_lma // src addr
|
||||
ldr r2, =data_size // size in bytes
|
||||
bl memcpy
|
||||
|
||||
// setup the stack protector (see build script "-fstack-protector-all") with an unpredictable value
|
||||
bl rng_get
|
||||
ldr r1, = __stack_chk_guard
|
||||
str r0, [r1]
|
||||
|
||||
// re-enable exceptions
|
||||
// according to "ARM Cortex-M Programming Guide to Memory Barrier Instructions" Application Note 321, section 4.7:
|
||||
// "If it is not necessary to ensure that a pended interrupt is recognized immediately before
|
||||
// subsequent operations, it is not necessary to insert a memory barrier instruction."
|
||||
cpsie f
|
||||
|
||||
// enter the application code
|
||||
bl main
|
||||
|
||||
b shutdown
|
||||
|
||||
.end
|
@ -1 +0,0 @@
|
||||
../bootloader/version.h
|
14
core/embed/bootloader_ci/version.h
Normal file
14
core/embed/bootloader_ci/version.h
Normal file
@ -0,0 +1,14 @@
|
||||
#define VERSION_MAJOR 2
|
||||
#define VERSION_MINOR 0
|
||||
#define VERSION_PATCH 4
|
||||
#define VERSION_BUILD 0
|
||||
#define VERSION_UINT32 \
|
||||
(VERSION_MAJOR | (VERSION_MINOR << 8) | (VERSION_PATCH << 16) | \
|
||||
(VERSION_BUILD << 24))
|
||||
|
||||
#define FIX_VERSION_MAJOR 2
|
||||
#define FIX_VERSION_MINOR 0
|
||||
#define FIX_VERSION_PATCH 0
|
||||
#define FIX_VERSION_BUILD 0
|
||||
|
||||
#define VERSION_MONOTONIC 1
|
Loading…
Reference in New Issue
Block a user