rename bootloader to boardloader

pull/25/head
Pavol Rusnak 7 years ago
parent b412ef4b24
commit 0633506166
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -18,7 +18,7 @@ script:
- make build_cross
- make build_bootloader
- make build_boardloader
- make build_loader

@ -3,7 +3,7 @@
JOBS=4
MAKE=make -j $(JOBS)
BOOTLOADER_BUILD_DIR=micropython/bootloader/build
BOARDLOADER_BUILD_DIR=micropython/boardloader/build
LOADER_BUILD_DIR=micropython/loader/build
FIRMWARE_BUILD_DIR=micropython/firmware/build
@ -42,10 +42,10 @@ testpy: ## run selected unit tests from python-trezor
## build commands:
build: build_bootloader build_loader build_firmware build_unix build_cross ## build all
build: build_boardloader build_loader build_firmware build_unix build_cross ## build all
build_bootloader: ## build bootloader
$(MAKE) -f Makefile.bootloader $(TREZORHAL_PORT_OPTS)
build_boardloader: ## build boardloader
$(MAKE) -f Makefile.boardloader $(TREZORHAL_PORT_OPTS)
build_loader: ## build loader
$(MAKE) -f Makefile.loader $(TREZORHAL_PORT_OPTS)
@ -63,10 +63,10 @@ build_cross: ## build mpy-cross port
## clean commands:
clean: clean_bootloader clean_loader clean_firmware clean_unix clean_cross ## clean all
clean: clean_boardloader clean_loader clean_firmware clean_unix clean_cross ## clean all
clean_bootloader: ## clean bootloader build
$(MAKE) -f Makefile.bootloader clean $(TREZORHAL_PORT_OPTS)
clean_boardloader: ## clean boardloader build
$(MAKE) -f Makefile.boardloader clean $(TREZORHAL_PORT_OPTS)
clean_loader: ## clean loader build
$(MAKE) -f Makefile.loader clean $(TREZORHAL_PORT_OPTS)
@ -84,10 +84,10 @@ clean_cross: ## clean mpy-cross build
## flash commands:
flash: flash_bootloader flash_loader flash_firmware ## flash everything using st-flash
flash: flash_boardloader flash_loader flash_firmware ## flash everything using st-flash
flash_bootloader: ## flash bootloader using st-flash
st-flash write $(BOOTLOADER_BUILD_DIR)/bootloader.bin 0x08000000
flash_boardloader: ## flash boardloader using st-flash
st-flash write $(BOARDLOADER_BUILD_DIR)/boardloader.bin 0x08000000
flash_loader: ## flash loader using st-flash
st-flash write $(LOADER_BUILD_DIR)/loader.bin 0x08010000

@ -3,8 +3,8 @@ SRCDIR_MP = vendor/micropython
SRCDIR_FW = micropython
# target directory
BUILD ?= micropython/bootloader/build
TARGET ?= bootloader
BUILD ?= micropython/boardloader/build
TARGET ?= boardloader
# include py core make definitions
include $(SRCDIR_MP)/py/mkenv.mk
@ -56,7 +56,7 @@ OBJ_HAL += $(addprefix $(BUILD_MP)/,\
# OBJ micropython/
OBJ_FW += $(addprefix $(BUILD_FW)/, \
bootloader/main.o \
boardloader/main.o \
extmod/modtrezorui/display.o \
extmod/modtrezorui/font_bitmap.o \
trezorhal/common.o \
@ -95,7 +95,7 @@ SRC_MOD = $(patsubst $(BUILD_FW)%.o, $(SRCDIR_FW)%.c, $(OBJ_MOD))
CROSS_COMPILE = arm-none-eabi-
INC += -I.
INC += -I$(SRCDIR_FW)/bootloader
INC += -I$(SRCDIR_FW)/boardloader
INC += -I$(SRCDIR_FW)/extmod/modtrezorui
INC += -I$(SRCDIR_FW)/trezorhal
INC += -I$(SRCDIR_FW)/trezorhal/hal
@ -121,7 +121,7 @@ CFLAGS += -DSTM32_HAL_H='<stm32f4xx_hal.h>'
LIBS = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
LDFLAGS = -nostdlib -T $(SRCDIR_FW)/bootloader/memory.ld -Map=$@.map --cref
LDFLAGS = -nostdlib -T $(SRCDIR_FW)/boardloader/memory.ld -Map=$@.map --cref
# remove uncalled code from the final image
CFLAGS += -fdata-sections -ffunction-sections

@ -2,14 +2,14 @@
TREZOR initialization in split into two stages. See [Memory Layout](memory.md) for info about in which sectors each stage is stored.
First stage (bootloader) is stored in write-protected area, which means it is non-upgradable.
First stage (boardloader) is stored in write-protected area, which means it is non-upgradable.
Only second stage (loader) update is allowed.
## First Stage - Bootloader
## First Stage - Boardloader
First stage checks the integrity and signatures of the second stage and runs it if everything is OK.
If first stage bootloader finds a valid second stage loader image on the SD card (in raw format, no filesystem),
If first stage boardloader finds a valid second stage loader image on the SD card (in raw format, no filesystem),
it will replace the internal second stage, allowing a second stage update via SD card.
## Second Stage - Loader

@ -4,8 +4,8 @@
| sector | range | size | function
|-----------|-------------------------|--------:|----------------------
| Sector 0 | 0x08000000 - 0x08003FFF | 16 KiB | bootloader (1st stage) (write-protected)
| Sector 1 | 0x08004000 - 0x08007FFF | 16 KiB | bootloader (1st stage) (write-protected)
| Sector 0 | 0x08000000 - 0x08003FFF | 16 KiB | boardloader (1st stage) (write-protected)
| Sector 1 | 0x08004000 - 0x08007FFF | 16 KiB | boardloader (1st stage) (write-protected)
| Sector 2 | 0x08008000 - 0x0800BFFF | 16 KiB | storage area
| Sector 3 | 0x0800C000 - 0x0800FFFF | 16 KiB | storage area
| Sector 4 | 0x08010000 - 0x0801FFFF | 64 KiB | loader (2nd stage)

@ -56,7 +56,7 @@ bool copy_sdcard(void)
DPRINT("erasing flash ");
// erase flash (except bootloader)
// erase flash (except boardloader)
HAL_FLASH_Unlock();
FLASH_EraseInitTypeDef EraseInitStruct;
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR |
@ -142,7 +142,7 @@ void check_and_jump(void)
int main(void)
{
SCB->VTOR = BOOTLOADER_START;
SCB->VTOR = BOARDLOADER_START;
periph_init();
if (0 != display_init()) {
@ -160,9 +160,9 @@ int main(void)
display_clear();
display_backlight(255);
DPRINTLN("TREZOR Bootloader " VERSION_STR);
DPRINTLN("=================");
DPRINTLN("starting bootloader");
DPRINTLN("TREZOR Boardloader " VERSION_STR);
DPRINTLN("==================");
DPRINTLN("starting boardloader");
if (check_sdcard()) {
if (!copy_sdcard()) {

@ -3,10 +3,10 @@
#include <stdint.h>
#define BOOTLOADER_START 0x08000000
#define LOADER_START 0x08010000
#define FIRMWARE_START 0x08020000
#define HEADER_SIZE 0x200
#define BOARDLOADER_START 0x08000000
#define LOADER_START 0x08010000
#define FIRMWARE_START 0x08020000
#define HEADER_SIZE 0x200
void periph_init(void);

Loading…
Cancel
Save