mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-03 03:50:58 +00:00
loader: vendor image is now shown in display
This commit is contained in:
parent
a5a34696ef
commit
b72bc08172
@ -59,6 +59,7 @@ OBJ_FW += $(addprefix $(BUILD_FW)/, \
|
|||||||
loader/header.o \
|
loader/header.o \
|
||||||
loader/main.o \
|
loader/main.o \
|
||||||
extmod/modtrezorui/display.o \
|
extmod/modtrezorui/display.o \
|
||||||
|
extmod/modtrezorui/inflate.o \
|
||||||
extmod/modtrezorui/font_bitmap.o \
|
extmod/modtrezorui/font_bitmap.o \
|
||||||
trezorhal/common.o \
|
trezorhal/common.o \
|
||||||
trezorhal/image.o \
|
trezorhal/image.o \
|
||||||
|
@ -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) {
|
if (datalen != image.len - 12) {
|
||||||
mp_raise_ValueError("Invalid size of data");
|
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;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_image_obj, 4, 4, mod_TrezorUi_Display_image);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_image_obj, 4, 4, mod_TrezorUi_Display_image);
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include STM32_HAL_H
|
#include STM32_HAL_H
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
@ -14,6 +16,17 @@ void pendsv_isr_handler(void) {
|
|||||||
__fatal_error("pendsv");
|
__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)
|
void check_and_jump(void)
|
||||||
{
|
{
|
||||||
LOADER_PRINTLN("checking firmware");
|
LOADER_PRINTLN("checking firmware");
|
||||||
@ -32,7 +45,7 @@ void check_and_jump(void)
|
|||||||
if (image_check_signature((const uint8_t *)(FIRMWARE_START + vhdr.hdrlen))) {
|
if (image_check_signature((const uint8_t *)(FIRMWARE_START + vhdr.hdrlen))) {
|
||||||
LOADER_PRINTLN("valid firmware image");
|
LOADER_PRINTLN("valid firmware image");
|
||||||
// TODO: remove debug wait
|
// TODO: remove debug wait
|
||||||
LOADER_PRINTLN("waiting 1 second");
|
display_vendor(vhdr.vimg);
|
||||||
HAL_Delay(1000);
|
HAL_Delay(1000);
|
||||||
// end
|
// end
|
||||||
LOADER_PRINTLN("JUMP!");
|
LOADER_PRINTLN("JUMP!");
|
||||||
|
Loading…
Reference in New Issue
Block a user