rusefi/.github/workflows/hw-ci/openocd_wipe_and_flash.sh

26 lines
769 B
Bash
Raw Normal View History

2023-07-04 06:49:16 -07:00
#!/usr/bin/env bash
2024-03-09 09:17:00 -08:00
HW_SCRIPT=${1:-/tmp/openocd.tmp}
if [ -z "$1" ]; then
# Write whatever is piped to this script to temp file
cat >$HW_SCRIPT
fi
2023-07-04 06:49:16 -07:00
set -e
# for instance
#
2023-07-04 07:04:03 -07:00
# .github/workflows/hw-ci/openocd_wipe_and_flash.sh ../.github/workflows/openocd_ci_f4_discovery.cfg
2023-07-23 09:25:37 -07:00
# .github/workflows/hw-ci/openocd_wipe_and_flash.sh ../.github/workflows/openocd_ci_proteus_f4.cfg
# .github/workflows/hw-ci/openocd_wipe_and_flash.sh ../.github/workflows/openocd_ci_proteus_f7.cfg
2023-07-04 07:04:03 -07:00
cd firmware
2023-07-04 06:49:16 -07:00
# works on F4 with ST-LINK/V3 does not seem to work using V2 :(
2024-02-20 13:48:26 -08:00
openocd -f "$HW_SCRIPT" -c init -c targets -c "reset halt" -c "flash erase_sector 0 0 last" -c "flash write_image "deliver/rusefi.bin" 0x08000000" -c "reset run" -c "shutdown"
2024-03-09 09:17:00 -08:00
if [ -z "$1" ]; then
rm $HW_SCRIPT
fi