From ae39713e0bd53c5ce0b873e0d8cc7f6c12a71483 Mon Sep 17 00:00:00 2001 From: Joakim Hulthe Date: Sun, 18 Aug 2019 15:35:43 +0200 Subject: [PATCH] Add makefile --- Makefile.toml | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/Makefile.toml b/Makefile.toml index 24875ad..d6053ad 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -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"]