diff options
author | Brian Cully <bjc@kublai.com> | 2019-06-24 21:14:32 -0400 |
---|---|---|
committer | Brian Cully <bjc@kublai.com> | 2019-07-23 19:55:18 -0400 |
commit | 63d4ce8154eb8f6feb67986e98ea9b5007632460 (patch) | |
tree | 187e66104eb7c848dcf73a5ee067c5f27235360a /app/Makefile | |
download | samd21-demo-63d4ce8154eb8f6feb67986e98ea9b5007632460.tar.gz samd21-demo-63d4ce8154eb8f6feb67986e98ea9b5007632460.zip |
Initial commit.
Diffstat (limited to 'app/Makefile')
-rw-r--r-- | app/Makefile | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/app/Makefile b/app/Makefile new file mode 100644 index 0000000..a5ef39f --- /dev/null +++ b/app/Makefile @@ -0,0 +1,38 @@ +APP = samd21-demo + +USBVID = 239a +USBPID = '001e|801e' + +BOSSAC = bossac +SERIAL = $(shell ./find-serial-port $(USBVID) $(USBPID) || echo 'cant-find-serial-port') +OFFSET = 0x2000 + +.PHONY: all clean cargo-build + +all: $(APP).uf2 + +clean: + rm -f $(APP).uf2 + rm -f $(APP).bin + cargo clean + +cargo-build: + cargo build + +target/thumbv6m-none-eabi/debug/$(APP): cargo-build + +$(APP).bin: target/thumbv6m-none-eabi/debug/$(APP) + cargo objcopy --bin $(APP) -- -O binary $(APP).bin + +# Requires https://github.com/sajattack/uf2conv-rs.git +%.uf2: %.bin + uf2conv-rs $< --base $(OFFSET) --output $@ + +flash: $(APP).bin $(SERIAL) + $(BOSSAC) -R -e -w -v -o$(OFFSET) -p$(SERIAL) $< + +qemu: target/thumbv6m-none-eabi/debug/$(APP) + qemu-system-arm -d in_asm,int,exec,cpu,guest_errors,unimp -pidfile qemu.pid -cpu cortex-m0 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -s -S -kernel $< + +gdb: target/thumbv6m-none-eabi/debug/$(APP) + gdb-multiarch -ex "target remote localhost:1234" -ex "break main" -ex "continue" $< |