mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-29 02:48:18 +00:00
legacy: fix firmware build in CI with MEMORY_PROTECT=0
This commit is contained in:
parent
4cbbc3da64
commit
fc1f90875b
@ -108,6 +108,8 @@ build crypto:
|
|||||||
# TODO: add clang https://github.com/trezor/trezor-firmware/issues/44
|
# TODO: add clang https://github.com/trezor/trezor-firmware/issues/44
|
||||||
build legacy firmware:
|
build legacy firmware:
|
||||||
stage: build
|
stage: build
|
||||||
|
variables:
|
||||||
|
MEMORY_PROTECT: "0"
|
||||||
script:
|
script:
|
||||||
- cd legacy
|
- cd legacy
|
||||||
- pipenv run script/cibuild
|
- pipenv run script/cibuild
|
||||||
@ -123,6 +125,7 @@ build legacy firmware debug:
|
|||||||
stage: build
|
stage: build
|
||||||
variables:
|
variables:
|
||||||
DEBUG_LINK: "1"
|
DEBUG_LINK: "1"
|
||||||
|
MEMORY_PROTECT: "0"
|
||||||
script:
|
script:
|
||||||
- cd legacy
|
- cd legacy
|
||||||
- pipenv run script/cibuild
|
- pipenv run script/cibuild
|
||||||
@ -131,6 +134,7 @@ build legacy firmware bitcoinonly:
|
|||||||
stage: build
|
stage: build
|
||||||
variables:
|
variables:
|
||||||
BITCOIN_ONLY: "1"
|
BITCOIN_ONLY: "1"
|
||||||
|
MEMORY_PROTECT: "0"
|
||||||
script:
|
script:
|
||||||
- cd legacy
|
- cd legacy
|
||||||
- pipenv run script/cibuild
|
- pipenv run script/cibuild
|
||||||
|
@ -135,10 +135,12 @@ CFLAGS += -DU2F_ENABLED=1
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(MEMORY_PROTECT), 0)
|
ifeq ($(MEMORY_PROTECT), 0)
|
||||||
CFLAGS += -DMEMORY_PROTECT=0
|
CFLAGS += -DMEMORY_PROTECT=0
|
||||||
|
CPUFLAGS += -DMEMORY_PROTECT=0
|
||||||
$(info MEMORY_PROTECT=0)
|
$(info MEMORY_PROTECT=0)
|
||||||
else
|
else
|
||||||
CFLAGS += -DMEMORY_PROTECT=1
|
CFLAGS += -DMEMORY_PROTECT=1
|
||||||
|
CPUFLAGS += -DMEMORY_PROTECT=1
|
||||||
$(info MEMORY_PROTECT=1)
|
$(info MEMORY_PROTECT=1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -194,9 +196,9 @@ $(NAME).elf: $(OBJS) $(LDSCRIPT) $(LIBDEPS)
|
|||||||
@printf " LD $@\n"
|
@printf " LD $@\n"
|
||||||
$(Q)$(LD) -o $(NAME).elf $(OBJS) $(LDLIBS) $(LDFLAGS)
|
$(Q)$(LD) -o $(NAME).elf $(OBJS) $(LDLIBS) $(LDFLAGS)
|
||||||
|
|
||||||
%.o: %.s Makefile
|
%.o: %.S Makefile
|
||||||
@printf " AS $@\n"
|
@printf " AS $@\n"
|
||||||
$(Q)$(AS) $(CPUFLAGS) -o $@ $<
|
$(Q)$(CC) $(CPUFLAGS) -o $@ -c $<
|
||||||
|
|
||||||
%.o: %.c Makefile
|
%.o: %.c Makefile
|
||||||
@printf " CC $@\n"
|
@printf " CC $@\n"
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
#if MEMORY_PROTECT
|
||||||
|
|
||||||
static int known_bootloader(int r, const uint8_t *hash) {
|
static int known_bootloader(int r, const uint8_t *hash) {
|
||||||
if (r != 32) return 0;
|
if (r != 32) return 0;
|
||||||
if (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 1; // 1.8.0 shipped with fw 1.8.0 and 1.8.1
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void check_bootloader(void) {
|
void check_bootloader(void) {
|
||||||
#if MEMORY_PROTECT
|
#if MEMORY_PROTECT
|
||||||
|
@ -19,6 +19,8 @@ memset_reg:
|
|||||||
.global reset_handler
|
.global reset_handler
|
||||||
.type reset_handler, STT_FUNC
|
.type reset_handler, STT_FUNC
|
||||||
reset_handler:
|
reset_handler:
|
||||||
|
|
||||||
|
#if MEMORY_PROTECT
|
||||||
// we need to perform this in case an old bootloader
|
// we need to perform this in case an old bootloader
|
||||||
// is starting the new firmware, these will be set incorrectly
|
// is starting the new firmware, these will be set incorrectly
|
||||||
ldr r0, =0xE000ED08 // r0 = VTOR address
|
ldr r0, =0xE000ED08 // r0 = VTOR address
|
||||||
@ -28,6 +30,7 @@ reset_handler:
|
|||||||
msr msp, r0 // set stack pointer
|
msr msp, r0 // set stack pointer
|
||||||
dsb
|
dsb
|
||||||
isb
|
isb
|
||||||
|
#endif
|
||||||
|
|
||||||
ldr r0, =_ram_start // r0 - point to beginning of SRAM
|
ldr r0, =_ram_start // r0 - point to beginning of SRAM
|
||||||
ldr r1, =_ram_end // r1 - point to byte after the end of SRAM
|
ldr r1, =_ram_end // r1 - point to byte after the end of SRAM
|
Loading…
Reference in New Issue
Block a user