diff options
| -rw-r--r-- | examples/make.mk | 65 | ||||
| -rw-r--r-- | hw/bsp/fomu/board.mk | 3 | ||||
| -rw-r--r-- | hw/bsp/msp_exp430f5529lp/board.mk | 3 | ||||
| -rw-r--r-- | tools/build_all.py | 2 |
4 files changed, 34 insertions, 39 deletions
diff --git a/examples/make.mk b/examples/make.mk index 25b618896..5fc596f63 100644 --- a/examples/make.mk +++ b/examples/make.mk @@ -1,56 +1,45 @@ -# +# --------------------------------------- # Common make definition for all examples -# +# --------------------------------------- -# Compiler -ifeq ($(BOARD), msp_exp430f5529lp) - CROSS_COMPILE = msp430-elf- -else ifeq ($(BOARD), fomu) - CROSS_COMPILE = riscv-none-embed- -else - CROSS_COMPILE = arm-none-eabi- +#-------------- Select the board to build for. ------------ +BOARD_LIST = $(sort $(subst /.,,$(subst $(TOP)/hw/bsp/,,$(wildcard $(TOP)/hw/bsp/*/.)))) + +ifeq ($(filter $(BOARD),$(BOARD_LIST)),) + $(info You must provide a BOARD parameter with 'BOARD=', supported boards are:) + $(foreach b,$(BOARD_LIST),$(info - $(b))) + $(error Invalid BOARD specified) endif -CC = $(CROSS_COMPILE)gcc -CXX = $(CROSS_COMPILE)g++ -OBJCOPY = $(CROSS_COMPILE)objcopy -SIZE = $(CROSS_COMPILE)size -MKDIR = mkdir -SED = sed -CP = cp -RM = rm -PYTHON ?= python +# Handy check parameter function check_defined = \ $(strip $(foreach 1,$1, \ $(call __check_defined,$1,$(strip $(value 2))))) __check_defined = \ $(if $(value $1),, \ $(error Undefined make flag: $1$(if $2, ($2)))) - - -define newline - - -endef - -# Select the board to build for. -ifeq ($(BOARD),) - $(info You must provide a BOARD parameter with 'BOARD=') - $(info Supported boards are:) - $(info $(sort $(subst /.,,$(subst $(TOP)/hw/bsp/, $(newline)-,$(wildcard $(TOP)/hw/bsp/*/.))))) - $(error BOARD not defined) -else - ifeq ($(wildcard $(TOP)/hw/bsp/$(BOARD)/.),) - $(error Invalid BOARD specified) - endif -endif - + # Build directory BUILD = _build/build-$(BOARD) -# Board specific +# Board specific define include $(TOP)/hw/bsp/$(BOARD)/board.mk +#-------------- Cross Compiler ------------ +# Can be set by board, default to ARM GCC +CROSS_COMPILE ?= arm-none-eabi- + +CC = $(CROSS_COMPILE)gcc +CXX = $(CROSS_COMPILE)g++ +OBJCOPY = $(CROSS_COMPILE)objcopy +SIZE = $(CROSS_COMPILE)size +MKDIR = mkdir +SED = sed +CP = cp +RM = rm + +#-------------- Source files and compiler flags -------------- + # Include all source C in board folder SRC_C += hw/bsp/board.c SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/hw/bsp/$(BOARD)/*.c)) diff --git a/hw/bsp/fomu/board.mk b/hw/bsp/fomu/board.mk index b824b6979..403a7fb95 100644 --- a/hw/bsp/fomu/board.mk +++ b/hw/bsp/fomu/board.mk @@ -5,6 +5,9 @@ CFLAGS += \ -nostdlib \ -DCFG_TUSB_MCU=OPT_MCU_VALENTYUSB_EPTRI +# Cross Compiler for RISC-V +CROSS_COMPILE = riscv-none-embed- + MCU_DIR = hw/mcu/fomu BSP_DIR = hw/bsp/fomu diff --git a/hw/bsp/msp_exp430f5529lp/board.mk b/hw/bsp/msp_exp430f5529lp/board.mk index 13e3b7217..8e857eb66 100644 --- a/hw/bsp/msp_exp430f5529lp/board.mk +++ b/hw/bsp/msp_exp430f5529lp/board.mk @@ -6,6 +6,9 @@ CFLAGS += \ #-mmcu=msp430f5529 +# Cross Compiler for MSP430 +CROSS_COMPILE = msp430-elf- + # All source paths should be relative to the top level. LD_FILE = hw/mcu/ti/msp430/msp430-gcc-support-files/include/msp430f5529.ld LDINC += $(TOP)/hw/mcu/ti/msp430/msp430-gcc-support-files/include diff --git a/tools/build_all.py b/tools/build_all.py index 08964bb76..0437bcaac 100644 --- a/tools/build_all.py +++ b/tools/build_all.py @@ -88,7 +88,7 @@ for example in all_examples: fail_count += 1 build_duration = time.monotonic() - start_time - print(build_format.format(example, board, success, "{:.2f}".format(build_duration), flash_size, sram_size)) + print(build_format.format(example, board, success, "{:.2f}s".format(build_duration), flash_size, sram_size)) if build_result.returncode != 0: print(build_result.stdout.decode("utf-8")) |
