Add makefile

This commit is contained in:
2019-08-18 15:35:43 +02:00
parent 91ef67ef37
commit ae39713e0b

View File

@ -1,23 +1,38 @@
[tasks.build]
description = "Build the executable"
command = "cargo"
args = ["build"]
[tasks.objcopy]
decsription = "Transform the binary for upload"
command = "arm-none-eabi-objcopy"
args = [
"-O", "binary",
"target/thumbv6m-none-eabi/debug/neowatch",
"target/thumbv6m-none-eabi/debug/neowatch.bin",
]
dependencies = ["build"]
[tasks.set_tty]
command = "stty"
args = [
"-F", "/dev/ttyACM0",
"ospeed", "1200",
[tasks.wait_for_tty]
decsription = "Wait for serial port to be available for upload"
script = [
'''
#!/bin/sh
while :; do
if touch /dev/ttyACM0; then
break
else
sleep 1
fi
done
'''
]
[tasks.test]
disabled = true
[tasks.upload]
decsription = "Upload the program to the device"
command = "bossac"
args = [
"--info",
@ -30,12 +45,5 @@ args = [
"target/thumbv6m-none-eabi/debug/neowatch.bin",
"--reset",
]
dependencies = ["build"]
#dependencies = ["set_tty", "build"]
[tasks.test]
disabled = true
[tasks.default]
dependencies = ["upload"]
dependencies = ["objcopy", "wait_for_tty"]