summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorhathach <[email protected]>2020-04-03 12:08:06 +0700
committerhathach <[email protected]>2020-04-03 12:08:06 +0700
commit7c33a7127f009c54fa43b94243def846284865af (patch)
tree63b378e113639d448b749eb04cd0980d789c9119 /examples
parent2824e5c97aedfe46a621d786fb6577f632a0097c (diff)
make as wrapper to idf.py for consistency
update ci build script to only build esp32-s2 target with freertos examples
Diffstat (limited to 'examples')
-rw-r--r--examples/rules.mk30
1 files changed, 26 insertions, 4 deletions
diff --git a/examples/rules.mk b/examples/rules.mk
index 55c70af4b..92204cf72 100644
--- a/examples/rules.mk
+++ b/examples/rules.mk
@@ -1,6 +1,25 @@
-#
-# Common make definition for all examples
-#
+# ---------------------------------------
+# Common make rules for all examples
+# ---------------------------------------
+
+ifeq ($(CROSS_COMPILE),xtensa-esp32-elf-)
+# 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) -DBOARD=$(BOARD) build
+
+clean:
+ idf.py clean
+
+flash:
+ @:$(call check_defined, SERIAL, example: SERIAL=/dev/ttyUSB0)
+ idf.py -p $(SERIAL) flash
+
+else
+# GNU Make build system
# libc
LIBS += -lgcc -lm -lnosys
@@ -28,8 +47,9 @@ SRC_C += \
# TinyUSB stack include
INC += $(TOP)/src
-#
CFLAGS += $(addprefix -I,$(INC))
+
+# TODO Skip nanolib for MSP430
ifeq ($(BOARD), msp_exp430f5529lp)
LDFLAGS += $(CFLAGS) -fshort-enums -Wl,-T,$(TOP)/$(LD_FILE) -Wl,[email protected] -Wl,-cref -Wl,-gc-sections
else
@@ -135,3 +155,5 @@ flash-jlink: $(BUILD)/$(BOARD)-firmware.hex
# flash STM32 MCU using stlink with STM32 Cube Programmer CLI
flash-stlink: $(BUILD)/$(BOARD)-firmware.elf
STM32_Programmer_CLI --connect port=swd --write $< --go
+
+endif # Make target