fix bootloader, extract FONT_* constants
This commit is contained in:
parent
19bb7fc1e3
commit
281070492d
8
Makefile
8
Makefile
|
@ -31,6 +31,9 @@ build_unix_frozen: vendor build_cross ## build unix port with frozen modules (fr
|
||||||
build_cross: vendor ## build mpy-cross port
|
build_cross: vendor ## build mpy-cross port
|
||||||
make -C vendor/micropython/mpy-cross MICROPY_FORCE_32BIT=1
|
make -C vendor/micropython/mpy-cross MICROPY_FORCE_32BIT=1
|
||||||
|
|
||||||
|
build_bootloader: vendor ## build bootloader
|
||||||
|
make -C vendor/micropython/stmhal -f Makefile.bootloader
|
||||||
|
|
||||||
run: ## run unix port
|
run: ## run unix port
|
||||||
cd src ; ../vendor/micropython/unix/micropython
|
cd src ; ../vendor/micropython/unix/micropython
|
||||||
|
|
||||||
|
@ -56,6 +59,11 @@ flash: ## flash firmware using st-flash
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
st-flash write $(STMHAL_BUILD_DIR)/firmware1.bin 0x8020000
|
st-flash write $(STMHAL_BUILD_DIR)/firmware1.bin 0x8020000
|
||||||
|
|
||||||
|
flash_bootloader: vendor ## build bootloader
|
||||||
|
st-flash write $(STMHAL_BUILD_DIR)/bootloader0.bin 0x8000000
|
||||||
|
sleep 0.1
|
||||||
|
st-flash write $(STMHAL_BUILD_DIR)/bootloader1.bin 0x8020000
|
||||||
|
|
||||||
openocd: ## start openocd which connects to the device
|
openocd: ## start openocd which connects to the device
|
||||||
openocd -f interface/stlink-v2.cfg -f target/stm32f4x.cfg
|
openocd -f interface/stlink-v2.cfg -f target/stm32f4x.cfg
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ QSTR_DEFS = qstrdefsport.h $(BUILD)/pins_qstr.h $(BUILD)/modstm_qstr.h
|
||||||
# include py core make definitions
|
# include py core make definitions
|
||||||
include ../py/py.mk
|
include ../py/py.mk
|
||||||
|
|
||||||
|
LD_DIR=boards
|
||||||
CMSIS_DIR=cmsis
|
CMSIS_DIR=cmsis
|
||||||
HAL_DIR=hal/$(MCU_SERIES)
|
HAL_DIR=hal/$(MCU_SERIES)
|
||||||
USBDEV_DIR=usbdev
|
USBDEV_DIR=usbdev
|
||||||
|
@ -57,7 +58,7 @@ CFLAGS += $(COPT)
|
||||||
CFLAGS += -Iboards/$(BOARD)
|
CFLAGS += -Iboards/$(BOARD)
|
||||||
CFLAGS += -DSTM32_HAL_H='<stm32$(MCU_SERIES)xx_hal.h>'
|
CFLAGS += -DSTM32_HAL_H='<stm32$(MCU_SERIES)xx_hal.h>'
|
||||||
|
|
||||||
LDFLAGS = -nostdlib -T $(LD_FILE) -Map=$(@:.elf=.map) --cref
|
LDFLAGS = -nostdlib -L $(LD_DIR) -T $(LD_FILE) -Map=$(@:.elf=.map) --cref
|
||||||
LIBS =
|
LIBS =
|
||||||
|
|
||||||
# Remove uncalled code from the final image.
|
# Remove uncalled code from the final image.
|
||||||
|
|
|
@ -63,10 +63,9 @@ int main(void) {
|
||||||
__GPIOC_CLK_ENABLE();
|
__GPIOC_CLK_ENABLE();
|
||||||
__GPIOD_CLK_ENABLE();
|
__GPIOD_CLK_ENABLE();
|
||||||
|
|
||||||
|
|
||||||
display_init();
|
display_init();
|
||||||
display_bar(0, 0, RESX, RESY, 0x0000);
|
display_clear();
|
||||||
display_text(0, 0, "TREZOR", 6, 0, 0xFFFF, 0x0000);
|
display_text(0, 0, "TREZOR", 6, FONT_MONO, 0xFFFF, 0x0000);
|
||||||
display_backlight(255);
|
display_backlight(255);
|
||||||
|
|
||||||
__fatal_error("end");
|
__fatal_error("end");
|
||||||
|
|
|
@ -178,11 +178,11 @@ static const uint8_t *get_glyph(uint8_t font, uint8_t c)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
switch (font) {
|
switch (font) {
|
||||||
case 0:
|
case FONT_MONO:
|
||||||
return Font_RobotoMono_Regular_20[c - ' '];
|
return Font_RobotoMono_Regular_20[c - ' '];
|
||||||
case 1:
|
case FONT_NORMAL:
|
||||||
return Font_Roboto_Regular_20[c - ' '];
|
return Font_Roboto_Regular_20[c - ' '];
|
||||||
case 2:
|
case FONT_BOLD:
|
||||||
return Font_Roboto_Bold_20[c - ' '];
|
return Font_Roboto_Bold_20[c - ' '];
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -11,6 +11,10 @@
|
||||||
#define DISPLAY_RESX 240
|
#define DISPLAY_RESX 240
|
||||||
#define DISPLAY_RESY 240
|
#define DISPLAY_RESY 240
|
||||||
|
|
||||||
|
#define FONT_MONO 0
|
||||||
|
#define FONT_NORMAL 1
|
||||||
|
#define FONT_BOLD 2
|
||||||
|
|
||||||
void display_init(void);
|
void display_init(void);
|
||||||
void display_set_window(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
|
void display_set_window(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
|
||||||
void display_update(void);
|
void display_update(void);
|
||||||
|
|
|
@ -332,6 +332,9 @@ STATIC const mp_rom_map_elem_t mod_TrezorUi_Display_locals_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_orientation), MP_ROM_PTR(&mod_TrezorUi_Display_orientation_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_orientation), MP_ROM_PTR(&mod_TrezorUi_Display_orientation_obj) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_backlight), MP_ROM_PTR(&mod_TrezorUi_Display_backlight_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_backlight), MP_ROM_PTR(&mod_TrezorUi_Display_backlight_obj) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_raw), MP_ROM_PTR(&mod_TrezorUi_Display_raw_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_raw), MP_ROM_PTR(&mod_TrezorUi_Display_raw_obj) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_FONT_MONO), MP_OBJ_NEW_SMALL_INT(FONT_MONO) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_FONT_NORMAL), MP_OBJ_NEW_SMALL_INT(FONT_NORMAL) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_FONT_BOLD), MP_OBJ_NEW_SMALL_INT(FONT_BOLD) },
|
||||||
};
|
};
|
||||||
STATIC MP_DEFINE_CONST_DICT(mod_TrezorUi_Display_locals_dict, mod_TrezorUi_Display_locals_dict_table);
|
STATIC MP_DEFINE_CONST_DICT(mod_TrezorUi_Display_locals_dict, mod_TrezorUi_Display_locals_dict_table);
|
||||||
|
|
||||||
|
|
|
@ -42,9 +42,9 @@ WHITE = rgbcolor(0xFA, 0xFA, 0xFA)
|
||||||
PM_DARK_BLUE = rgbcolor(0x1A, 0x29, 0x42)
|
PM_DARK_BLUE = rgbcolor(0x1A, 0x29, 0x42)
|
||||||
PM_BLUE = rgbcolor(0x34, 0x98, 0xdb)
|
PM_BLUE = rgbcolor(0x34, 0x98, 0xdb)
|
||||||
|
|
||||||
MONO = const(0)
|
MONO = Display.FONT_MONO
|
||||||
NORMAL = const(1)
|
NORMAL = Display.FONT_NORMAL
|
||||||
BOLD = const(2)
|
BOLD = Display.FONT_BOLD
|
||||||
|
|
||||||
|
|
||||||
def in_area(pos: tuple, area: tuple) -> bool:
|
def in_area(pos: tuple, area: tuple) -> bool:
|
||||||
|
|
Loading…
Reference in New Issue