mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-26 09:28:13 +00:00
small cosmetic changes to prodtest and others
This commit is contained in:
parent
d0e81edc8f
commit
3851404d04
11
Makefile
11
Makefile
@ -30,6 +30,7 @@ OPENOCD = openocd -f interface/stlink-$(STLINK_VER).cfg -c "transport select hla
|
||||
BOARDLOADER_START = 0x08000000
|
||||
BOOTLOADER_START = 0x08020000
|
||||
FIRMWARE_START = 0x08040000
|
||||
PRODTEST_START = 0x08040000
|
||||
|
||||
BOARDLOADER_MAXSIZE = 49152
|
||||
BOOTLOADER_MAXSIZE = 131072
|
||||
@ -136,7 +137,7 @@ flash_prodtest: $(PRODTEST_BUILD_DIR)/prodtest.bin ## flash prodtest using OpenO
|
||||
flash_firmware: $(FIRMWARE_BUILD_DIR)/firmware.bin ## flash firmware using OpenOCD
|
||||
$(OPENOCD) -c "init; reset halt; flash write_image erase $< $(FIRMWARE_START); exit"
|
||||
|
||||
flash_combine: $(FIRMWARE_BUILD_DIR)/combined.bin ## flash combined using OpenOCD
|
||||
flash_combine: $(PRODTEST_BUILD_DIR)/combined.bin ## flash combined using OpenOCD
|
||||
$(OPENOCD) -c "init; reset halt; flash write_image erase $< $(BOARDLOADER_START); exit"
|
||||
|
||||
flash_erase: ## erase all sectors in flash bank 0
|
||||
@ -161,7 +162,7 @@ gdb_firmware: $(FIRMWARE_BUILD_DIR)/firmware.elf ## start remote gdb session to
|
||||
## misc commands:
|
||||
|
||||
vendorheader: ## construct and sign the default vendor header
|
||||
./tools/build_vendorheader e28a8970753332bd72fef413e6b0b2ef1b4aadda7aa2c141f233712a6876b351:d4eec1869fb1b8a4e817516ad5a931557cb56805c3eb16e8f3a803d647df7869:772c8a442b7db06e166cfbc1ccbcbcde6f3eba76a4e98ef3ffc519502237d6ef 2 0.0 10 DEVELOPMENT assets/vendor_devel.toif embed/firmware/vendorheader.bin
|
||||
./tools/build_vendorheader e28a8970753332bd72fef413e6b0b2ef1b4aadda7aa2c141f233712a6876b351:d4eec1869fb1b8a4e817516ad5a931557cb56805c3eb16e8f3a803d647df7869:772c8a442b7db06e166cfbc1ccbcbcde6f3eba76a4e98ef3ffc519502237d6ef 2 0.0 50 DEVELOPMENT assets/vendor_devel.toif embed/firmware/vendorheader.bin
|
||||
./tools/binctl embed/firmware/vendorheader.bin -s 1:2 `./tools/combine_sign vendorheader embed/firmware/vendorheader.bin 4444444444444444444444444444444444444444444444444444444444444444 4545454545454545454545454545454545454545454545454545454545454545`
|
||||
|
||||
vendorheader_sl: ## construct SatoshiLabs vendor header
|
||||
@ -182,12 +183,12 @@ sizecheck: ## check sizes of binary files
|
||||
test $(BOOTLOADER_MAXSIZE) -ge $(shell stat -c%s $(BOOTLOADER_BUILD_DIR)/bootloader.bin)
|
||||
test $(FIRMWARE_MAXSIZE) -ge $(shell stat -c%s $(FIRMWARE_BUILD_DIR)/firmware.bin)
|
||||
|
||||
combine: ## combine boardloader + bootloader + firmware into one combined image
|
||||
combine: ## combine boardloader + bootloader + prodtest into one combined image
|
||||
./tools/combine_firmware \
|
||||
$(BOARDLOADER_START) $(BOARDLOADER_BUILD_DIR)/boardloader.bin \
|
||||
$(BOOTLOADER_START) $(BOOTLOADER_BUILD_DIR)/bootloader.bin \
|
||||
$(FIRMWARE_START) $(FIRMWARE_BUILD_DIR)/firmware.bin \
|
||||
> $(FIRMWARE_BUILD_DIR)/combined.bin \
|
||||
$(PRODTEST_START) $(PRODTEST_BUILD_DIR)/prodtest.bin \
|
||||
> $(PRODTEST_BUILD_DIR)/combined.bin \
|
||||
|
||||
upload: ## upload firmware using trezorctl
|
||||
trezorctl firmware_update -f $(FIRMWARE_BUILD_DIR)/firmware.bin
|
||||
|
@ -21,15 +21,6 @@
|
||||
#include "messages.h"
|
||||
#include "style.h"
|
||||
|
||||
void display_fade(int start, int end, int delay)
|
||||
{
|
||||
for (int i = 0; i < 100; i++) {
|
||||
display_backlight(start + i * (end - start) / 100);
|
||||
hal_delay(delay / 100);
|
||||
}
|
||||
display_backlight(end);
|
||||
}
|
||||
|
||||
#define ICON_TOOLS 0
|
||||
#define ICON_UPDATE 1
|
||||
#define ICON_WIPE 2
|
||||
@ -90,12 +81,7 @@ void display_welcome(secbool firmware_present)
|
||||
}
|
||||
if (sectrue == firmware_present) {
|
||||
display_header(ICON_TOOLS, "TREZOR Bootloader");
|
||||
uint8_t dom[32];
|
||||
// format: TREZOR2-YYMMDD
|
||||
if (flash_otp_read(0, 0, dom, 32) && 0 == memcmp(dom, "TREZOR2-", 8) && dom[14] == 0) {
|
||||
display_qrcode(DISPLAY_RESX / 2, DISPLAY_RESY / 2, (const char *)dom, 14, 4);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 30, (const char *)dom, 14, FONT_BOLD, COLOR_WHITE, COLOR_BLACK);
|
||||
}
|
||||
// TODO: show info about installed firmware
|
||||
}
|
||||
display_fade(0, BACKLIGHT_NORMAL, 1000);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include "trezor-qrenc/qr_encode.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "display.h"
|
||||
|
||||
#include <string.h>
|
||||
@ -616,3 +617,12 @@ int display_backlight(int val)
|
||||
}
|
||||
return DISPLAY_BACKLIGHT;
|
||||
}
|
||||
|
||||
void display_fade(int start, int end, int delay)
|
||||
{
|
||||
for (int i = 0; i < 100; i++) {
|
||||
display_backlight(start + i * (end - start) / 100);
|
||||
hal_delay(delay / 100);
|
||||
}
|
||||
display_backlight(end);
|
||||
}
|
||||
|
@ -82,5 +82,6 @@ void display_loader(uint16_t progress, int yoffset, uint16_t fgcolor, uint16_t b
|
||||
int *display_offset(int xy[2]);
|
||||
int display_orientation(int degrees);
|
||||
int display_backlight(int val);
|
||||
void display_fade(int start, int end, int delay);
|
||||
|
||||
#endif
|
||||
|
@ -130,10 +130,10 @@ static void test_display(const char *colors)
|
||||
for (size_t i = 0; i < l; i++) {
|
||||
uint16_t c = 0x0000; // black
|
||||
switch (colors[i]) {
|
||||
case 'R': c = 0xF800; break;
|
||||
case 'G': c = 0x07E0; break;
|
||||
case 'B': c = 0x001F; break;
|
||||
case 'W': c = 0xFFFF; break;
|
||||
case 'R': c = 0xF800; break;
|
||||
case 'G': c = 0x07E0; break;
|
||||
case 'B': c = 0x001F; break;
|
||||
case 'W': c = 0xFFFF; break;
|
||||
}
|
||||
display_bar(i * w, 0, i * w + w, 240, c);
|
||||
}
|
||||
@ -247,7 +247,7 @@ static void test_otp_write(const char *args)
|
||||
{
|
||||
char data[32];
|
||||
memset(data, 0, sizeof(data));
|
||||
strcpy(data, args);
|
||||
strncpy(data, args, 31);
|
||||
flash_otp_write(0, 0, (const uint8_t *) data, sizeof(data));
|
||||
flash_otp_lock(0);
|
||||
vcp_printf("OK");
|
||||
@ -258,10 +258,11 @@ static secbool startswith(const char *s, const char *prefix)
|
||||
return sectrue * (0 == strncmp(s, prefix, strlen(prefix)));
|
||||
}
|
||||
|
||||
#define BACKLIGHT_NORMAL 150
|
||||
|
||||
int main(void)
|
||||
{
|
||||
display_orientation(0);
|
||||
display_backlight(255);
|
||||
sdcard_init();
|
||||
touch_init();
|
||||
sbu_init();
|
||||
@ -269,6 +270,15 @@ int main(void)
|
||||
|
||||
display_clear();
|
||||
|
||||
char dom[32];
|
||||
// format: TREZOR2-YYMMDD
|
||||
if (sectrue == flash_otp_read(0, 0, (uint8_t *)dom, 32) && 0 == memcmp(dom, "TREZOR2-", 8) && dom[31] == 0) {
|
||||
display_qrcode(DISPLAY_RESX / 2, DISPLAY_RESY / 2, dom, strlen(dom), 4);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 30, dom + 8, -1, FONT_BOLD, COLOR_WHITE, COLOR_BLACK);
|
||||
}
|
||||
|
||||
display_fade(0, BACKLIGHT_NORMAL, 1000);
|
||||
|
||||
char line[128];
|
||||
|
||||
for (;;) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
@ -25,3 +26,8 @@ void __attribute__((noreturn)) __fatal_error(const char *expr, const char *msg,
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void hal_delay(uint32_t ms)
|
||||
{
|
||||
usleep(1000 * ms);
|
||||
}
|
||||
|
@ -7,4 +7,6 @@ void __attribute__((noreturn)) __fatal_error(const char *expr, const char *msg,
|
||||
|
||||
#define ensure(expr, msg) (((expr) == sectrue) ? (void)0 : __fatal_error(#expr, msg, __FILE__, __LINE__, __func__))
|
||||
|
||||
void hal_delay(uint32_t ms);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user