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

loader: show vendor image and vendor string from vendor header

This commit is contained in:
Pavol Rusnak 2017-04-01 20:12:48 +02:00
parent b72bc08172
commit 1f07f310b3
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
4 changed files with 14 additions and 5 deletions

View File

@ -400,8 +400,8 @@ QSTR_GEN_EXTRA_CFLAGS += -DNO_QSTR -DN_X64 -DN_X86 -DN_THUMB -DN_ARM -DN_XTENSA
all: $(BUILD)/$(TARGET).bin
$(SRCDIR_FW)/firmware/vendorheader.bin: assets/satoshilabs.png
./tools/build_vendorheader '0000000000000000000000000000000000000000000000000000000000000000,0000000000000000000000000000000000000000000000000000000000000000,0000000000000000000000000000000000000000000000000000000000000000' 2 1.1 SatoshiLabs assets/satoshilabs.png micropython/firmware/vendorheader.bin
$(SRCDIR_FW)/firmware/vendorheader.bin: assets/satoshilabs_120.png
./tools/build_vendorheader '0000000000000000000000000000000000000000000000000000000000000000,0000000000000000000000000000000000000000000000000000000000000000,0000000000000000000000000000000000000000000000000000000000000000' 2 1.1 SatoshiLabs assets/satoshilabs_120.png micropython/firmware/vendorheader.bin
$(BUILD_FW)/firmware/vendorheader.o: $(SRCDIR_FW)/firmware/vendorheader.bin
$(Q)$(OBJCOPY) -I binary -O elf32-littlearm -B arm \

View File

@ -61,6 +61,9 @@ OBJ_FW += $(addprefix $(BUILD_FW)/, \
extmod/modtrezorui/display.o \
extmod/modtrezorui/inflate.o \
extmod/modtrezorui/font_bitmap.o \
extmod/modtrezorui/font_roboto_bold_20.o \
extmod/modtrezorui/font_roboto_regular_20.o \
extmod/modtrezorui/font_robotomono_regular_20.o \
trezorhal/common.o \
trezorhal/image.o \
trezorhal/stm32_it.o \

BIN
assets/satoshilabs_120.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -16,15 +16,21 @@ void pendsv_isr_handler(void) {
__fatal_error("pendsv");
}
void display_vendor(const uint8_t *vimg)
void display_vendor(const uint8_t *vimg, const char *vstr, uint32_t vstr_len)
{
display_clear();
if (memcmp(vimg, "TOIf", 4) != 0) {
return;
}
uint16_t w = *(uint16_t *)(vimg + 4);
uint16_t h = *(uint16_t *)(vimg + 6);
if (w != 120 || h != 120) {
return;
}
uint32_t datalen = *(uint32_t *)(vimg + 8);
display_image(0, 0, w, h, vimg + 12, datalen);
display_image((DISPLAY_RESX - w) / 2, (DISPLAY_RESY - h) / 2, w, h, vimg + 12, datalen);
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY * 3 / 4 + 20, vstr, vstr_len, FONT_BOLD, 0xFFFF, 0x0000);
display_refresh();
}
void check_and_jump(void)
@ -45,7 +51,7 @@ void check_and_jump(void)
if (image_check_signature((const uint8_t *)(FIRMWARE_START + vhdr.hdrlen))) {
LOADER_PRINTLN("valid firmware image");
// TODO: remove debug wait
display_vendor(vhdr.vimg);
display_vendor(vhdr.vimg, (const char *)vhdr.vstr, vhdr.vstr_len);
HAL_Delay(1000);
// end
LOADER_PRINTLN("JUMP!");