Created
July 8, 2022 01:48
-
-
Save Laura7089/020716775ce9ad5e32dfb6c810c665e5 to your computer and use it in GitHub Desktop.
Small `picotool` wrapper intended for use as a cargo runner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -eu | |
# To use as a cargo runner, set: | |
# | |
# [target.YOUR_TARGET_NAME] | |
# runner = "./picotool.sh" # or wherever you put this script | |
# | |
# in .cargo/config.toml | |
# YOUR_TARGET_NAME is probably thumbv6m-none-eabi for the pico | |
TARGET="$(grep "^target = " ./.cargo/config.toml | head -n 1 | awk -F'\"' '{print $2}')" | |
PROJECT="$(grep "^name = " ./Cargo.toml | head -n 1 | awk -F'\"' '{print $2}')" | |
ELF_FILE="./target/$TARGET/release/$PROJECT" | |
cp -v "$ELF_FILE" "$ELF_FILE.elf" | |
picotool load "$ELF_FILE.elf" | |
picotool reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment