Skip to content

Commit

Permalink
Merge pull request #804 from LedgerHQ/clean/apa/assembler_arguments
Browse files Browse the repository at this point in the history
Cleaned up arguments passed to the assembler
  • Loading branch information
apaillier-ledger authored Oct 17, 2024
2 parents 67320f0 + 639b629 commit a85986c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
6 changes: 2 additions & 4 deletions Makefile.defines
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ CFLAGS += -fropi
CFLAGS += -fno-jump-tables # avoid jump tables for switch to avoid problems with invalid PIC access
CFLAGS += -nostdlib -nodefaultlibs

AFLAGS += -fno-common

LDFLAGS += -fomit-frame-pointer
LDFLAGS += -Wall
LDFLAGS += -fno-common -ffunction-sections -fdata-sections -fwhole-program
Expand All @@ -90,7 +88,7 @@ LDFLAGS += -Wl,--gc-sections -Wl,-Map,$(DBG_DIR)/app.map
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOS))
CFLAGS += --target=armv6m-none-eabi -mthumb
CFLAGS += -mcpu=cortex-m0plus -mthumb -mtune=cortex-m0plus
AFLAGS += -mcpu=cortex-m0plus -mtune=cortex-m0plus -mthumb
AFLAGS += -mcpu=cortex-m0plus -mthumb
LDFLAGS += -mcpu=cortex-m0plus -mthumb
LDFLAGS += -nostartfiles --specs=nano.specs
endif
Expand All @@ -104,7 +102,7 @@ LDFLAGS += -mtune=cortex-m0plus -mlittle-endian -mcpu=cortex-m0plus
LDFLAGS += -nostdlib -nodefaultlibs #-nostartfiles
LDFLAGS += -mno-movt
LDFLAGS += -L$(BOLOS_SDK)/arch/st33/lib/
AFLAGS += -mcpu=cortex-m0plus -mtune=cortex-m0plus -mthumb
AFLAGS += -mcpu=cortex-m0plus -mthumb
endif

ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_STAX TARGET_FLEX TARGET_NANOS2))
Expand Down
14 changes: 7 additions & 7 deletions Makefile.rules_generic
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ $(OBJ_DIR)/app/%.o: $(APP_DIR)/%.c $(BUILD_DEPENDENCIES) prepare

$(OBJ_DIR)/app/%.o: $(APP_DIR)/%.s $(BUILD_DEPENDENCIES) prepare
@echo "[AS] $@"
$(L)$(call as_cmdline,$(INCLUDES_PATH), $(DEFINES),$<,$@)
$(L)$(call as_cmdline,$(INCLUDES_PATH),$<,$@)

$(OBJ_DIR)/app/%.o: $(APP_DIR)/%.S $(BUILD_DEPENDENCIES) prepare
@echo "[AS] $@"
$(L)$(call as_cmdline,$(INCLUDES_PATH), $(DEFINES),$<,$@)
$(L)$(call as_cmdline,$(INCLUDES_PATH),$<,$@)

# SDK files targets
$(OBJ_DIR)/sdk/%.o: $(BOLOS_SDK)/%.c $(BUILD_DEPENDENCIES) prepare
Expand All @@ -105,11 +105,11 @@ $(OBJ_DIR)/sdk/%.o: $(BOLOS_SDK)/%.c $(BUILD_DEPENDENCIES) prepare

$(OBJ_DIR)/sdk/%.o: $(BOLOS_SDK)/%.s $(BUILD_DEPENDENCIES) prepare
@echo "[AS] $@"
$(L)$(call as_cmdline,$(INCLUDES_PATH), $(DEFINES),$<,$@)
$(L)$(call as_cmdline,$(INCLUDES_PATH),$<,$@)

$(OBJ_DIR)/sdk/%.o: $(BOLOS_SDK)/%.S $(BUILD_DEPENDENCIES) prepare
@echo "[AS] $@"
$(L)$(call as_cmdline,$(INCLUDES_PATH), $(DEFINES),$<,$@)
$(L)$(call as_cmdline,$(INCLUDES_PATH),$<,$@)

# Generic targets
$(OBJ_DIR)/%.o: %.c $(BUILD_DEPENDENCIES) prepare
Expand All @@ -118,11 +118,11 @@ $(OBJ_DIR)/%.o: %.c $(BUILD_DEPENDENCIES) prepare

$(OBJ_DIR)/%.o: %.s $(BUILD_DEPENDENCIES) prepare
@echo "[AS] $@"
$(L)$(call as_cmdline,$(INCLUDES_PATH), $(DEFINES),$<,$@)
$(L)$(call as_cmdline,$(INCLUDES_PATH),$<,$@)

$(OBJ_DIR)/%.o: %.S $(BUILD_DEPENDENCIES) prepare
@echo "[AS] $@"
$(L)$(call as_cmdline,$(INCLUDES_PATH), $(DEFINES),$<,$@)
$(L)$(call as_cmdline,$(INCLUDES_PATH),$<,$@)

ifeq (,$(filter $(DEFINES),BOLOS_OS_UPGRADER_APP))
ifneq ($(SCRIPT_LD),)
Expand Down Expand Up @@ -197,7 +197,7 @@ endif
# dependency files are generated along the object file
cc_cmdline = $(CC) -c $(CFLAGS) -MMD -MT $(4) -MF $(subst $(OBJ_DIR), $(DEP_DIR), $(addsuffix .d, $(basename $(4)))) $(addprefix -D,$(2)) $(addprefix -I,$(1)) -o $(4) $(3)

as_cmdline = $(AS) -c $(AFLAGS) $(addprefix -D,$(2)) $(addprefix -I,$(1)) -o $(4) $(3)
as_cmdline = $(AS) -c $(AFLAGS) $(addprefix -I,$(1)) -o $(3) $(2)

### END GCC COMPILER RULES

Expand Down
2 changes: 1 addition & 1 deletion Makefile.standard_app
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ CC := $(CLANGPATH)clang
AS := $(CLANGPATH)clang
LD := $(CLANGPATH)clang
ifeq ($(AS),$(CLANGPATH)clang)
AFLAGS += --target=arm-arm-none-eabi -Wno-unused-command-line-argument
AFLAGS += --target=arm-arm-none-eabi
endif
LDLIBS += -lm -lgcc -lc

Expand Down

0 comments on commit a85986c

Please sign in to comment.