Move device-related Make targets to the appropriate file

This commit is contained in:
Romain Goyet
2018-02-01 14:15:11 +01:00
committed by EmilieNumworks
parent f2046c3b15
commit 0a3623421c
3 changed files with 29 additions and 33 deletions

View File

@@ -30,11 +30,7 @@ CXXFLAGS = -std=c++11 -fno-exceptions -fno-rtti -fno-threadsafe-statics
products :=
ifeq ($(VERBOSE),1)
default: info clean app_size app_memory_map
else
default: app.$(EXE)
endif
run: app_run
.PHONY: info
@@ -92,23 +88,6 @@ $(all_objs): $(generated_headers)
@echo "LD $@"
@$(LD) $^ $(LDFLAGS) -o $@
.PHONY: %_size
%_size: %.$(EXE)
@echo "========= BUILD OUTPUT ========"
@echo "File: $<"
@$(SIZE) $< | tail -n 1 | awk '{print "Code: " $$1 " bytes";print "Data: " $$2 " bytes"; print "Total: " int(($$1+$$2)/1024) " kB (" $$1 + $$2 " bytes)";}'
@echo "==============================="
ifdef OBJCOPY
products += $(products:.$(EXE)=.hex) $(products:.$(EXE)=.bin)
%.hex: %.$(EXE)
@echo "OBJCOPY $@"
@$(OBJCOPY) -O ihex $< $@
%.bin: %.$(EXE)
@echo "OBJCOPY $@"
@$(OBJCOPY) -O binary $< $@
endif
%.o: %.c
@echo "CC $@"
@$(CC) $(SFLAGS) $(CFLAGS) -c $< -o $@

View File

@@ -4,15 +4,3 @@ EXE = elf
python/port/port.o: CXXFLAGS += -DMP_PORT_USE_STACK_SYMBOLS=1
.PHONY: %_run
%_run: %.$(EXE)
$(GDB) -x gdb_script.gdb $<
.PHONY: %_flash
%_flash: %.bin
@echo "DFU $@"
@echo "INFO About to flash your device. Please plug your device to your computer"
@echo " using an USB cable and press the RESET button the back of your device."
@until dfu-util -l | grep "Internal Flash" > /dev/null 2>&1; do sleep 1;done
@echo "DFU $@"
@dfu-util -i 0 -a 0 -s 0x08000000:leave -D $<

29
build/targets.device.mak Normal file
View File

@@ -0,0 +1,29 @@
products += $(products:.$(EXE)=.hex) $(products:.$(EXE)=.bin)
%.hex: %.$(EXE)
@echo "OBJCOPY $@"
@$(OBJCOPY) -O ihex $< $@
%.bin: %.$(EXE)
@echo "OBJCOPY $@"
@$(OBJCOPY) -O binary $< $@
.PHONY: %_size
%_size: %.$(EXE)
@echo "========= BUILD OUTPUT ========"
@echo "File: $<"
@$(SIZE) $< | tail -n 1 | awk '{print "Code: " $$1 " bytes";print "Data: " $$2 " bytes"; print "Total: " int(($$1+$$2)/1024) " kB (" $$1 + $$2 " bytes)";}'
@echo "==============================="
.PHONY: %_run
%_run: %.$(EXE)
$(GDB) -x gdb_script.gdb $<
.PHONY: %_flash
%_flash: %.bin
@echo "DFU $@"
@echo "INFO About to flash your device. Please plug your device to your computer"
@echo " using an USB cable and press the RESET button the back of your device."
@until dfu-util -l | grep "Internal Flash" > /dev/null 2>&1; do sleep 1;done
@echo "DFU $@"
@dfu-util -i 0 -a 0 -s 0x08000000:leave -D $<