From 05306ad79dfb9132b7a10bf3e039852146c85072 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Thu, 13 Apr 2017 23:30:32 +0200 Subject: [PATCH] build: bring makefiles closer --- Makefile.boardloader | 8 ++++---- Makefile.bootloader | 6 +++--- Makefile.firmware | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile.boardloader b/Makefile.boardloader index 38ba26b64..0ff07d1da 100644 --- a/Makefile.boardloader +++ b/Makefile.boardloader @@ -3,8 +3,8 @@ SRCDIR_MP = vendor/micropython SRCDIR_FW = micropython # target directory -BUILD ?= micropython/boardloader/build TARGET ?= boardloader +BUILD ?= micropython/$(TARGET)/build # include py core make definitions include $(SRCDIR_MP)/py/mkenv.mk @@ -95,7 +95,7 @@ SRC_MOD = $(patsubst $(BUILD_FW)%.o, $(SRCDIR_FW)%.c, $(OBJ_MOD)) CROSS_COMPILE = arm-none-eabi- INC += -I. -INC += -I$(SRCDIR_FW)/boardloader +INC += -I$(SRCDIR_FW)/$(TARGET) INC += -I$(SRCDIR_FW)/extmod/modtrezorui INC += -I$(SRCDIR_FW)/trezorhal INC += -I$(SRCDIR_FW)/trezorhal/hal @@ -121,7 +121,7 @@ CFLAGS += -DSTM32_HAL_H='' LIBS = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) -LDFLAGS = -nostdlib -T $(SRCDIR_FW)/boardloader/memory.ld -Map=$@.map --cref +LDFLAGS = -nostdlib -T $(SRCDIR_FW)/$(TARGET)/memory.ld -Map=$@.map --cref # remove uncalled code from the final image CFLAGS += -fdata-sections -ffunction-sections @@ -138,7 +138,7 @@ $(BUILD)/$(TARGET).elf: $(OBJ) $(Q)$(SIZE) $@ $(BUILD)/$(TARGET).bin: $(BUILD)/$(TARGET).elf - $(Q)$(OBJCOPY) -O binary -j .flash -j .data $^ $(BUILD)/$(TARGET).bin + $(Q)$(OBJCOPY) -O binary -j .header -j .flash -j .data $^ $(BUILD)/$(TARGET).bin $(BUILD)/%.o: %.S $(ECHO) "CC $<" diff --git a/Makefile.bootloader b/Makefile.bootloader index 652fa3edb..6486b47ca 100644 --- a/Makefile.bootloader +++ b/Makefile.bootloader @@ -3,8 +3,8 @@ SRCDIR_MP = vendor/micropython SRCDIR_FW = micropython # target directory -BUILD ?= micropython/bootloader/build TARGET ?= bootloader +BUILD ?= micropython/$(TARGET)/build # include py core make definitions include $(SRCDIR_MP)/py/mkenv.mk @@ -106,7 +106,7 @@ SRC_MOD = $(patsubst $(BUILD_FW)%.o, $(SRCDIR_FW)%.c, $(OBJ_MOD)) CROSS_COMPILE = arm-none-eabi- INC += -I. -INC += -I$(SRCDIR_FW)/bootloader +INC += -I$(SRCDIR_FW)/$(TARGET) INC += -I$(SRCDIR_FW)/extmod/modtrezorui INC += -I$(SRCDIR_FW)/trezorhal INC += -I$(SRCDIR_FW)/trezorhal/hal @@ -132,7 +132,7 @@ CFLAGS += -DSTM32_HAL_H='' LIBS = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) -LDFLAGS = -nostdlib -T $(SRCDIR_FW)/bootloader/memory.ld -Map=$@.map --cref +LDFLAGS = -nostdlib -T $(SRCDIR_FW)/$(TARGET)/memory.ld -Map=$@.map --cref # remove uncalled code from the final image CFLAGS += -fdata-sections -ffunction-sections diff --git a/Makefile.firmware b/Makefile.firmware index 80e8017ae..c0b556bc4 100644 --- a/Makefile.firmware +++ b/Makefile.firmware @@ -6,8 +6,8 @@ SRCDIR_FW = micropython FROZEN_MPY_DIR ?= src # target directory -BUILD ?= micropython/firmware/build TARGET ?= firmware +BUILD ?= micropython/$(TARGET)/build # include py core make definitions include $(SRCDIR_MP)/py/mkenv.mk @@ -333,7 +333,7 @@ SRC_MOD = $(patsubst $(BUILD_FW)%.o, $(SRCDIR_FW)%.c, $(OBJ_MOD)) CROSS_COMPILE = arm-none-eabi- INC += -I. -INC += -I$(SRCDIR_FW)/firmware +INC += -I$(SRCDIR_FW)/$(TARGET) INC += -I$(SRCDIR_FW)/extmod/modtrezorui INC += -I$(SRCDIR_FW)/trezorhal INC += -I$(SRCDIR_FW)/trezorhal/hal @@ -362,7 +362,7 @@ CFLAGS += -DMICROPY_MODULE_FROZEN_MPY LIBS = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) -LDFLAGS = -nostdlib -T $(SRCDIR_FW)/firmware/memory.ld -Map=$@.map --cref +LDFLAGS = -nostdlib -T $(SRCDIR_FW)/$(TARGET)/memory.ld -Map=$@.map --cref # remove uncalled code from the final image CFLAGS += -fdata-sections -ffunction-sections