mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-05 18:40:28 +00:00
add copy-artifact target, and add uf2 for all family board
This commit is contained in:
parent
4a0f5cbd63
commit
e230d683ca
@ -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 = \
|
||||
|
@ -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)
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
UF2_FAMILY_ID = 0x4fb2d5bd
|
||||
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
|
||||
CFLAGS += \
|
||||
|
@ -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
|
||||
|
@ -1,3 +1,5 @@
|
||||
UF2_FAMILY_ID = 0x68ed2b88
|
||||
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
|
||||
CFLAGS += \
|
||||
|
@ -1,3 +1,5 @@
|
||||
UF2_FAMILY_ID = 0x55114460
|
||||
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
|
||||
CFLAGS += \
|
||||
|
@ -1,3 +1,5 @@
|
||||
UF2_FAMILY_ID = 0x57755a57
|
||||
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
|
||||
CFLAGS += \
|
||||
|
@ -1,3 +1,5 @@
|
||||
UF2_FAMILY_ID = 0x53b80f00
|
||||
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
|
||||
CFLAGS += \
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user