From 7bb2c63fc44d77418dfc2542d28fa370222de404 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Wed, 19 Apr 2017 23:11:31 +0200 Subject: [PATCH] build: makefile cleanup - part 2 --- Makefile.boardloader | 34 +++++++++++++++------------------- Makefile.bootloader | 36 ++++++++++++++++-------------------- Makefile.firmware | 10 +++++----- 3 files changed, 36 insertions(+), 44 deletions(-) diff --git a/Makefile.boardloader b/Makefile.boardloader index fdf2b9e6e..3defd9806 100644 --- a/Makefile.boardloader +++ b/Makefile.boardloader @@ -16,14 +16,23 @@ BUILD_MP = $(BUILD)/$(SRCDIR_MP) BUILD_FW = $(BUILD)/$(SRCDIR_FW) BUILD_HDR = $(BUILD)/genhdr +CFLAGS_MOD += \ + -I$(SRCDIR_FW)/extmod/modtrezorcrypto/trezor-crypto \ + -I$(SRCDIR_FW)/extmod/modtrezorcrypto/trezor-crypto/ed25519-donna \ + -DAES_128 \ + -DAES_192 \ + -DUSE_KECCAK=1 \ + -DED25519_NO_PRECOMP=1 \ + -Wno-sequence-point + # OBJ vendor/micropython -OBJ_MP += $(addprefix $(BUILD_MP)/,\ +OBJ_MICROPYTHON += $(addprefix $(BUILD_MP)/,\ lib/libc/string0.o \ stmhal/startup_stm32.o \ ) # OBJ vendor/micropython -OBJ_HAL += $(addprefix $(BUILD_MP)/,\ +OBJ_STMHAL += $(addprefix $(BUILD_MP)/,\ stmhal/hal/f4/src/stm32f4xx_hal_adc_ex.o \ stmhal/hal/f4/src/stm32f4xx_hal_adc.o \ stmhal/hal/f4/src/stm32f4xx_hal_can.o \ @@ -57,6 +66,9 @@ OBJ_HAL += $(addprefix $(BUILD_MP)/,\ # OBJ micropython/ OBJ_BOARDLOADER += $(addprefix $(BUILD_FW)/, \ boardloader/main.o \ + extmod/modtrezorcrypto/trezor-crypto/ed25519-donna/ed25519.o \ + extmod/modtrezorcrypto/trezor-crypto/blake2s.o \ + extmod/modtrezorcrypto/trezor-crypto/sha2.o \ extmod/modtrezorui/display.o \ extmod/modtrezorui/font_bitmap.o \ ) @@ -72,22 +84,7 @@ OBJ_TREZORHAL += $(addprefix $(BUILD_FW)/, \ trezorhal/hal/stm32f4xx_ll_fsmc.o \ ) -# OBJ micropython/extmod/modtrezorcrypto -CFLAGS_MOD += \ - -I$(SRCDIR_FW)/extmod/modtrezorcrypto/trezor-crypto \ - -I$(SRCDIR_FW)/extmod/modtrezorcrypto/trezor-crypto/ed25519-donna \ - -DAES_128 \ - -DAES_192 \ - -DUSE_KECCAK=1 \ - -DED25519_NO_PRECOMP=1 \ - -Wno-sequence-point - -OBJ_MOD += \ - $(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/ed25519-donna/ed25519.o \ - $(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/blake2s.o \ - $(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/sha2.o \ - -OBJ = $(OBJ_MOD) $(OBJ_MP) $(OBJ_HAL) $(OBJ_TREZORHAL) +OBJ = $(OBJ_MICROPYTHON) $(OBJ_STMHAL) $(OBJ_TREZORHAL) OBJ += $(OBJ_BOARDLOADER) # comp flags @@ -116,7 +113,6 @@ endif CFLAGS += $(INC) $(CFLAGS_MOD) $(CFLAGS_EXTRA) CFLAGS += -std=gnu99 -nostdlib -Wall -Werror -Wdouble-promotion -Wpointer-arith CFLAGS += -mthumb -mtune=cortex-m4 -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant - CFLAGS += -DSTM32F405xx -DMCU_SERIES_F4 CFLAGS += -DSTM32_HAL_H='' CFLAGS += -DTREZOR_STM32 diff --git a/Makefile.bootloader b/Makefile.bootloader index 688c4dd46..b9387ef04 100644 --- a/Makefile.bootloader +++ b/Makefile.bootloader @@ -16,14 +16,23 @@ BUILD_MP = $(BUILD)/$(SRCDIR_MP) BUILD_FW = $(BUILD)/$(SRCDIR_FW) BUILD_HDR = $(BUILD)/genhdr +CFLAGS_MOD += \ + -I$(SRCDIR_FW)/extmod/modtrezorcrypto/trezor-crypto \ + -I$(SRCDIR_FW)/extmod/modtrezorcrypto/trezor-crypto/ed25519-donna \ + -DAES_128 \ + -DAES_192 \ + -DUSE_KECCAK=1 \ + -DED25519_NO_PRECOMP=1 \ + -Wno-sequence-point + # OBJ vendor/micropython -OBJ_MP += $(addprefix $(BUILD_MP)/,\ - stmhal/startup_stm32.o \ +OBJ_MICROPYTHON += $(addprefix $(BUILD_MP)/,\ lib/libc/string0.o \ + stmhal/startup_stm32.o \ ) # OBJ vendor/micropython -OBJ_HAL += $(addprefix $(BUILD_MP)/,\ +OBJ_STMHAL += $(addprefix $(BUILD_MP)/,\ stmhal/hal/f4/src/stm32f4xx_hal_adc_ex.o \ stmhal/hal/f4/src/stm32f4xx_hal_adc.o \ stmhal/hal/f4/src/stm32f4xx_hal_can.o \ @@ -60,6 +69,9 @@ OBJ_BOOTLOADER += $(addprefix $(BUILD_FW)/, \ bootloader/main.o \ bootloader/messages.o \ bootloader/protobuf.o \ + extmod/modtrezorcrypto/trezor-crypto/ed25519-donna/ed25519.o \ + extmod/modtrezorcrypto/trezor-crypto/blake2s.o \ + extmod/modtrezorcrypto/trezor-crypto/sha2.o \ extmod/modtrezorui/display.o \ extmod/modtrezorui/inflate.o \ extmod/modtrezorui/font_bitmap.o \ @@ -84,22 +96,7 @@ OBJ_TREZORHAL += $(addprefix $(BUILD_FW)/, \ trezorhal/hal/stm32f4xx_ll_fsmc.o \ ) -# OBJ micropython/extmod/modtrezorcrypto -CFLAGS_MOD += \ - -I$(SRCDIR_FW)/extmod/modtrezorcrypto/trezor-crypto \ - -I$(SRCDIR_FW)/extmod/modtrezorcrypto/trezor-crypto/ed25519-donna \ - -DAES_128 \ - -DAES_192 \ - -DUSE_KECCAK=1 \ - -DED25519_NO_PRECOMP=1 \ - -Wno-sequence-point - -OBJ_MOD += \ - $(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/ed25519-donna/ed25519.o \ - $(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/blake2s.o \ - $(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/sha2.o \ - -OBJ = $(OBJ_MOD) $(OBJ_MP) $(OBJ_HAL) $(OBJ_TREZORHAL) +OBJ = $(OBJ_MICROPYTHON) $(OBJ_STMHAL) $(OBJ_TREZORHAL) OBJ += $(OBJ_BOOTLOADER) # comp flags @@ -128,7 +125,6 @@ endif CFLAGS += $(INC) $(CFLAGS_MOD) $(CFLAGS_EXTRA) CFLAGS += -std=gnu99 -nostdlib -Wall -Werror -Wdouble-promotion -Wpointer-arith CFLAGS += -mthumb -mtune=cortex-m4 -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant - CFLAGS += -DSTM32F405xx -DMCU_SERIES_F4 CFLAGS += -DSTM32_HAL_H='' CFLAGS += -DTREZOR_STM32 diff --git a/Makefile.firmware b/Makefile.firmware index 5d9d1fd5b..ecbb1ac50 100644 --- a/Makefile.firmware +++ b/Makefile.firmware @@ -120,7 +120,7 @@ OBJ_MOD += $(addprefix $(BUILD_FW)/,\ endif # OBJ vendor/micropython -OBJ_MP += $(addprefix $(BUILD_MP)/,\ +OBJ_MICROPYTHON += $(addprefix $(BUILD_MP)/,\ \ extmod/modubinascii.o \ extmod/moductypes.o \ @@ -275,7 +275,7 @@ OBJ_MP += $(addprefix $(BUILD_MP)/,\ ) # OBJ vendor/micropython -OBJ_HAL += $(addprefix $(BUILD_MP)/,\ +OBJ_STMHAL += $(addprefix $(BUILD_MP)/,\ stmhal/hal/f4/src/stm32f4xx_hal_adc_ex.o \ stmhal/hal/f4/src/stm32f4xx_hal_adc.o \ stmhal/hal/f4/src/stm32f4xx_hal_can.o \ @@ -335,10 +335,11 @@ OBJ_TREZORHAL += $(addprefix $(BUILD_FW)/, \ FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR) -type f -name '*.py' | $(SED) -e 's=^$(FROZEN_MPY_DIR)/==') FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/frozen_mpy/,$(FROZEN_MPY_PY_FILES:.py=.mpy)) -OBJ = $(OBJ_MOD) $(OBJ_MP) $(OBJ_HAL) $(OBJ_TREZORHAL) +OBJ = $(OBJ_MICROPYTHON) $(OBJ_STMHAL) $(OBJ_TREZORHAL) +OBJ += $(OBJ_MOD) OBJ += $(OBJ_FIRMWARE) OBJ += $(BUILD)/frozen_mpy.o -SRC_MP = $(patsubst $(BUILD_MP)%.o, $(SRCDIR_MP)%.c, $(OBJ_MP)) +SRC_MP = $(patsubst $(BUILD_MP)%.o, $(SRCDIR_MP)%.c, $(OBJ_MICROPYTHON)) SRC_MOD = $(patsubst $(BUILD_FW)%.o, $(SRCDIR_FW)%.c, $(OBJ_MOD)) # comp flags @@ -367,7 +368,6 @@ endif CFLAGS += $(INC) $(CFLAGS_MOD) $(CFLAGS_EXTRA) CFLAGS += -std=gnu99 -nostdlib -Wall -Werror -Wdouble-promotion -Wpointer-arith CFLAGS += -mthumb -mtune=cortex-m4 -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant - CFLAGS += -DSTM32F405xx -DMCU_SERIES_F4 CFLAGS += -DSTM32_HAL_H='' CFLAGS += -DTREZOR_STM32