1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-25 08:58:14 +00:00

legacy: fix firmware build in CI with MEMORY_PROTECT=0

This commit is contained in:
Pavol Rusnak 2019-08-28 15:51:27 +02:00
parent 4cbbc3da64
commit fc1f90875b
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
4 changed files with 16 additions and 4 deletions

View File

@ -108,6 +108,8 @@ build crypto:
# TODO: add clang https://github.com/trezor/trezor-firmware/issues/44
build legacy firmware:
stage: build
variables:
MEMORY_PROTECT: "0"
script:
- cd legacy
- pipenv run script/cibuild
@ -123,6 +125,7 @@ build legacy firmware debug:
stage: build
variables:
DEBUG_LINK: "1"
MEMORY_PROTECT: "0"
script:
- cd legacy
- pipenv run script/cibuild
@ -131,6 +134,7 @@ build legacy firmware bitcoinonly:
stage: build
variables:
BITCOIN_ONLY: "1"
MEMORY_PROTECT: "0"
script:
- cd legacy
- pipenv run script/cibuild

View File

@ -136,9 +136,11 @@ endif
ifeq ($(MEMORY_PROTECT), 0)
CFLAGS += -DMEMORY_PROTECT=0
CPUFLAGS += -DMEMORY_PROTECT=0
$(info MEMORY_PROTECT=0)
else
CFLAGS += -DMEMORY_PROTECT=1
CPUFLAGS += -DMEMORY_PROTECT=1
$(info MEMORY_PROTECT=1)
endif
@ -194,9 +196,9 @@ $(NAME).elf: $(OBJS) $(LDSCRIPT) $(LIBDEPS)
@printf " LD $@\n"
$(Q)$(LD) -o $(NAME).elf $(OBJS) $(LDLIBS) $(LDFLAGS)
%.o: %.s Makefile
%.o: %.S Makefile
@printf " AS $@\n"
$(Q)$(AS) $(CPUFLAGS) -o $@ $<
$(Q)$(CC) $(CPUFLAGS) -o $@ -c $<
%.o: %.c Makefile
@printf " CC $@\n"

View File

@ -26,6 +26,8 @@
#include "memory.h"
#include "util.h"
#if MEMORY_PROTECT
static int known_bootloader(int r, const uint8_t *hash) {
if (r != 32) return 0;
if (0 ==
@ -126,6 +128,7 @@ static int known_bootloader(int r, const uint8_t *hash) {
return 1; // 1.8.0 shipped with fw 1.8.0 and 1.8.1
return 0;
}
#endif
void check_bootloader(void) {
#if MEMORY_PROTECT

View File

@ -19,6 +19,8 @@ memset_reg:
.global reset_handler
.type reset_handler, STT_FUNC
reset_handler:
#if MEMORY_PROTECT
// we need to perform this in case an old bootloader
// is starting the new firmware, these will be set incorrectly
ldr r0, =0xE000ED08 // r0 = VTOR address
@ -28,6 +30,7 @@ reset_handler:
msr msp, r0 // set stack pointer
dsb
isb
#endif
ldr r0, =_ram_start // r0 - point to beginning of SRAM
ldr r1, =_ram_end // r1 - point to byte after the end of SRAM