diff options
Diffstat (limited to 'support')
-rw-r--r-- | support/make/build-rules.mk | 40 | ||||
-rw-r--r-- | support/make/build-targets.mk | 31 | ||||
-rw-r--r-- | support/make/build-templates.mk | 5 | ||||
-rw-r--r-- | support/openocd/flash.cfg | 4 |
4 files changed, 78 insertions, 2 deletions
diff --git a/support/make/build-rules.mk b/support/make/build-rules.mk new file mode 100644 index 0000000..52ede32 --- /dev/null +++ b/support/make/build-rules.mk @@ -0,0 +1,40 @@ +# Useful tools +CC := arm-none-eabi-gcc +CXX := arm-none-eabi-g++ +LD := arm-none-eabi-ld -v +AR := arm-none-eabi-ar +AS := arm-none-eabi-as +OBJCOPY := arm-none-eabi-objcopy +DISAS := arm-none-eabi-objdump +OBJDUMP := arm-none-eabi-objdump +SIZE := arm-none-eabi-size +DFU := dfu-util +OPENOCD := openocd + +# Suppress annoying output unless V is set +ifndef V + SILENT_CC = @echo ' [CC] ' $(@:$(BUILD_PATH)/%.o=%.c); + SILENT_CXX = @echo ' [CXX] ' $(@:$(BUILD_PATH)/%.o=%.cpp); + SILENT_LD = @echo ' [LD] ' $(@F); + SILENT_AR = @echo ' [AR] ' + SILENT_AS = @echo ' [AS] ' + SILENT_OBJCOPY = @echo ' [OBJCOPY] ' $(@F); + SILENT_DISAS = @echo ' [DISAS] ' $(@:$(BUILD_PATH)/%.bin=%).disas; + SILENT_OBJDUMP = @echo ' [OBJDUMP] ' $(OBJDUMP); + DFU := dfu-util + OPENOCD := openocd +endif + +BUILDDIRS := +TGT_BIN := + +CFLAGS = $(GLOBAL_CFLAGS) $(TGT_CFLAGS) +CXXFLAGS = $(GLOBAL_CXXFLAGS) $(TGT_CXXFLAGS) + +# General directory independent build rules, generate dependency information +$(BUILD_PATH)/%.o: %.c + $(SILENT_CC) $(CC) $(CFLAGS) -MMD -MP -MF $(@:%.o=%.d) -MT $@ -o $@ -c $< + +$(BUILD_PATH)/%.o: %.cpp + $(SILENT_CXX) $(CXX) $(CFLAGS) $(CXXFLAGS) -MMD -MP -MF $(@:%.o=%.d) -MT $@ -o $@ -c $< + diff --git a/support/make/build-targets.mk b/support/make/build-targets.mk new file mode 100644 index 0000000..a7f2446 --- /dev/null +++ b/support/make/build-targets.mk @@ -0,0 +1,31 @@ +# main project target +$(BUILD_PATH)/main.o: main.cpp + $(SILENT_CXX) $(CXX) $(CFLAGS) $(CXXFLAGS) $(LIBMAPLE_INCLUDES) $(WIRISH_INCLUDES) -o $@ -c $< + +$(BUILD_PATH)/$(BOARD).elf: $(BUILDDIRS) $(TGT_BIN) $(BUILD_PATH)/main.o + $(SILENT_LD) $(CXX) $(LDFLAGS) -o $@ $(TGT_BIN) $(BUILD_PATH)/main.o + +$(BUILD_PATH)/$(BOARD).bin: $(BUILD_PATH)/$(BOARD).elf + $(SILENT_OBJCOPY) $(OBJCOPY) -v -Obinary $(BUILD_PATH)/$(BOARD).elf $@ 1>/dev/null + $(SILENT_DISAS) $(DISAS) -d $(BUILD_PATH)/$(BOARD).elf > $(BUILD_PATH)/$(BOARD).disas + @echo + @find $(BUILD_PATH) -iname *.o | xargs $(SIZE) -t > $(BUILD_PATH)/$(BOARD).sizes + @echo "Final Size:" + $(SIZE) $< + @echo $(MAPLE_TARGET) > $(BUILD_PATH)/build-type + +$(BUILDDIRS): + @mkdir -p $@ + +MSG_INFO: + @echo "================================================================================" + @echo "" + @echo " Build info:" + @echo " BOARD:" $(BOARD) + @echo " MAPLE_TARGET:" $(MAPLE_TARGET) + @echo "" + @echo " See 'make help' for all possible targets" + @echo "" + @echo "================================================================================" + @echo + diff --git a/support/make/build-templates.mk b/support/make/build-templates.mk new file mode 100644 index 0000000..4371f13 --- /dev/null +++ b/support/make/build-templates.mk @@ -0,0 +1,5 @@ +define LIBMAPLE_MODULE_template +dir := $(1) +include $$(dir)/rules.mk +endef + diff --git a/support/openocd/flash.cfg b/support/openocd/flash.cfg index 6cffa80..eceac32 100644 --- a/support/openocd/flash.cfg +++ b/support/openocd/flash.cfg @@ -72,9 +72,9 @@ proc flash_chip {} { echo "Erasing 128KB..." flash erase_address 0x08000000 0x20000 echo "Flashing image..." - flash write_bank 0 build/main.bin 0 + flash write_bank 0 build/maple.bin 0 echo "Verifying image..." - verify_image build/main.bin 0x08000000 bin + verify_image build/maple.bin 0x08000000 bin echo "Checksum verified, resetting chip" reset run echo "Daemon shutdown" |