summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorhathach <[email protected]>2021-03-17 17:09:25 +0700
committerhathach <[email protected]>2021-03-17 20:13:22 +0700
commit2307fc302367e2b3a961be905bcb302394a155ca (patch)
treea742bdb73c5fd91cf9e14e9022a273a579e778d0 /examples
parented8f117dd10ecaee1b8169f0c4af5217e03a4951 (diff)
move esp32s2 and rp2040 target rule to its family.mk
Diffstat (limited to 'examples')
-rw-r--r--examples/make.mk2
-rw-r--r--examples/rules.mk78
2 files changed, 12 insertions, 68 deletions
diff --git a/examples/make.mk b/examples/make.mk
index 53f633b18..e04a2592a 100644
--- a/examples/make.mk
+++ b/examples/make.mk
@@ -40,7 +40,7 @@ ifeq ($(FAMILY),)
include $(TOP)/hw/bsp/$(BOARD)/board.mk
else
# Include Family and Board specific defs
- -include $(TOP)/$(FAMILY_PATH)/family.mk
+ include $(TOP)/$(FAMILY_PATH)/family.mk
SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/$(FAMILY_PATH)/*.c))
endif
diff --git a/examples/rules.mk b/examples/rules.mk
index 7f0927a17..9265bb684 100644
--- a/examples/rules.mk
+++ b/examples/rules.mk
@@ -5,69 +5,9 @@
# 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
-
-all:
- idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) build
-
-build: all
-
-clean:
- idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) clean
-
-fullclean:
- idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) fullclean
-
-flash:
- idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) flash
-
-bootloader-flash:
- idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) bootloader-flash
-
-app-flash:
- idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) app-flash
-
-erase:
- idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) erase_flash
-
-monitor:
- idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) monitor
-
-uf2: $(BUILD)/$(PROJECT).uf2
-
-UF2_FAMILY_ID = 0xbfdd4eee
-$(BUILD)/$(PROJECT).uf2: $(BUILD)/$(PROJECT).bin
- @echo CREATE $@
- $(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f $(UF2_FAMILY_ID) -b 0x0 -c -o $@ $^
-
-else ifeq ($(FAMILY),rp2040)
-# ---------------------------------------
-# RP2040 CMake
-# ---------------------------------------
-
-ifeq ($(DEBUG), 1)
-CMAKE_DEFSYM += -DCMAKE_BUILD_TYPE=Debug
-endif
-
-$(BUILD):
- cmake -S . -B $(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) -DPICO_BUILD_DOCS=0 $(CMAKE_DEFSYM)
-
-all: $(BUILD)
- $(MAKE) -C $(BUILD)
-
-clean:
- $(RM) -rf $(BUILD)
-
-#flash: flash-pyocd
-flash:
- @$(CP) $(BUILD)/$(PROJECT).uf2 /media/$(USER)/RPI-RP2
-
-else
+# ESP32-S2 and RP2040 has its own CMake build system
+ifneq ($(FAMILY),esp32s2)
+ifneq ($(FAMILY),rp2040)
# ---------------------------------------
# GNU Make build system
# ---------------------------------------
@@ -194,12 +134,12 @@ else
$(RM) -rf $(BUILD)
endif
+endif
endif # GNU Make
-# Print out the value of a make variable.
-# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile
-print-%:
- @echo $* = $($*)
+# ---------------------------------------
+# Flash Targets
+# ---------------------------------------
# Flash binary using Jlink
ifeq ($(OS),Windows_NT)
@@ -244,3 +184,7 @@ copy-artifact: $(BIN)
#@$(CP) $(BUILD)/$(PROJECT).hex $(BIN)
#@$(CP) $(BUILD)/$(PROJECT).elf $(BIN)
+# Print out the value of a make variable.
+# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile
+print-%:
+ @echo $* = $($*)