From 0e585570a38d4bd04bc907386ef7012f6e9222a9 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 25 Jan 2021 23:40:52 +0700 Subject: [PATCH 1/8] rename build output --- examples/make.mk | 10 +++++++++- tools/build_board.py | 4 ++-- tools/build_esp32s2.py | 4 ++-- tools/build_family.py | 4 ++-- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/examples/make.mk b/examples/make.mk index da0f60d2f..556b0c41a 100644 --- a/examples/make.mk +++ b/examples/make.mk @@ -3,7 +3,7 @@ # --------------------------------------- # Build directory -BUILD = _build/build-$(BOARD) +BUILD = _build/$(BOARD) # Handy check parameter function check_defined = \ @@ -13,6 +13,12 @@ __check_defined = \ $(if $(value $1),, \ $(error Undefined make flag: $1$(if $2, ($2)))) +# TODO Check if submodule haven't checkout yet +fetch_submodule_if_empty = \ + ifeq ($(wildcard $(TOP)/$1/*),) \ + $(info $(shell git -C $(TOP) submodule update --init)) \ + endif + #-------------- Select the board to build for. ------------ #BOARD_LIST = $(sort $(subst /.,,$(subst $(TOP)/hw/bsp/,,$(wildcard $(TOP)/hw/bsp/*/.)))) #ifeq ($(filter $(BOARD),$(BOARD_LIST)),) @@ -45,6 +51,8 @@ else SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/$(FAMILY_PATH)/*.c)) endif +#TODO $(call fetch_submodule_if_empty,lib/sct_neopixel) + #-------------- Cross Compiler ------------ # Can be set by board, default to ARM GCC CROSS_COMPILE ?= arm-none-eabi- diff --git a/tools/build_board.py b/tools/build_board.py index 464ee68cf..9397c754f 100644 --- a/tools/build_board.py +++ b/tools/build_board.py @@ -74,8 +74,8 @@ def build_board(example, board): print(build_result.stdout.decode("utf-8")) def build_size(example, board): - #elf_file = 'examples/device/{}/_build/build-{}/{}-firmware.elf'.format(example, board, board) - elf_file = 'examples/{}/_build/build-{}/*.elf'.format(example, board) + #elf_file = 'examples/device/{}/_build/{}/{}-firmware.elf'.format(example, board, board) + elf_file = 'examples/{}/_build/{}/*.elf'.format(example, board) size_output = subprocess.run('size {}'.format(elf_file), shell=True, stdout=subprocess.PIPE).stdout.decode("utf-8") size_list = size_output.split('\n')[1].split('\t') flash_size = int(size_list[0]) diff --git a/tools/build_esp32s2.py b/tools/build_esp32s2.py index 9823e8c53..6580b6562 100644 --- a/tools/build_esp32s2.py +++ b/tools/build_esp32s2.py @@ -72,8 +72,8 @@ def build_board(example, board): print(build_result.stdout.decode("utf-8")) def build_size(example, board): - #elf_file = 'examples/device/{}/_build/build-{}/{}-firmware.elf'.format(example, board, board) - elf_file = 'examples/device/{}/_build/build-{}/*.elf'.format(example, board) + #elf_file = 'examples/device/{}/_build/{}/{}-firmware.elf'.format(example, board, board) + elf_file = 'examples/device/{}/_build/{}/*.elf'.format(example, board) size_output = subprocess.run('size {}'.format(elf_file), shell=True, stdout=subprocess.PIPE).stdout.decode("utf-8") size_list = size_output.split('\n')[1].split('\t') flash_size = int(size_list[0]) diff --git a/tools/build_family.py b/tools/build_family.py index ae1bf078d..4ef7201ed 100644 --- a/tools/build_family.py +++ b/tools/build_family.py @@ -85,8 +85,8 @@ def build_board(example, board): print(build_result.stdout.decode("utf-8")) def build_size(example, board): - #elf_file = 'examples/device/{}/_build/build-{}/{}-firmware.elf'.format(example, board, board) - elf_file = 'examples/{}/_build/build-{}/*.elf'.format(example, board) + #elf_file = 'examples/device/{}/_build/{}/{}-firmware.elf'.format(example, board, board) + elf_file = 'examples/{}/_build/{}/*.elf'.format(example, board) size_output = subprocess.run('size {}'.format(elf_file), shell=True, stdout=subprocess.PIPE).stdout.decode("utf-8") size_list = size_output.split('\n')[1].split('\t') flash_size = int(size_list[0]) From 4a0f5cbd6332a9ae76dc2eea293024fab2c81885 Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 26 Jan 2021 12:46:24 +0700 Subject: [PATCH 2/8] change output filename to BOARD-Directory --- examples/device/audio_test/CMakeLists.txt | 3 ++- examples/device/board_test/CMakeLists.txt | 1 + examples/device/cdc_dual_ports/CMakeLists.txt | 1 + examples/device/cdc_msc/CMakeLists.txt | 1 + .../device/cdc_msc_freertos/CMakeLists.txt | 14 +++++------ examples/device/dfu_rt/CMakeLists.txt | 1 + .../dynamic_configuration/CMakeLists.txt | 1 + examples/device/hid_composite/CMakeLists.txt | 1 + .../hid_composite_freertos/CMakeLists.txt | 14 +++++------ .../device/hid_generic_inout/CMakeLists.txt | 1 + .../hid_multiple_interface/CMakeLists.txt | 1 + examples/device/midi_test/CMakeLists.txt | 1 + examples/device/msc_dual_lun/CMakeLists.txt | 1 + .../device/net_lwip_webserver/CMakeLists.txt | 1 + examples/device/uac2_headset/CMakeLists.txt | 1 + examples/device/usbtmc/CMakeLists.txt | 1 + examples/device/webusb_serial/CMakeLists.txt | 1 + examples/make.mk | 1 + examples/rules.mk | 23 +++++++++++-------- hw/bsp/da14695_dk_usb/board.mk | 4 ++-- hw/bsp/da1469x_dk_pro/board.mk | 4 ++-- hw/bsp/double_m33_express/board.mk | 2 +- hw/bsp/fomu/board.mk | 4 ++-- hw/bsp/imxrt/boards/teensy_40/board.mk | 2 +- hw/bsp/lpcxpresso11u37/board.mk | 2 +- hw/bsp/lpcxpresso11u68/board.mk | 2 +- hw/bsp/lpcxpresso51u68/board.mk | 2 +- hw/bsp/lpcxpresso54114/board.mk | 2 +- hw/bsp/lpcxpresso55s69/board.mk | 2 +- hw/bsp/mbed1768/board.mk | 2 +- hw/bsp/msp_exp430f5529lp/board.mk | 4 ++-- hw/bsp/nrf/boards/adafruit_clue/board.mk | 4 ++-- hw/bsp/nrf/boards/arduino_nano33_ble/board.mk | 2 +- .../circuitplayground_bluefruit/board.mk | 4 ++-- .../boards/feather_nrf52840_express/board.mk | 4 ++-- .../boards/feather_nrf52840_sense/board.mk | 4 ++-- hw/bsp/nrf/boards/itsybitsy_nrf52840/board.mk | 4 ++-- .../nrf/boards/nrf52840_mdk_dongle/board.mk | 4 ++-- hw/bsp/nrf/boards/pca10059/board.mk | 4 ++-- hw/bsp/nutiny_nuc121s/board.mk | 2 +- hw/bsp/nutiny_nuc125s/board.mk | 2 +- hw/bsp/nutiny_nuc126v/board.mk | 2 +- hw/bsp/nutiny_sdk_nuc120/board.mk | 2 +- hw/bsp/nutiny_sdk_nuc505/board.mk | 2 +- hw/bsp/samd11_xplained/board.mk | 2 +- hw/bsp/samd21/boards/luna/board.mk | 2 +- hw/bsp/samd21/family.mk | 2 +- hw/bsp/samd51/family.mk | 2 +- hw/bsp/same70_xplained/board.mk | 2 +- hw/bsp/samg55xplained/board.mk | 2 +- hw/bsp/spresense/board.mk | 8 +++---- hw/bsp/stm32f103bluepill/board.mk | 2 +- .../stm32f4/boards/feather_stm32f405/board.mk | 2 +- .../boards/stm32f401blackpill/board.mk | 2 +- .../boards/stm32f411blackpill/board.mk | 2 +- hw/bsp/stm32l0538disco/board.mk | 2 +- hw/bsp/stm32l476disco/board.mk | 2 +- 57 files changed, 96 insertions(+), 77 deletions(-) diff --git a/examples/device/audio_test/CMakeLists.txt b/examples/device/audio_test/CMakeLists.txt index 99ee77bd3..645d57157 100644 --- a/examples/device/audio_test/CMakeLists.txt +++ b/examples/device/audio_test/CMakeLists.txt @@ -1,5 +1,6 @@ -# use directory name for project id +# use BOARD-Directory name for project id get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME) +set(PROJECT ${BOARD}-${PROJECT}) # TOP is absolute path to root directory of TinyUSB git repo set(TOP "../../..") diff --git a/examples/device/board_test/CMakeLists.txt b/examples/device/board_test/CMakeLists.txt index 68577ba73..573f026f3 100644 --- a/examples/device/board_test/CMakeLists.txt +++ b/examples/device/board_test/CMakeLists.txt @@ -1,5 +1,6 @@ # use directory name for project id get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME) +set(PROJECT ${BOARD}-${PROJECT}) # TOP is absolute path to root directory of TinyUSB git repo set(TOP "../../..") diff --git a/examples/device/cdc_dual_ports/CMakeLists.txt b/examples/device/cdc_dual_ports/CMakeLists.txt index 99ee77bd3..c358eddab 100644 --- a/examples/device/cdc_dual_ports/CMakeLists.txt +++ b/examples/device/cdc_dual_ports/CMakeLists.txt @@ -1,5 +1,6 @@ # use directory name for project id get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME) +set(PROJECT ${BOARD}-${PROJECT}) # TOP is absolute path to root directory of TinyUSB git repo set(TOP "../../..") diff --git a/examples/device/cdc_msc/CMakeLists.txt b/examples/device/cdc_msc/CMakeLists.txt index 7f5d5a998..5f4d9ba4e 100644 --- a/examples/device/cdc_msc/CMakeLists.txt +++ b/examples/device/cdc_msc/CMakeLists.txt @@ -1,5 +1,6 @@ # use directory name for project id get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME) +set(PROJECT ${BOARD}-${PROJECT}) # TOP is absolute path to root directory of TinyUSB git repo set(TOP "../../..") diff --git a/examples/device/cdc_msc_freertos/CMakeLists.txt b/examples/device/cdc_msc_freertos/CMakeLists.txt index 2e55d8c47..dabb4bc80 100644 --- a/examples/device/cdc_msc_freertos/CMakeLists.txt +++ b/examples/device/cdc_msc_freertos/CMakeLists.txt @@ -1,18 +1,18 @@ cmake_minimum_required(VERSION 3.5) -# use directory name for project id +# use BOARD-Directory name for project id get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME) +set(PROJECT ${BOARD}-${PROJECT}) # TOP is absolute path to root directory of TinyUSB git repo set(TOP "../../..") get_filename_component(TOP "${TOP}" REALPATH) # Check for -DFAMILY= -if(NOT DEFINED FAMILY) +if(FAMILY STREQUAL "esp32s2") + include(${TOP}/hw/bsp/${FAMILY}/family.cmake) + project(${PROJECT}) + +else() message(FATAL_ERROR "Invalid FAMILY specified") endif() - -include(${TOP}/hw/bsp/${FAMILY}/family.cmake) -project(${PROJECT}) - -project(cdc_msc_freertos) diff --git a/examples/device/dfu_rt/CMakeLists.txt b/examples/device/dfu_rt/CMakeLists.txt index 99ee77bd3..c358eddab 100644 --- a/examples/device/dfu_rt/CMakeLists.txt +++ b/examples/device/dfu_rt/CMakeLists.txt @@ -1,5 +1,6 @@ # use directory name for project id get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME) +set(PROJECT ${BOARD}-${PROJECT}) # TOP is absolute path to root directory of TinyUSB git repo set(TOP "../../..") diff --git a/examples/device/dynamic_configuration/CMakeLists.txt b/examples/device/dynamic_configuration/CMakeLists.txt index f26465729..a759e56e8 100644 --- a/examples/device/dynamic_configuration/CMakeLists.txt +++ b/examples/device/dynamic_configuration/CMakeLists.txt @@ -1,5 +1,6 @@ # use directory name for project id get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME) +set(PROJECT ${BOARD}-${PROJECT}) # TOP is absolute path to root directory of TinyUSB git repo set(TOP "../../..") diff --git a/examples/device/hid_composite/CMakeLists.txt b/examples/device/hid_composite/CMakeLists.txt index 99ee77bd3..c358eddab 100644 --- a/examples/device/hid_composite/CMakeLists.txt +++ b/examples/device/hid_composite/CMakeLists.txt @@ -1,5 +1,6 @@ # use directory name for project id get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME) +set(PROJECT ${BOARD}-${PROJECT}) # TOP is absolute path to root directory of TinyUSB git repo set(TOP "../../..") diff --git a/examples/device/hid_composite_freertos/CMakeLists.txt b/examples/device/hid_composite_freertos/CMakeLists.txt index c4777f122..dabb4bc80 100644 --- a/examples/device/hid_composite_freertos/CMakeLists.txt +++ b/examples/device/hid_composite_freertos/CMakeLists.txt @@ -1,18 +1,18 @@ cmake_minimum_required(VERSION 3.5) -# use directory name for project id +# use BOARD-Directory name for project id get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME) +set(PROJECT ${BOARD}-${PROJECT}) # TOP is absolute path to root directory of TinyUSB git repo set(TOP "../../..") get_filename_component(TOP "${TOP}" REALPATH) # Check for -DFAMILY= -if(NOT DEFINED FAMILY) +if(FAMILY STREQUAL "esp32s2") + include(${TOP}/hw/bsp/${FAMILY}/family.cmake) + project(${PROJECT}) + +else() message(FATAL_ERROR "Invalid FAMILY specified") endif() - -include(${TOP}/hw/bsp/${FAMILY}/family.cmake) -project(${PROJECT}) - -project(hid_composite_freertos) diff --git a/examples/device/hid_generic_inout/CMakeLists.txt b/examples/device/hid_generic_inout/CMakeLists.txt index 99ee77bd3..c358eddab 100644 --- a/examples/device/hid_generic_inout/CMakeLists.txt +++ b/examples/device/hid_generic_inout/CMakeLists.txt @@ -1,5 +1,6 @@ # use directory name for project id get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME) +set(PROJECT ${BOARD}-${PROJECT}) # TOP is absolute path to root directory of TinyUSB git repo set(TOP "../../..") diff --git a/examples/device/hid_multiple_interface/CMakeLists.txt b/examples/device/hid_multiple_interface/CMakeLists.txt index 99ee77bd3..c358eddab 100644 --- a/examples/device/hid_multiple_interface/CMakeLists.txt +++ b/examples/device/hid_multiple_interface/CMakeLists.txt @@ -1,5 +1,6 @@ # use directory name for project id get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME) +set(PROJECT ${BOARD}-${PROJECT}) # TOP is absolute path to root directory of TinyUSB git repo set(TOP "../../..") diff --git a/examples/device/midi_test/CMakeLists.txt b/examples/device/midi_test/CMakeLists.txt index 99ee77bd3..c358eddab 100644 --- a/examples/device/midi_test/CMakeLists.txt +++ b/examples/device/midi_test/CMakeLists.txt @@ -1,5 +1,6 @@ # use directory name for project id get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME) +set(PROJECT ${BOARD}-${PROJECT}) # TOP is absolute path to root directory of TinyUSB git repo set(TOP "../../..") diff --git a/examples/device/msc_dual_lun/CMakeLists.txt b/examples/device/msc_dual_lun/CMakeLists.txt index 084565400..f0e050f9c 100644 --- a/examples/device/msc_dual_lun/CMakeLists.txt +++ b/examples/device/msc_dual_lun/CMakeLists.txt @@ -1,5 +1,6 @@ # use directory name for project id get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME) +set(PROJECT ${BOARD}-${PROJECT}) # TOP is absolute path to root directory of TinyUSB git repo set(TOP "../../..") diff --git a/examples/device/net_lwip_webserver/CMakeLists.txt b/examples/device/net_lwip_webserver/CMakeLists.txt index 695dd7c59..ec4996086 100644 --- a/examples/device/net_lwip_webserver/CMakeLists.txt +++ b/examples/device/net_lwip_webserver/CMakeLists.txt @@ -1,5 +1,6 @@ # use directory name for project id get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME) +set(PROJECT ${BOARD}-${PROJECT}) # TOP is absolute path to root directory of TinyUSB git repo set(TOP "../../..") diff --git a/examples/device/uac2_headset/CMakeLists.txt b/examples/device/uac2_headset/CMakeLists.txt index 99ee77bd3..c358eddab 100644 --- a/examples/device/uac2_headset/CMakeLists.txt +++ b/examples/device/uac2_headset/CMakeLists.txt @@ -1,5 +1,6 @@ # use directory name for project id get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME) +set(PROJECT ${BOARD}-${PROJECT}) # TOP is absolute path to root directory of TinyUSB git repo set(TOP "../../..") diff --git a/examples/device/usbtmc/CMakeLists.txt b/examples/device/usbtmc/CMakeLists.txt index 03bb04389..686e8dc2d 100644 --- a/examples/device/usbtmc/CMakeLists.txt +++ b/examples/device/usbtmc/CMakeLists.txt @@ -1,5 +1,6 @@ # use directory name for project id get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME) +set(PROJECT ${BOARD}-${PROJECT}) # TOP is absolute path to root directory of TinyUSB git repo set(TOP "../../..") diff --git a/examples/device/webusb_serial/CMakeLists.txt b/examples/device/webusb_serial/CMakeLists.txt index 99ee77bd3..c358eddab 100644 --- a/examples/device/webusb_serial/CMakeLists.txt +++ b/examples/device/webusb_serial/CMakeLists.txt @@ -1,5 +1,6 @@ # use directory name for project id get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME) +set(PROJECT ${BOARD}-${PROJECT}) # TOP is absolute path to root directory of TinyUSB git repo set(TOP "../../..") diff --git a/examples/make.mk b/examples/make.mk index 556b0c41a..329efa774 100644 --- a/examples/make.mk +++ b/examples/make.mk @@ -4,6 +4,7 @@ # Build directory BUILD = _build/$(BOARD) +PROJECT = $(BOARD)-$(notdir $(CURDIR)) # Handy check parameter function check_defined = \ diff --git a/examples/rules.mk b/examples/rules.mk index ab0373bac..12ec35043 100644 --- a/examples/rules.mk +++ b/examples/rules.mk @@ -43,6 +43,9 @@ all: clean: $(RM) -rf $(BUILD) +#copy-artifact: +# @$(CP) + else # GNU Make build system @@ -100,9 +103,9 @@ endif # Set all as default goal .DEFAULT_GOAL := all -all: $(BUILD)/$(BOARD)-firmware.bin $(BUILD)/$(BOARD)-firmware.hex size +all: $(BUILD)/$(PROJECT).bin $(BUILD)/$(PROJECT).hex size -uf2: $(BUILD)/$(BOARD)-firmware.uf2 +uf2: $(BUILD)/$(PROJECT).uf2 OBJ_DIRS = $(sort $(dir $(OBJ))) $(OBJ): | $(OBJ_DIRS) @@ -113,20 +116,20 @@ else @$(MKDIR) -p $@ endif -$(BUILD)/$(BOARD)-firmware.elf: $(OBJ) +$(BUILD)/$(PROJECT).elf: $(OBJ) @echo LINK $@ @$(CC) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(LIBS) -Wl,--end-group -$(BUILD)/$(BOARD)-firmware.bin: $(BUILD)/$(BOARD)-firmware.elf +$(BUILD)/$(PROJECT).bin: $(BUILD)/$(PROJECT).elf @echo CREATE $@ @$(OBJCOPY) -O binary $^ $@ -$(BUILD)/$(BOARD)-firmware.hex: $(BUILD)/$(BOARD)-firmware.elf +$(BUILD)/$(PROJECT).hex: $(BUILD)/$(PROJECT).elf @echo CREATE $@ @$(OBJCOPY) -O ihex $^ $@ UF2_FAMILY ?= 0x00 -$(BUILD)/$(BOARD)-firmware.uf2: $(BUILD)/$(BOARD)-firmware.hex +$(BUILD)/$(PROJECT).uf2: $(BUILD)/$(PROJECT).hex @echo CREATE $@ $(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f $(UF2_FAMILY) -c -o $@ $^ @@ -150,7 +153,7 @@ $(BUILD)/obj/%.o: %.S @echo AS $(notdir $@) @$(CC) -x assembler-with-cpp $(ASFLAGS) -c -o $@ $< -size: $(BUILD)/$(BOARD)-firmware.elf +size: $(BUILD)/$(PROJECT).elf -@echo '' @$(SIZE) $< -@echo '' @@ -178,7 +181,7 @@ endif JLINK_IF ?= swd # Flash using jlink -flash-jlink: $(BUILD)/$(BOARD)-firmware.hex +flash-jlink: $(BUILD)/$(PROJECT).hex @echo halt > $(BUILD)/$(BOARD).jlink @echo r > $(BUILD)/$(BOARD).jlink @echo loadfile $^ >> $(BUILD)/$(BOARD).jlink @@ -188,11 +191,11 @@ flash-jlink: $(BUILD)/$(BOARD)-firmware.hex $(JLINKEXE) -device $(JLINK_DEVICE) -if $(JLINK_IF) -JTAGConf -1,-1 -speed auto -CommandFile $(BUILD)/$(BOARD).jlink # flash STM32 MCU using stlink with STM32 Cube Programmer CLI -flash-stlink: $(BUILD)/$(BOARD)-firmware.elf +flash-stlink: $(BUILD)/$(PROJECT).elf STM32_Programmer_CLI --connect port=swd --write $< --go # flash with pyocd -flash-pyocd: $(BUILD)/$(BOARD)-firmware.hex +flash-pyocd: $(BUILD)/$(PROJECT).hex pyocd flash -t $(PYOCD_TARGET) $< pyocd reset -t $(PYOCD_TARGET) diff --git a/hw/bsp/da14695_dk_usb/board.mk b/hw/bsp/da14695_dk_usb/board.mk index b097262dc..2e76012d2 100644 --- a/hw/bsp/da14695_dk_usb/board.mk +++ b/hw/bsp/da14695_dk_usb/board.mk @@ -42,10 +42,10 @@ JLINK_DEVICE = DA14695 # flash using jlink but with some twists flash: flash-dialog -flash-dialog: $(BUILD)/$(BOARD)-firmware.bin +flash-dialog: $(BUILD)/$(PROJECT).bin @echo '#define SW_VERSION "v_1.0.0.1"' >$(BUILD)/version.h @echo '#define SW_VERSION_DATE "'`date +"%Y-%m-%d %H:%M"`'"' >>$(BUILD)/version.h - mkimage da1469x $(BUILD)/$(BOARD)-firmware.bin $(BUILD)/version.h $^.img + mkimage da1469x $(BUILD)/$(PROJECT).bin $(BUILD)/version.h $^.img cp $(TOP)/hw/bsp/$(BOARD)/product_header.dump $(BUILD)/$(BOARD)-image.bin cat $^.img >> $(BUILD)/$(BOARD)-image.bin @echo r > $(BUILD)/$(BOARD).jlink diff --git a/hw/bsp/da1469x_dk_pro/board.mk b/hw/bsp/da1469x_dk_pro/board.mk index 16bd6de6b..52064e63c 100644 --- a/hw/bsp/da1469x_dk_pro/board.mk +++ b/hw/bsp/da1469x_dk_pro/board.mk @@ -42,10 +42,10 @@ JLINK_DEVICE = DA14699 # flash using jlink but with some twists flash: flash-dialog -flash-dialog: $(BUILD)/$(BOARD)-firmware.bin +flash-dialog: $(BUILD)/$(PROJECT).bin @echo '#define SW_VERSION "v_1.0.0.1"' >$(BUILD)/version.h @echo '#define SW_VERSION_DATE "'`date +"%Y-%m-%d %H:%M"`'"' >>$(BUILD)/version.h - mkimage da1469x $(BUILD)/$(BOARD)-firmware.bin $(BUILD)/version.h $^.img + mkimage da1469x $(BUILD)/$(PROJECT).bin $(BUILD)/version.h $^.img cp $(TOP)/hw/bsp/$(BOARD)/product_header.dump $(BUILD)/$(BOARD)-image.bin cat $^.img >> $(BUILD)/$(BOARD)-image.bin @echo r > $(BUILD)/$(BOARD).jlink diff --git a/hw/bsp/double_m33_express/board.mk b/hw/bsp/double_m33_express/board.mk index c3401e5b2..5757aa5cd 100644 --- a/hw/bsp/double_m33_express/board.mk +++ b/hw/bsp/double_m33_express/board.mk @@ -51,5 +51,5 @@ FREERTOS_PORT = ARM_CM33_NTZ/non_secure JLINK_DEVICE = LPC55S69 # flash using pyocd -flash: $(BUILD)/$(BOARD)-firmware.hex +flash: $(BUILD)/$(PROJECT).hex pyocd flash -t LPC55S69 $< diff --git a/hw/bsp/fomu/board.mk b/hw/bsp/fomu/board.mk index 70fb66975..f31dfec2a 100644 --- a/hw/bsp/fomu/board.mk +++ b/hw/bsp/fomu/board.mk @@ -27,9 +27,9 @@ CHIP_FAMILY = eptri FREERTOS_PORT = RISC-V # flash using dfu-util -$(BUILD)/$(BOARD)-firmware.dfu: $(BUILD)/$(BOARD)-firmware.bin +$(BUILD)/$(PROJECT).dfu: $(BUILD)/$(PROJECT).bin @echo "Create $@" python $(TOP)/hw/bsp/$(BOARD)/dfu.py -b $^ -D 0x1209:0x5bf0 $@ -flash: $(BUILD)/$(BOARD)-firmware.dfu +flash: $(BUILD)/$(PROJECT).dfu dfu-util -D $^ diff --git a/hw/bsp/imxrt/boards/teensy_40/board.mk b/hw/bsp/imxrt/boards/teensy_40/board.mk index 02f77193f..0ad5ea5c0 100644 --- a/hw/bsp/imxrt/boards/teensy_40/board.mk +++ b/hw/bsp/imxrt/boards/teensy_40/board.mk @@ -6,5 +6,5 @@ JLINK_DEVICE = MIMXRT1062xxx6A # flash by using teensy_loader_cli https://github.com/PaulStoffregen/teensy_loader_cli # Make sure it is in your PATH -flash: $(BUILD)/$(BOARD)-firmware.hex +flash: $(BUILD)/$(PROJECT).hex teensy_loader_cli --mcu=imxrt1062 -v -w $< diff --git a/hw/bsp/lpcxpresso11u37/board.mk b/hw/bsp/lpcxpresso11u37/board.mk index d34125ac7..441e5215d 100644 --- a/hw/bsp/lpcxpresso11u37/board.mk +++ b/hw/bsp/lpcxpresso11u37/board.mk @@ -42,5 +42,5 @@ FREERTOS_PORT = ARM_CM0 JLINK_DEVICE = LPC11U37/401 # flash using pyocd -flash: $(BUILD)/$(BOARD)-firmware.hex +flash: $(BUILD)/$(PROJECT).hex pyocd flash -t lpc11u37 $< diff --git a/hw/bsp/lpcxpresso11u68/board.mk b/hw/bsp/lpcxpresso11u68/board.mk index 67124ab90..53d809cfc 100644 --- a/hw/bsp/lpcxpresso11u68/board.mk +++ b/hw/bsp/lpcxpresso11u68/board.mk @@ -39,5 +39,5 @@ FREERTOS_PORT = ARM_CM0 JLINK_DEVICE = LPC11U68 # flash using pyocd -flash: $(BUILD)/$(BOARD)-firmware.hex +flash: $(BUILD)/$(PROJECT).hex pyocd flash -t lpc11u68 $< diff --git a/hw/bsp/lpcxpresso51u68/board.mk b/hw/bsp/lpcxpresso51u68/board.mk index cb36b3409..e5ff8242d 100644 --- a/hw/bsp/lpcxpresso51u68/board.mk +++ b/hw/bsp/lpcxpresso51u68/board.mk @@ -43,5 +43,5 @@ FREERTOS_PORT = ARM_CM0 JLINK_DEVICE = LPC51U68 # flash using pyocd (51u68 is not supported yet) -flash: $(BUILD)/$(BOARD)-firmware.hex +flash: $(BUILD)/$(PROJECT).hex pyocd flash -t LPC51U68 $< diff --git a/hw/bsp/lpcxpresso54114/board.mk b/hw/bsp/lpcxpresso54114/board.mk index cc0f6cd43..88f2bc734 100644 --- a/hw/bsp/lpcxpresso54114/board.mk +++ b/hw/bsp/lpcxpresso54114/board.mk @@ -45,5 +45,5 @@ FREERTOS_PORT = ARM_CM4F JLINK_DEVICE = LPC54114J256_M4 # flash using pyocd -flash: $(BUILD)/$(BOARD)-firmware.hex +flash: $(BUILD)/$(PROJECT).hex pyocd flash -t LPC54114 $< diff --git a/hw/bsp/lpcxpresso55s69/board.mk b/hw/bsp/lpcxpresso55s69/board.mk index f98144cc5..646ca2833 100644 --- a/hw/bsp/lpcxpresso55s69/board.mk +++ b/hw/bsp/lpcxpresso55s69/board.mk @@ -45,5 +45,5 @@ FREERTOS_PORT = ARM_CM33_NTZ/non_secure JLINK_DEVICE = LPC55S69 # flash using pyocd -flash: $(BUILD)/$(BOARD)-firmware.hex +flash: $(BUILD)/$(PROJECT).hex pyocd flash -t LPC55S69 $< diff --git a/hw/bsp/mbed1768/board.mk b/hw/bsp/mbed1768/board.mk index 54a8357cc..1b09a7f7a 100644 --- a/hw/bsp/mbed1768/board.mk +++ b/hw/bsp/mbed1768/board.mk @@ -41,6 +41,6 @@ FREERTOS_PORT = ARM_CM3 JLINK_DEVICE = LPC1768 # flash using pyocd -flash: $(BUILD)/$(BOARD)-firmware.hex +flash: $(BUILD)/$(PROJECT).hex pyocd flash -t lpc1768 $< diff --git a/hw/bsp/msp_exp430f5529lp/board.mk b/hw/bsp/msp_exp430f5529lp/board.mk index 8e857eb66..9fe8da274 100644 --- a/hw/bsp/msp_exp430f5529lp/board.mk +++ b/hw/bsp/msp_exp430f5529lp/board.mk @@ -28,9 +28,9 @@ endif # flash target using TI MSP430-Flasher # http://www.ti.com/tool/MSP430-FLASHER # Please add its installation dir to PATH -flash: $(BUILD)/$(BOARD)-firmware.hex +flash: $(BUILD)/$(PROJECT).hex MSP430Flasher -w $< -z [VCC] # flash target using mspdebug. -flash-mspdebug: $(BUILD)/$(BOARD)-firmware.elf +flash-mspdebug: $(BUILD)/$(PROJECT).elf $(MSPDEBUG) tilib "prog $<" --allow-fw-update diff --git a/hw/bsp/nrf/boards/adafruit_clue/board.mk b/hw/bsp/nrf/boards/adafruit_clue/board.mk index d8530dc74..f31899eb7 100644 --- a/hw/bsp/nrf/boards/adafruit_clue/board.mk +++ b/hw/bsp/nrf/boards/adafruit_clue/board.mk @@ -1,10 +1,10 @@ MCU_VARIANT = nrf52840 CFLAGS += -DNRF52840_XXAA -$(BUILD)/$(BOARD)-firmware.zip: $(BUILD)/$(BOARD)-firmware.hex +$(BUILD)/$(PROJECT).zip: $(BUILD)/$(PROJECT).hex adafruit-nrfutil dfu genpkg --dev-type 0x0052 --sd-req 0xFFFE --application $^ $@ # flash using adafruit-nrfutil dfu -flash: $(BUILD)/$(BOARD)-firmware.zip +flash: $(BUILD)/$(PROJECT).zip @:$(call check_defined, SERIAL, example: SERIAL=/dev/ttyACM0) adafruit-nrfutil --verbose dfu serial --package $^ -p $(SERIAL) -b 115200 --singlebank --touch 1200 diff --git a/hw/bsp/nrf/boards/arduino_nano33_ble/board.mk b/hw/bsp/nrf/boards/arduino_nano33_ble/board.mk index 7d8e9bce1..94babd821 100644 --- a/hw/bsp/nrf/boards/arduino_nano33_ble/board.mk +++ b/hw/bsp/nrf/boards/arduino_nano33_ble/board.mk @@ -8,6 +8,6 @@ LD_FILE = $(BOARD_PATH)/$(BOARD).ld # Add it to your PATH or change BOSSAC variable to match your installation BOSSAC = bossac -flash: $(BUILD)/$(BOARD)-firmware.bin +flash: $(BUILD)/$(PROJECT).bin @:$(call check_defined, SERIAL, example: SERIAL=/dev/ttyACM0) $(BOSSAC) --port=$(SERIAL) -U -i -e -w $^ -R diff --git a/hw/bsp/nrf/boards/circuitplayground_bluefruit/board.mk b/hw/bsp/nrf/boards/circuitplayground_bluefruit/board.mk index d8530dc74..f31899eb7 100644 --- a/hw/bsp/nrf/boards/circuitplayground_bluefruit/board.mk +++ b/hw/bsp/nrf/boards/circuitplayground_bluefruit/board.mk @@ -1,10 +1,10 @@ MCU_VARIANT = nrf52840 CFLAGS += -DNRF52840_XXAA -$(BUILD)/$(BOARD)-firmware.zip: $(BUILD)/$(BOARD)-firmware.hex +$(BUILD)/$(PROJECT).zip: $(BUILD)/$(PROJECT).hex adafruit-nrfutil dfu genpkg --dev-type 0x0052 --sd-req 0xFFFE --application $^ $@ # flash using adafruit-nrfutil dfu -flash: $(BUILD)/$(BOARD)-firmware.zip +flash: $(BUILD)/$(PROJECT).zip @:$(call check_defined, SERIAL, example: SERIAL=/dev/ttyACM0) adafruit-nrfutil --verbose dfu serial --package $^ -p $(SERIAL) -b 115200 --singlebank --touch 1200 diff --git a/hw/bsp/nrf/boards/feather_nrf52840_express/board.mk b/hw/bsp/nrf/boards/feather_nrf52840_express/board.mk index d8530dc74..f31899eb7 100644 --- a/hw/bsp/nrf/boards/feather_nrf52840_express/board.mk +++ b/hw/bsp/nrf/boards/feather_nrf52840_express/board.mk @@ -1,10 +1,10 @@ MCU_VARIANT = nrf52840 CFLAGS += -DNRF52840_XXAA -$(BUILD)/$(BOARD)-firmware.zip: $(BUILD)/$(BOARD)-firmware.hex +$(BUILD)/$(PROJECT).zip: $(BUILD)/$(PROJECT).hex adafruit-nrfutil dfu genpkg --dev-type 0x0052 --sd-req 0xFFFE --application $^ $@ # flash using adafruit-nrfutil dfu -flash: $(BUILD)/$(BOARD)-firmware.zip +flash: $(BUILD)/$(PROJECT).zip @:$(call check_defined, SERIAL, example: SERIAL=/dev/ttyACM0) adafruit-nrfutil --verbose dfu serial --package $^ -p $(SERIAL) -b 115200 --singlebank --touch 1200 diff --git a/hw/bsp/nrf/boards/feather_nrf52840_sense/board.mk b/hw/bsp/nrf/boards/feather_nrf52840_sense/board.mk index d8530dc74..f31899eb7 100644 --- a/hw/bsp/nrf/boards/feather_nrf52840_sense/board.mk +++ b/hw/bsp/nrf/boards/feather_nrf52840_sense/board.mk @@ -1,10 +1,10 @@ MCU_VARIANT = nrf52840 CFLAGS += -DNRF52840_XXAA -$(BUILD)/$(BOARD)-firmware.zip: $(BUILD)/$(BOARD)-firmware.hex +$(BUILD)/$(PROJECT).zip: $(BUILD)/$(PROJECT).hex adafruit-nrfutil dfu genpkg --dev-type 0x0052 --sd-req 0xFFFE --application $^ $@ # flash using adafruit-nrfutil dfu -flash: $(BUILD)/$(BOARD)-firmware.zip +flash: $(BUILD)/$(PROJECT).zip @:$(call check_defined, SERIAL, example: SERIAL=/dev/ttyACM0) adafruit-nrfutil --verbose dfu serial --package $^ -p $(SERIAL) -b 115200 --singlebank --touch 1200 diff --git a/hw/bsp/nrf/boards/itsybitsy_nrf52840/board.mk b/hw/bsp/nrf/boards/itsybitsy_nrf52840/board.mk index d8530dc74..f31899eb7 100644 --- a/hw/bsp/nrf/boards/itsybitsy_nrf52840/board.mk +++ b/hw/bsp/nrf/boards/itsybitsy_nrf52840/board.mk @@ -1,10 +1,10 @@ MCU_VARIANT = nrf52840 CFLAGS += -DNRF52840_XXAA -$(BUILD)/$(BOARD)-firmware.zip: $(BUILD)/$(BOARD)-firmware.hex +$(BUILD)/$(PROJECT).zip: $(BUILD)/$(PROJECT).hex adafruit-nrfutil dfu genpkg --dev-type 0x0052 --sd-req 0xFFFE --application $^ $@ # flash using adafruit-nrfutil dfu -flash: $(BUILD)/$(BOARD)-firmware.zip +flash: $(BUILD)/$(PROJECT).zip @:$(call check_defined, SERIAL, example: SERIAL=/dev/ttyACM0) adafruit-nrfutil --verbose dfu serial --package $^ -p $(SERIAL) -b 115200 --singlebank --touch 1200 diff --git a/hw/bsp/nrf/boards/nrf52840_mdk_dongle/board.mk b/hw/bsp/nrf/boards/nrf52840_mdk_dongle/board.mk index a184fa892..3afa234aa 100644 --- a/hw/bsp/nrf/boards/nrf52840_mdk_dongle/board.mk +++ b/hw/bsp/nrf/boards/nrf52840_mdk_dongle/board.mk @@ -7,9 +7,9 @@ LD_FILE = $(BOARD_PATH)/$(BOARD).ld # make BOARD=nrf52840_mdk_dongle SERIAL=/dev/ttyACM0 all flash NRFUTIL = nrfutil -$(BUILD)/$(BOARD)-firmware.zip: $(BUILD)/$(BOARD)-firmware.hex +$(BUILD)/$(PROJECT).zip: $(BUILD)/$(PROJECT).hex $(NRFUTIL) pkg generate --hw-version 52 --sd-req 0x0000 --debug-mode --application $^ $@ -flash: $(BUILD)/$(BOARD)-firmware.zip +flash: $(BUILD)/$(PROJECT).zip @:$(call check_defined, SERIAL, example: SERIAL=/dev/ttyACM0) $(NRFUTIL) dfu usb-serial --package $^ -p $(SERIAL) -b 115200 \ No newline at end of file diff --git a/hw/bsp/nrf/boards/pca10059/board.mk b/hw/bsp/nrf/boards/pca10059/board.mk index 25609f2fa..0b82ecdbb 100644 --- a/hw/bsp/nrf/boards/pca10059/board.mk +++ b/hw/bsp/nrf/boards/pca10059/board.mk @@ -7,9 +7,9 @@ LD_FILE = $(BOARD_PATH)/$(BOARD).ld # make BOARD=pca10059 SERIAL=/dev/ttyACM0 all flash NRFUTIL = nrfutil -$(BUILD)/$(BOARD)-firmware.zip: $(BUILD)/$(BOARD)-firmware.hex +$(BUILD)/$(PROJECT).zip: $(BUILD)/$(PROJECT).hex $(NRFUTIL) pkg generate --hw-version 52 --sd-req 0x0000 --debug-mode --application $^ $@ -flash: $(BUILD)/$(BOARD)-firmware.zip +flash: $(BUILD)/$(PROJECT).zip @:$(call check_defined, SERIAL, example: SERIAL=/dev/ttyACM0) $(NRFUTIL) dfu usb-serial --package $^ -p $(SERIAL) -b 115200 diff --git a/hw/bsp/nutiny_nuc121s/board.mk b/hw/bsp/nutiny_nuc121s/board.mk index 0a8b6e048..ce18a749c 100644 --- a/hw/bsp/nutiny_nuc121s/board.mk +++ b/hw/bsp/nutiny_nuc121s/board.mk @@ -52,5 +52,5 @@ JLINK_DEVICE = NUC121SC2AE # Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton # Please compile and install it from github source -flash: $(BUILD)/$(BOARD)-firmware.elf +flash: $(BUILD)/$(PROJECT).elf openocd -f interface/nulink.cfg -f target/numicroM0.cfg -c "program $< reset exit" diff --git a/hw/bsp/nutiny_nuc125s/board.mk b/hw/bsp/nutiny_nuc125s/board.mk index 31577d800..fe51b79d2 100644 --- a/hw/bsp/nutiny_nuc125s/board.mk +++ b/hw/bsp/nutiny_nuc125s/board.mk @@ -36,5 +36,5 @@ JLINK_DEVICE = NUC125SC2AE # Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton # Please compile and install it from github source -flash: $(BUILD)/$(BOARD)-firmware.elf +flash: $(BUILD)/$(PROJECT).elf openocd -f interface/nulink.cfg -f target/numicroM0.cfg -c "program $< reset exit" diff --git a/hw/bsp/nutiny_nuc126v/board.mk b/hw/bsp/nutiny_nuc126v/board.mk index 7bf3989fc..30cb3df03 100644 --- a/hw/bsp/nutiny_nuc126v/board.mk +++ b/hw/bsp/nutiny_nuc126v/board.mk @@ -56,5 +56,5 @@ JLINK_DEVICE = NUC126VG4AE # Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton # Please compile and install it from github source -flash: $(BUILD)/$(BOARD)-firmware.elf +flash: $(BUILD)/$(PROJECT).elf openocd -f interface/nulink.cfg -f target/numicroM0.cfg -c "program $< reset exit" diff --git a/hw/bsp/nutiny_sdk_nuc120/board.mk b/hw/bsp/nutiny_sdk_nuc120/board.mk index 51841643a..0d3a3bff4 100644 --- a/hw/bsp/nutiny_sdk_nuc120/board.mk +++ b/hw/bsp/nutiny_sdk_nuc120/board.mk @@ -52,5 +52,5 @@ JLINK_DEVICE = NUC120LE3 # Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton # Please compile and install it from github source -flash: $(BUILD)/$(BOARD)-firmware.elf +flash: $(BUILD)/$(PROJECT).elf openocd -f interface/nulink.cfg -f target/numicroM0.cfg -c "program $< reset exit" diff --git a/hw/bsp/nutiny_sdk_nuc505/board.mk b/hw/bsp/nutiny_sdk_nuc505/board.mk index 2d00cd9be..99103fc65 100644 --- a/hw/bsp/nutiny_sdk_nuc505/board.mk +++ b/hw/bsp/nutiny_sdk_nuc505/board.mk @@ -57,5 +57,5 @@ JLINK_DEVICE = NUC505YO13Y # Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton # Please compile and install it from github source -flash: $(BUILD)/$(BOARD)-firmware.elf +flash: $(BUILD)/$(PROJECT).elf openocd -f interface/nulink.cfg -f target/numicroM4.cfg -c "program $< reset exit" diff --git a/hw/bsp/samd11_xplained/board.mk b/hw/bsp/samd11_xplained/board.mk index c80ece4a6..c12ecd214 100644 --- a/hw/bsp/samd11_xplained/board.mk +++ b/hw/bsp/samd11_xplained/board.mk @@ -42,5 +42,5 @@ FREERTOS_PORT = ARM_CM0 JLINK_DEVICE = ATSAMD11D14 # flash using edbg -flash: $(BUILD)/$(BOARD)-firmware.bin +flash: $(BUILD)/$(PROJECT).bin edbg -b -t samd11 -e -pv -f $< diff --git a/hw/bsp/samd21/boards/luna/board.mk b/hw/bsp/samd21/boards/luna/board.mk index 0feae9313..5beb5e02d 100644 --- a/hw/bsp/samd21/boards/luna/board.mk +++ b/hw/bsp/samd21/boards/luna/board.mk @@ -6,6 +6,6 @@ LD_FILE = $(BOARD_PATH)/samd21g18a_flash.ld JLINK_DEVICE = ATSAMD21G18 # flash using dfu-util -flash: $(BUILD)/$(BOARD)-firmware.bin +flash: $(BUILD)/$(PROJECT).bin dfu-util -a 0 -d 1d50:615c -D $< || dfu-util -a 0 -d 16d0:05a5 -D $< diff --git a/hw/bsp/samd21/family.mk b/hw/bsp/samd21/family.mk index 2f4d6b7ae..76929f74d 100644 --- a/hw/bsp/samd21/family.mk +++ b/hw/bsp/samd21/family.mk @@ -41,6 +41,6 @@ FREERTOS_PORT = ARM_CM0 # Add it to your PATH or change BOSSAC variable to match your installation BOSSAC = bossac -flash-bossac: $(BUILD)/$(BOARD)-firmware.bin +flash-bossac: $(BUILD)/$(PROJECT).bin @:$(call check_defined, SERIAL, example: SERIAL=/dev/ttyACM0) $(BOSSAC) --port=$(SERIAL) -U -i --offset=0x2000 -e -w $^ -R diff --git a/hw/bsp/samd51/family.mk b/hw/bsp/samd51/family.mk index 097593748..dbb0a1036 100644 --- a/hw/bsp/samd51/family.mk +++ b/hw/bsp/samd51/family.mk @@ -44,6 +44,6 @@ FREERTOS_PORT = ARM_CM4F # Add it to your PATH or change BOSSAC variable to match your installation BOSSAC = bossac -flash-bossac: $(BUILD)/$(BOARD)-firmware.bin +flash-bossac: $(BUILD)/$(PROJECT).bin @:$(call check_defined, SERIAL, example: SERIAL=/dev/ttyACM0) $(BOSSAC) --port=$(SERIAL) -U -i --offset=0x4000 -e -w $^ -R diff --git a/hw/bsp/same70_xplained/board.mk b/hw/bsp/same70_xplained/board.mk index efe597fe3..21f5350c3 100644 --- a/hw/bsp/same70_xplained/board.mk +++ b/hw/bsp/same70_xplained/board.mk @@ -54,5 +54,5 @@ JLINK_DEVICE = SAME70Q21B # flash using edbg from https://github.com/ataradov/edbg # Note: SAME70's GPNVM1 must be set to 1 to boot from flash with # edbg -t same70 -F w0,1,1 -flash: $(BUILD)/$(BOARD)-firmware.bin +flash: $(BUILD)/$(PROJECT).bin edbg --verbose -t same70 -pv -f $< diff --git a/hw/bsp/samg55xplained/board.mk b/hw/bsp/samg55xplained/board.mk index 79716d36d..b574a39e7 100644 --- a/hw/bsp/samg55xplained/board.mk +++ b/hw/bsp/samg55xplained/board.mk @@ -49,5 +49,5 @@ FREERTOS_PORT = ARM_CM4F JLINK_DEVICE = ATSAMG55J19 # flash using edbg from https://github.com/ataradov/edbg -flash: $(BUILD)/$(BOARD)-firmware.bin +flash: $(BUILD)/$(PROJECT).bin edbg --verbose -t samg55 -pv -f $< diff --git a/hw/bsp/spresense/board.mk b/hw/bsp/spresense/board.mk index 74b04ef5e..245976235 100644 --- a/hw/bsp/spresense/board.mk +++ b/hw/bsp/spresense/board.mk @@ -61,13 +61,13 @@ LDFLAGS += \ VENDOR = sony CHIP_FAMILY = cxd56 -$(MKSPK): $(BUILD)/$(BOARD)-firmware.elf +$(MKSPK): $(BUILD)/$(PROJECT).elf $(MAKE) -C $(TOP)/hw/mcu/sony/cxd56/mkspk -$(BUILD)/$(BOARD)-firmware.spk: $(MKSPK) +$(BUILD)/$(PROJECT).spk: $(MKSPK) @echo CREATE $@ - @$(MKSPK) -c 2 $(BUILD)/$(BOARD)-firmware.elf nuttx $@ + @$(MKSPK) -c 2 $(BUILD)/$(PROJECT).elf nuttx $@ # flash -flash: $(BUILD)/$(BOARD)-firmware.spk +flash: $(BUILD)/$(PROJECT).spk @$(TOP)/hw/mcu/sony/cxd56/tools/flash_writer.py -s -c $(SERIAL) -d -b 115200 -n $< diff --git a/hw/bsp/stm32f103bluepill/board.mk b/hw/bsp/stm32f103bluepill/board.mk index 8dc1fa3f5..e1517cfaa 100644 --- a/hw/bsp/stm32f103bluepill/board.mk +++ b/hw/bsp/stm32f103bluepill/board.mk @@ -46,5 +46,5 @@ FREERTOS_PORT = ARM_CM3 JLINK_DEVICE = stm32f103c8 # flash target ROM bootloader -flash: $(BUILD)/$(BOARD)-firmware.bin +flash: $(BUILD)/$(PROJECT).bin dfu-util -R -a 0 --dfuse-address 0x08000000 -D $< diff --git a/hw/bsp/stm32f4/boards/feather_stm32f405/board.mk b/hw/bsp/stm32f4/boards/feather_stm32f405/board.mk index f78bb63fc..1de56fe5a 100644 --- a/hw/bsp/stm32f4/boards/feather_stm32f405/board.mk +++ b/hw/bsp/stm32f4/boards/feather_stm32f405/board.mk @@ -8,5 +8,5 @@ SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f405xx.s JLINK_DEVICE = stm32f405rg # flash target ROM bootloader -flash: $(BUILD)/$(BOARD)-firmware.bin +flash: $(BUILD)/$(PROJECT).bin dfu-util -R -a 0 --dfuse-address 0x08000000 -D $< diff --git a/hw/bsp/stm32f4/boards/stm32f401blackpill/board.mk b/hw/bsp/stm32f4/boards/stm32f401blackpill/board.mk index 2d8b10318..de0f3d4c7 100644 --- a/hw/bsp/stm32f4/boards/stm32f401blackpill/board.mk +++ b/hw/bsp/stm32f4/boards/stm32f401blackpill/board.mk @@ -8,5 +8,5 @@ SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f401xc.s JLINK_DEVICE = stm32f401cc # flash target ROM bootloader -flash: $(BUILD)/$(BOARD)-firmware.bin +flash: $(BUILD)/$(PROJECT).bin dfu-util -R -a 0 --dfuse-address 0x08000000 -D $< diff --git a/hw/bsp/stm32f4/boards/stm32f411blackpill/board.mk b/hw/bsp/stm32f4/boards/stm32f411blackpill/board.mk index a8287d0bc..78be4348a 100644 --- a/hw/bsp/stm32f4/boards/stm32f411blackpill/board.mk +++ b/hw/bsp/stm32f4/boards/stm32f411blackpill/board.mk @@ -8,5 +8,5 @@ SRC_S += $(ST_CMSIS)/Source/Templates/gcc/startup_stm32f411xe.s JLINK_DEVICE = stm32f411ce # flash target ROM bootloader -flash: $(BUILD)/$(BOARD)-firmware.bin +flash: $(BUILD)/$(PROJECT).bin dfu-util -R -a 0 --dfuse-address 0x08000000 -D $< diff --git a/hw/bsp/stm32l0538disco/board.mk b/hw/bsp/stm32l0538disco/board.mk index 9e3423fbc..2c9ffad69 100644 --- a/hw/bsp/stm32l0538disco/board.mk +++ b/hw/bsp/stm32l0538disco/board.mk @@ -50,5 +50,5 @@ JLINK_DEVICE = STM32L053R8 STM32Prog = STM32_Programmer_CLI # flash target using on-board stlink -flash: $(BUILD)/$(BOARD)-firmware.elf +flash: $(BUILD)/$(PROJECT).elf $(STM32Prog) --connect port=swd --write $< --go diff --git a/hw/bsp/stm32l476disco/board.mk b/hw/bsp/stm32l476disco/board.mk index 994849d9e..9e44598b0 100644 --- a/hw/bsp/stm32l476disco/board.mk +++ b/hw/bsp/stm32l476disco/board.mk @@ -53,5 +53,5 @@ JLINK_DEVICE = stm32l476vg STM32Prog = STM32_Programmer_CLI # flash target using on-board stlink -flash: $(BUILD)/$(BOARD)-firmware.elf +flash: $(BUILD)/$(PROJECT).elf $(STM32Prog) --connect port=swd --write $< --go From e230d683ca5ebda82da66935daa91661ad97c662 Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 26 Jan 2021 21:19:14 +0700 Subject: [PATCH 3/8] add copy-artifact target, and add uf2 for all family board --- examples/make.mk | 6 ++++-- examples/rules.mk | 43 +++++++++++++++++++++++++++++++--------- hw/bsp/imxrt/family.mk | 2 ++ hw/bsp/nrf/family.mk | 5 ++--- hw/bsp/samd21/family.mk | 2 ++ hw/bsp/samd51/family.mk | 2 ++ hw/bsp/stm32f4/family.mk | 2 ++ hw/bsp/stm32f7/family.mk | 2 ++ tools/build_family.py | 1 + 9 files changed, 51 insertions(+), 14 deletions(-) diff --git a/examples/make.mk b/examples/make.mk index 329efa774..e820989b7 100644 --- a/examples/make.mk +++ b/examples/make.mk @@ -3,8 +3,10 @@ # --------------------------------------- # Build directory -BUILD = _build/$(BOARD) -PROJECT = $(BOARD)-$(notdir $(CURDIR)) +BUILD := _build/$(BOARD) + +PROJECT := $(BOARD)-$(notdir $(CURDIR)) +BIN := $(TOP)/_bin/$(BOARD)/$(notdir $(CURDIR)) # Handy check parameter function check_defined = \ diff --git a/examples/rules.mk b/examples/rules.mk index 12ec35043..07bf9a7df 100644 --- a/examples/rules.mk +++ b/examples/rules.mk @@ -2,11 +2,13 @@ # Common make rules for all examples # --------------------------------------- +# Set all as default goal +.DEFAULT_GOAL := all + ifeq ($(FAMILY),esp32s2) # Espressif IDF use CMake build system, this add wrapper target to call idf.py .PHONY: all clean flash -.DEFAULT_GOAL := all all: idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) build @@ -34,6 +36,11 @@ erase: monitor: idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) monitor +UF2_FAMILY_ID = 0xbfdd4eee +$(BUILD)/$(PROJECT).uf2: $(BUILD)/$(PROJECT).hex + @echo CREATE $@ + $(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f $(UF2_FAMILY_ID) -c -o $@ $^ + else ifeq ($(FAMILY),rp2040) all: @@ -43,9 +50,6 @@ all: clean: $(RM) -rf $(BUILD) -#copy-artifact: -# @$(CP) - else # GNU Make build system @@ -101,8 +105,6 @@ $(info LDFLAGS $(LDFLAGS)) $(info ) $(info ASFLAGS $(ASFLAGS)) $(info ) endif -# Set all as default goal -.DEFAULT_GOAL := all all: $(BUILD)/$(PROJECT).bin $(BUILD)/$(PROJECT).hex size uf2: $(BUILD)/$(PROJECT).uf2 @@ -128,10 +130,19 @@ $(BUILD)/$(PROJECT).hex: $(BUILD)/$(PROJECT).elf @echo CREATE $@ @$(OBJCOPY) -O ihex $^ $@ -UF2_FAMILY ?= 0x00 +# UF2 generation, iMXRT need to strip to text only before conversion +ifeq ($(FAMILY),imxrt) +$(BUILD)/$(PROJECT).uf2: $(BUILD)/$(PROJECT).elf + @echo CREATE $@ + @$(OBJCOPY) -O ihex -R .flash_config -R .ivt $^ $(BUILD)/$(PROJECT)-textonly.hex + $(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f $(UF2_FAMILY_ID) -c -o $@ $(BUILD)/$(PROJECT)-textonly.hex +else $(BUILD)/$(PROJECT).uf2: $(BUILD)/$(PROJECT).hex @echo CREATE $@ - $(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f $(UF2_FAMILY) -c -o $@ $^ + $(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f $(UF2_FAMILY_ID) -c -o $@ $^ +endif + +copy-artifact: $(BUILD)/$(PROJECT).bin $(BUILD)/$(PROJECT).hex $(BUILD)/$(PROJECT).uf2 # We set vpath to point to the top of the tree so that the source files # can be located. By following this scheme, it allows a single build rule @@ -199,4 +210,18 @@ flash-pyocd: $(BUILD)/$(PROJECT).hex pyocd flash -t $(PYOCD_TARGET) $< pyocd reset -t $(PYOCD_TARGET) -endif # Make target +endif # GNU Make + +#-------------- Artifacts -------------- + +# Create binary directory +$(BIN): + @$(MKDIR) -p $@ + +# Copy binaries .elf, .bin, .hex, .uf2 to BIN for upload +copy-artifact: $(BIN) + @$(CP) $(BUILD)/$(PROJECT).elf $(BIN) + @$(CP) $(BUILD)/$(PROJECT).bin $(BIN) + @$(CP) $(BUILD)/$(PROJECT).hex $(BIN) + @$(CP) $(BUILD)/$(PROJECT).uf2 $(BIN) + diff --git a/hw/bsp/imxrt/family.mk b/hw/bsp/imxrt/family.mk index 47d403069..3311768bd 100644 --- a/hw/bsp/imxrt/family.mk +++ b/hw/bsp/imxrt/family.mk @@ -1,3 +1,5 @@ +UF2_FAMILY_ID = 0x4fb2d5bd + include $(TOP)/$(BOARD_PATH)/board.mk CFLAGS += \ diff --git a/hw/bsp/nrf/family.mk b/hw/bsp/nrf/family.mk index 7d8f10956..c7dff1d0c 100644 --- a/hw/bsp/nrf/family.mk +++ b/hw/bsp/nrf/family.mk @@ -1,3 +1,5 @@ +UF2_FAMILY_ID = 0xADA52840 + include $(TOP)/$(BOARD_PATH)/board.mk CFLAGS += \ @@ -58,6 +60,3 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = $(MCU_VARIANT)_xxaa - -# For uf2 conversion -UF2_FAMILY = 0xADA52840 diff --git a/hw/bsp/samd21/family.mk b/hw/bsp/samd21/family.mk index 76929f74d..e2bba494a 100644 --- a/hw/bsp/samd21/family.mk +++ b/hw/bsp/samd21/family.mk @@ -1,3 +1,5 @@ +UF2_FAMILY_ID = 0x68ed2b88 + include $(TOP)/$(BOARD_PATH)/board.mk CFLAGS += \ diff --git a/hw/bsp/samd51/family.mk b/hw/bsp/samd51/family.mk index dbb0a1036..bb895dfc4 100644 --- a/hw/bsp/samd51/family.mk +++ b/hw/bsp/samd51/family.mk @@ -1,3 +1,5 @@ +UF2_FAMILY_ID = 0x55114460 + include $(TOP)/$(BOARD_PATH)/board.mk CFLAGS += \ diff --git a/hw/bsp/stm32f4/family.mk b/hw/bsp/stm32f4/family.mk index 89e28174f..332d6ee02 100644 --- a/hw/bsp/stm32f4/family.mk +++ b/hw/bsp/stm32f4/family.mk @@ -1,3 +1,5 @@ +UF2_FAMILY_ID = 0x57755a57 + include $(TOP)/$(BOARD_PATH)/board.mk CFLAGS += \ diff --git a/hw/bsp/stm32f7/family.mk b/hw/bsp/stm32f7/family.mk index b5f58cf93..b09d8143b 100644 --- a/hw/bsp/stm32f7/family.mk +++ b/hw/bsp/stm32f7/family.mk @@ -1,3 +1,5 @@ +UF2_FAMILY_ID = 0x53b80f00 + include $(TOP)/$(BOARD_PATH)/board.mk CFLAGS += \ diff --git a/tools/build_family.py b/tools/build_family.py index 4ef7201ed..9828ab8c4 100644 --- a/tools/build_family.py +++ b/tools/build_family.py @@ -73,6 +73,7 @@ def build_board(example, board): success = SUCCEEDED success_count += 1 (flash_size, sram_size) = build_size(example, board) + subprocess.run("make -j -C examples/{} BOARD={} copy-artifact".format(example, board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) else: exit_status = build_result.returncode success = FAILED From 032f55feb66726c24a01f91f53fd6efabb6f99e8 Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 26 Jan 2021 21:23:51 +0700 Subject: [PATCH 4/8] try upload build binaries artifacts --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bf1c63d3f..64abfb2ba 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,6 +62,12 @@ jobs: - name: Build run: python3 tools/build_family.py ${{ matrix.family }} + - uses: actions/upload-artifact@v2 + with: + name: ${{ matrix.family }} + path: _bin/ + #TODO upload release assest upload + # Build all no-family (opharned) boards build-board: runs-on: ubuntu-latest From 0a673de78afd990a992aacdd09c32abfa7c48e5b Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 26 Jan 2021 21:46:11 +0700 Subject: [PATCH 5/8] test ci --- .github/workflows/build.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 64abfb2ba..59f6f7eab 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,10 +62,14 @@ jobs: - name: Build run: python3 tools/build_family.py ${{ matrix.family }} - - uses: actions/upload-artifact@v2 - with: - name: ${{ matrix.family }} - path: _bin/ + - name: test + run: | + ls -a _bin/* + + #- uses: actions/upload-artifact@v2 + # with: + # name: ${{ matrix.family }} + # path: _bin/ #TODO upload release assest upload # Build all no-family (opharned) boards From c2d8aa058427b6b0bc61ab1ad7b49d8f1d52a923 Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 26 Jan 2021 22:04:20 +0700 Subject: [PATCH 6/8] limit artifact to only uf2 for now due to the large size of combined binaries of all boards + all examples --- .github/workflows/build.yml | 12 ++++-------- examples/rules.mk | 7 ++++--- tools/build_family.py | 2 +- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 59f6f7eab..64abfb2ba 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,14 +62,10 @@ jobs: - name: Build run: python3 tools/build_family.py ${{ matrix.family }} - - name: test - run: | - ls -a _bin/* - - #- uses: actions/upload-artifact@v2 - # with: - # name: ${{ matrix.family }} - # path: _bin/ + - uses: actions/upload-artifact@v2 + with: + name: ${{ matrix.family }} + path: _bin/ #TODO upload release assest upload # Build all no-family (opharned) boards diff --git a/examples/rules.mk b/examples/rules.mk index 07bf9a7df..aac0fbb38 100644 --- a/examples/rules.mk +++ b/examples/rules.mk @@ -219,9 +219,10 @@ $(BIN): @$(MKDIR) -p $@ # Copy binaries .elf, .bin, .hex, .uf2 to BIN for upload +# due to large size of combined artifacts, only uf2 is uploaded for now copy-artifact: $(BIN) - @$(CP) $(BUILD)/$(PROJECT).elf $(BIN) - @$(CP) $(BUILD)/$(PROJECT).bin $(BIN) - @$(CP) $(BUILD)/$(PROJECT).hex $(BIN) @$(CP) $(BUILD)/$(PROJECT).uf2 $(BIN) + #@$(CP) $(BUILD)/$(PROJECT).bin $(BIN) + #@$(CP) $(BUILD)/$(PROJECT).hex $(BIN) + #@$(CP) $(BUILD)/$(PROJECT).elf $(BIN) diff --git a/tools/build_family.py b/tools/build_family.py index 9828ab8c4..b178d8d41 100644 --- a/tools/build_family.py +++ b/tools/build_family.py @@ -66,7 +66,7 @@ def build_board(example, board): skip_count += 1 print(build_format.format(example, board, success, '-', flash_size, sram_size)) else: - subprocess.run("make -C examples/{} BOARD={} clean".format(example, board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + #subprocess.run("make -C examples/{} BOARD={} clean".format(example, board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) build_result = subprocess.run("make -j -C examples/{} BOARD={} all".format(example, board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) if build_result.returncode == 0: From ae43551a55c743833146a561537878cb2829de33 Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 26 Jan 2021 22:26:35 +0700 Subject: [PATCH 7/8] rename artifact to have tinyusb- prefix --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 64abfb2ba..15f8ac47e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -64,7 +64,7 @@ jobs: - uses: actions/upload-artifact@v2 with: - name: ${{ matrix.family }} + name: tinyusb-${{ matrix.family }} path: _bin/ #TODO upload release assest upload From f1867b3d2caeafccc5fc70b98601979a5fa75de9 Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 26 Jan 2021 22:34:29 +0700 Subject: [PATCH 8/8] more rename --- .github/workflows/build.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 15f8ac47e..37cc4c40d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,12 @@ name: Build -on: [pull_request, push, repository_dispatch] +on: + pull_request: + push: + repository_dispatch: + release: + types: + - created jobs: # Unit testing with Ceedling @@ -27,6 +33,7 @@ jobs: fail-fast: false matrix: family: + # Alphabetical order - 'imxrt' - 'nrf' - 'rp2040' @@ -64,9 +71,8 @@ jobs: - uses: actions/upload-artifact@v2 with: - name: tinyusb-${{ matrix.family }} + name: ${{ matrix.family }}-tinyusb-examples path: _bin/ - #TODO upload release assest upload # Build all no-family (opharned) boards build-board: @@ -75,6 +81,7 @@ jobs: fail-fast: false matrix: example: + # Alphabetical order - 'device/audio_test' - 'device/board_test' - 'device/cdc_dual_ports' @@ -151,6 +158,7 @@ jobs: fail-fast: false matrix: board: + # Alphabetical order - 'espressif_kaluga_1' - 'espressif_saola_1'