Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Makefile.app_params
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ endif
APP_LOAD_PARAMS = --targetId $(TARGET_ID)
APP_LOAD_PARAMS += --targetVersion="$(TARGET_VERSION)"
APP_LOAD_PARAMS += --apiLevel $(API_LEVEL)
APP_LOAD_PARAMS += --fileName bin/app.hex
APP_LOAD_PARAMS += --fileName $(BIN_DIR)/app.hex
APP_LOAD_PARAMS += --appName $(APPNAME)
ifneq ($(APP_FLAGS_APP_LOAD_PARAMS),)
APP_LOAD_PARAMS += --appFlags $(lastword $(APP_FLAGS_APP_LOAD_PARAMS))
endif
APP_LOAD_PARAMS += --delete
APP_LOAD_PARAMS += --tlv
APP_LOAD_PARAMS += --dataSize $$((0x`cat debug/app.map | grep _envram_data | tr -s ' ' | cut -f2 -d' ' |cut -f2 -d'x' ` - 0x`cat debug/app.map | grep _nvram_data | tr -s ' ' | cut -f2 -d' ' | cut -f2 -d'x'`))
APP_LOAD_PARAMS += --installparamsSize $$((0x`cat debug/app.map | grep _einstall_parameters | tr -s ' ' | cut -f2 -d' ' |cut -f2 -d'x'` - 0x`cat debug/app.map | grep _install_parameters | tr -s ' ' | cut -f2 -d' ' |cut -f2 -d'x'`))
APP_LOAD_PARAMS += --dataSize $$((0x`cat $(DBG_DIR)/app.map | grep _envram_data | tr -s ' ' | cut -f2 -d' ' |cut -f2 -d'x' ` - 0x`cat $(DBG_DIR)/app.map | grep _nvram_data | tr -s ' ' | cut -f2 -d' ' | cut -f2 -d'x'`))
APP_LOAD_PARAMS += --installparamsSize $$((0x`cat $(DBG_DIR)/app.map | grep _einstall_parameters | tr -s ' ' | cut -f2 -d' ' |cut -f2 -d'x'` - 0x`cat $(DBG_DIR)/app.map | grep _install_parameters | tr -s ' ' | cut -f2 -d' ' |cut -f2 -d'x'`))

ifeq ($(ENABLE_NOCRC_APP_LOAD_PARAMS), 1)
APP_LOAD_PARAMS += --nocrc
Expand Down
33 changes: 5 additions & 28 deletions Makefile.rules_generic
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ listinfo:
@echo SDK_HASH=$(SDK_HASH)

clean:
rm -fr $(BUILD_DIR) bin debug
rm -fr $(BUILD_DIR)

clean_target:
rm -fr $(TARGET_BUILD_DIR) $(TARGET_SCAN_DIR)
Expand All @@ -69,7 +69,7 @@ BUILD_DEPENDENCIES += $(APP_CUSTOM_BUILD_DEPENDENCIES)

prepare:
$(L)echo Prepare directories
@mkdir -p $(BIN_DIR) $(OBJ_DIR) $(OBJECTS_DIR) $(DBG_DIR) $(DEP_DIR) $(DEPEND_DIR) $(GEN_SRC_DIR) bin debug
@mkdir -p $(BIN_DIR) $(OBJ_DIR) $(OBJECTS_DIR) $(DBG_DIR) $(DEP_DIR) $(DEPEND_DIR) $(GEN_SRC_DIR)

$(BUILD_DEPENDENCIES): prepare

Expand All @@ -80,10 +80,9 @@ $(APP_USE_CASES):
@$(MAKE) --no-print-directory $(call get_flags_for_use_case,$@)
endif

BIN_TARGETS := bin/app.elf bin/app.apdu bin/app.sha256 bin/app.hex
DBG_TARGETS := debug/app.map debug/app.asm
BIN_TARGETS := $(BIN_DIR)/app.apdu

default: $(BIN_TARGETS) $(DBG_TARGETS)
default: $(BIN_TARGETS)

# Glyphs target
$(GEN_SRC_DIR)/%.o: $(GEN_SRC_DIR)/%.c $(BUILD_DEPENDENCIES) prepare
Expand Down Expand Up @@ -158,31 +157,9 @@ $(BIN_DIR)/app.elf: $(LINK_DEPENDENCIES)
$(L)$(GCCPATH)arm-none-eabi-objcopy -O ihex -S $(BIN_DIR)/app.elf $(BIN_DIR)/app.hex
$(L)$(GCCPATH)arm-none-eabi-objdump -S -d $(BIN_DIR)/app.elf > $(DBG_DIR)/app.asm

# This targets are generated along $(OBJ_DIR)/app.elf but we can't make them co-target
# otherwise building with `make -j` fails due to multiple threads running simultaneously
# this target while it needs to be run only once.
$(BIN_DIR)/app.hex $(DBG_DIR)/app.map $(DBG_DIR)/app.asm: $(BIN_DIR)/app.elf

$(BIN_DIR)/app.apdu: bin/app.hex debug/app.map
$(BIN_DIR)/app.apdu: $(BIN_DIR)/app.elf
$(L)python3 -m ledgerblue.loadApp $(APP_LOAD_PARAMS) --offline $(BIN_DIR)/app.apdu | grep "Application" | cut -f5 -d' ' > $(BIN_DIR)/app.sha256

# This target is generated along $(BIN_DIR)/app.apdu but we can't make them co-target
# otherwise building with `make -j` ends up with multiple threads running simultaneously
# this target while it needs to be run only once.
$(BIN_DIR)/app.sha256: $(BIN_DIR)/app.apdu

# Set PHONY to force the copy to bin in case we rebuild a previous TARGET
.PHONY: bin/app.elf bin/app.hex bin/app.apdu bin/app.sha256
bin/app.elf bin/app.hex bin/app.apdu bin/app.sha256: bin/app.%: $(BIN_DIR)/app.%
@echo "[CP] $< => $@"
$(L)cp $< $@

# Set PHONY to force the copy to debug in case we rebuild a previous TARGET
.PHONY: debug/app.map debug/app.asm
debug/app.map debug/app.asm: debug/app.%: $(DBG_DIR)/app.%
@echo "[CP] $< => $@"
$(L)cp $< $@

### BEGIN GCC COMPILER RULES

# link_cmdline(objects,dest) Macro that is used to format arguments for the linker
Expand Down
2 changes: 1 addition & 1 deletion include/ledger_assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
*
* 2/ An info containing the PC and LR of the instruction that failed.
* This can be used to locate the failing code and flow using the following
* command: `arm-none-eabi-addr2line --exe bin/app.elf -pf 0xC0DE586B`
* command: `arm-none-eabi-addr2line --exe build/<device>/bin/app.elf -pf 0xC0DE586B`
* => This is enabled when `LEDGER_ASSERT_CONFIG_LR_AND_PC_INFO` is defined.
*
* 3/ An info displaying the `LEDGER_ASSERT` message passed as parameter.
Expand Down
Loading