Skip to content

Instantly share code, notes, and snippets.

@dreamcat4
Created May 4, 2021 15:15
Show Gist options
  • Save dreamcat4/5d8f1d78021fdc3b5a7c57ec70ba9857 to your computer and use it in GitHub Desktop.
Save dreamcat4/5d8f1d78021fdc3b5a7c57ec70ba9857 to your computer and use it in GitHub Desktop.
openocd-flash-elf-stlink-stm32f4x()
{
if [ ! "$1" ]; then
echo "error: must speficy a firmware.elf to flash"
return 1
fi
_openocd_scripts_path="$HOME/.platformio/packages/tool-openocd/scripts"
# _firmware_elf=".pio/build/blackpill_f411ce/firmware.elf"
_firmware_elf="$1"
openocd -d1 -s "$_openocd_scripts_path" \
-f interface/stlink.cfg -c transport select hla_swd -f target/stm32f4x.cfg \
-c program {$_firmware_elf} verify reset; shutdown;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment