Skip to content

Instantly share code, notes, and snippets.

@jacobrosenthal
Created November 19, 2018 01:14
Show Gist options
  • Save jacobrosenthal/be4387f91c0fe39495a6693fbd6d55b0 to your computer and use it in GitHub Desktop.
Save jacobrosenthal/be4387f91c0fe39495a6693fbd6d55b0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# ideally in the future this script is deprecated for a cargo tools bin method
# https://matklad.github.io/2018/01/03/make-your-own-make.html
# but were waiting on the ability to run std build scripts in a no_std project
# https://github.com/rust-embedded/wg/issues/256#issuecomment-438483578
# alternatively you could attach a programmer like an stlink and use openocd here instead of dfu
# https://gist.github.com/todbot/6b8da4bed3545313ae976be6be7ffc40
# but in the mean time this hardcodes the llvm find from cargo-binutils
# https://github.com/rust-embedded/cargo-binutils
set -x
set -e
$(find $(rustc --print sysroot) -name llvm-objcopy) -O binary "$@" "$@".dfu
dfu-suffix -v 1209 -p 70b1 -a "$@".dfu
dfu-util --download "$@".dfu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment