diff --git a/Makefile.defines b/Makefile.defines index a51b14b8..ac40acec 100644 --- a/Makefile.defines +++ b/Makefile.defines @@ -42,11 +42,16 @@ ifeq ($(CC),) CC = clang endif -SYSROOT = $(shell $(GCCPATH)arm-none-eabi-gcc -print-sysroot) -ifeq ($(SYSROOT),) -CFLAGS += -I/usr/include -else -CFLAGS += --sysroot="$(SYSROOT)" +TOOL_PREFIX ?= arm-none-eabi- +USE_SYSROOT ?= 1 + +ifneq ($(USE_SYSROOT),) +SYSROOT = $(shell $(GCCPATH)$(TOOL_PREFIX)gcc -print-sysroot) + ifeq ($(SYSROOT),) + CFLAGS += -I/usr/include + else + CFLAGS += --sysroot="$(SYSROOT)" + endif endif CFLAGS += -gdwarf-2 -gstrict-dwarf @@ -116,7 +121,14 @@ ifeq ($(CLANGPATH),) $(info CLANGPATH is not set: clang will be used from PATH) endif ifeq ($(GCCPATH),) -$(info GCCPATH is not set: arm-none-eabi-* will be used from PATH) +$(info GCCPATH is not set: $(TOOL_PREFIX)* will be used from PATH) +endif + +ifeq ($(OBJCOPY),) +OBJCOPY = $(GCCPATH)$(TOOL_PREFIX)objcopy +endif +ifeq ($(OBJDUMP),) +OBJDUMP = $(GCCPATH)$(TOOL_PREFIX)objdump endif # define the default makefile target (high in include to avoid glyph.h or what not specific target to be the default one when no target passed on the make command line) diff --git a/Makefile.rules_generic b/Makefile.rules_generic index dd17b600..02f5d128 100644 --- a/Makefile.rules_generic +++ b/Makefile.rules_generic @@ -77,9 +77,9 @@ LDFLAGS += -T$(SCRIPT_LD) bin/app.elf: $(OBJECT_FILES) $(SCRIPT_LD) @echo "[LINK] $@" $(L)$(call link_cmdline,$(OBJECT_FILES) $(LDLIBS),$@) - $(L)$(GCCPATH)arm-none-eabi-objcopy -O ihex -S bin/app.elf bin/app.hex + $(L)$(OBJCOPY) -O ihex -S bin/app.elf bin/app.hex $(L)cp bin/app.elf obj - $(L)$(GCCPATH)arm-none-eabi-objdump -S -d bin/app.elf > debug/app.asm + $(L)$(OBJDUMP) -S -d bin/app.elf > debug/app.asm bin/app.apdu bin/app.sha256: bin/app.elf $(L)python3 -m ledgerblue.loadApp $(APP_LOAD_PARAMS) --offline bin/app.apdu | grep "Application" | cut -f5 -d' ' > bin/app.sha256