summaryrefslogtreecommitdiff
path: root/examples/rules.mk
diff options
context:
space:
mode:
Diffstat (limited to 'examples/rules.mk')
-rw-r--r--examples/rules.mk46
1 files changed, 34 insertions, 12 deletions
diff --git a/examples/rules.mk b/examples/rules.mk
index 4cc35cb22..c3134056a 100644
--- a/examples/rules.mk
+++ b/examples/rules.mk
@@ -5,6 +5,7 @@
# Set all as default goal
.DEFAULT_GOAL := all
+# ---------------- GNU Make Start -----------------------
# ESP32-Sx and RP2040 has its own CMake build system
ifeq (,$(findstring $(FAMILY),esp32s2 esp32s3 rp2040))
@@ -12,8 +13,10 @@ ifeq (,$(findstring $(FAMILY),esp32s2 esp32s3 rp2040))
# Compiler Flags
# ---------------------------------------
+LIBS_GCC ?= -lgcc -lm -lnosys
+
# libc
-LIBS += -lgcc -lm -lnosys
+LIBS += $(LIBS_GCC)
ifneq ($(BOARD), spresense)
LIBS += -lc
@@ -49,7 +52,11 @@ ifeq ($(NO_LTO),1)
CFLAGS := $(filter-out -flto,$(CFLAGS))
endif
-LDFLAGS += $(CFLAGS) -Wl,-T,$(TOP)/$(LD_FILE) -Wl,[email protected] -Wl,-cref -Wl,-gc-sections
+ifneq ($(LD_FILE),)
+LDFLAGS_LD_FILE ?= -Wl,-T,$(TOP)/$(LD_FILE)
+endif
+
+LDFLAGS += $(CFLAGS) $(LDFLAGS_LD_FILE) -Wl,[email protected] -Wl,-cref -Wl,-gc-sections
ifneq ($(SKIP_NANOLIB), 1)
LDFLAGS += -specs=nosys.specs -specs=nano.specs
endif
@@ -135,7 +142,23 @@ $(BUILD)/obj/%_asm.o: %.S
@echo AS $(notdir $@)
@$(CC) -x assembler-with-cpp $(ASFLAGS) -c -o $@ $<
-endif # GNU Make
+endif
+
+.PHONY: clean
+clean:
+ifeq ($(CMDEXE),1)
+ rd /S /Q $(subst /,\,$(BUILD))
+else
+ $(RM) -rf $(BUILD)
+endif
+# ---------------- GNU Make End -----------------------
+
+# get depenecies
+.PHONY: get-deps
+get-deps:
+ ifdef DEPS_SUBMODULES
+ git -C $(TOP) submodule update --init $(DEPS_SUBMODULES)
+ endif
size: $(BUILD)/$(PROJECT).elf
-@echo ''
@@ -146,14 +169,6 @@ size: $(BUILD)/$(PROJECT).elf
linkermap: $(BUILD)/$(PROJECT).elf
@linkermap -v $<.map
-.PHONY: clean
-clean:
-ifeq ($(CMDEXE),1)
- rd /S /Q $(subst /,\,$(BUILD))
-else
- $(RM) -rf $(BUILD)
-endif
-
# ---------------------------------------
# Flash Targets
# ---------------------------------------
@@ -182,11 +197,18 @@ flash-jlink: $(BUILD)/$(PROJECT).hex
flash-stlink: $(BUILD)/$(PROJECT).elf
STM32_Programmer_CLI --connect port=swd --write $< --go
+$(BUILD)/$(PROJECT)-sunxi.bin: $(BUILD)/$(PROJECT).bin
+ $(PYTHON) $(TOP)/tools/mksunxi.py $< $@
+
+flash-xfel: $(BUILD)/$(PROJECT)-sunxi.bin
+ xfel spinor write 0 $<
+ xfel reset
+
# Flash using pyocd
PYOCD_OPTION ?=
flash-pyocd: $(BUILD)/$(PROJECT).hex
pyocd flash -t $(PYOCD_TARGET) $(PYOCD_OPTION) $<
- pyocd reset -t $(PYOCD_TARGET)
+ #pyocd reset -t $(PYOCD_TARGET)
# Flash using openocd
OPENOCD_OPTION ?=