1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-13 02:58:57 +00:00

loader: vendor image is now shown in display

This commit is contained in:
Pavol Rusnak 2017-04-01 19:58:58 +02:00
parent a5a34696ef
commit b72bc08172
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
3 changed files with 16 additions and 2 deletions

View File

@ -59,6 +59,7 @@ OBJ_FW += $(addprefix $(BUILD_FW)/, \
loader/header.o \
loader/main.o \
extmod/modtrezorui/display.o \
extmod/modtrezorui/inflate.o \
extmod/modtrezorui/font_bitmap.o \
trezorhal/common.o \
trezorhal/image.o \

View File

@ -94,7 +94,7 @@ STATIC mp_obj_t mod_TrezorUi_Display_image(size_t n_args, const mp_obj_t *args)
if (datalen != image.len - 12) {
mp_raise_ValueError("Invalid size of data");
}
display_image(x, y, w, h, data + 12, image.len - 12);
display_image(x, y, w, h, data + 12, datalen);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_image_obj, 4, 4, mod_TrezorUi_Display_image);

View File

@ -1,5 +1,7 @@
#include STM32_HAL_H
#include <string.h>
#include "common.h"
#include "display.h"
#include "image.h"
@ -14,6 +16,17 @@ void pendsv_isr_handler(void) {
__fatal_error("pendsv");
}
void display_vendor(const uint8_t *vimg)
{
if (memcmp(vimg, "TOIf", 4) != 0) {
return;
}
uint16_t w = *(uint16_t *)(vimg + 4);
uint16_t h = *(uint16_t *)(vimg + 6);
uint32_t datalen = *(uint32_t *)(vimg + 8);
display_image(0, 0, w, h, vimg + 12, datalen);
}
void check_and_jump(void)
{
LOADER_PRINTLN("checking firmware");
@ -32,7 +45,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
LOADER_PRINTLN("waiting 1 second");
display_vendor(vhdr.vimg);
HAL_Delay(1000);
// end
LOADER_PRINTLN("JUMP!");