Skip to content

Commit

Permalink
fix f767zi flash script (#306)
Browse files Browse the repository at this point in the history
* fix f767zi flash script

* fix flash script
  • Loading branch information
JackFrost67 authored Apr 20, 2021
1 parent 8fd6b5e commit 33362c2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 22 deletions.
26 changes: 15 additions & 11 deletions config/freertos/nucleo_f746zg/flash.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
OLIMEX_EXTENSIONS_DIR=$FW_TARGETDIR/freertos_apps/microros_nucleo_f746zg_extensions
EXTENSIONS_DIR=$FW_TARGETDIR/freertos_apps/microros_nucleo_f746zg_extensions

pushd $OLIMEX_EXTENSIONS_DIR > /dev/null
USE_STFLASH=false

pushd $EXTENSIONS_DIR > /dev/null

if [ -f build/micro-ROS.bin ]; then

echo "Flashing firmware for $RTOS platform $PLATFORM"

if lsusb -d 15BA:002a; then
PROGRAMMER=interface/ftdi/nucleo-arm-usb-tiny-h.cfg
elif lsusb -d 15BA:0003;then
PROGRAMMER=interface/ftdi/nucleo-arm-usb-ocd.cfg
elif lsusb -d 15BA:002b;then
PROGRAMMER=interface/ftdi/nucleo-arm-usb-ocd-h.cfg
if [$USE_STFLASH = true]; then
st-flash --reset write build/micro-ROS.bin 0x8000000
else
if lsusb -d 0483:374b; then
ST_INTERFACE=interface/stlink-v2-1.cfg
elif lsusb -d 0483:3748; then
ST_INTERFACE=interface/stlink-v2.cfg
else
# TODO: add stlink v3, should it be stlink.cfg ?
echo "Error. Unsuported OpenOCD USB programmer"
exit 1
fi

openocd -f $PROGRAMMER -f target/stm32f7x.cfg -c init -c "reset halt" -c "flash write_image erase build/micro-ROS.bin 0x08000000" -c "reset" -c "exit"
openocd -f $ST_INTERFACE -f target/stm32f7x.cfg -c init -c "reset halt" -c "flash write_image erase build/micro-ROS.bin 0x08000000" -c "reset" -c "exit"
fi
else
echo "build/micro-ROS.bin not found: please compile before flashing."
fi
Expand Down
26 changes: 15 additions & 11 deletions config/freertos/nucleo_f767zi/flash.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
OLIMEX_EXTENSIONS_DIR=$FW_TARGETDIR/freertos_apps/microros_nucleo_f767zi_extensions
EXTENSIONS_DIR=$FW_TARGETDIR/freertos_apps/microros_nucleo_f767zi_extensions

pushd $OLIMEX_EXTENSIONS_DIR > /dev/null
USE_STFLASH=false

pushd $EXTENSIONS_DIR > /dev/null

if [ -f build/micro-ROS.bin ]; then

echo "Flashing firmware for $RTOS platform $PLATFORM"

if lsusb -d 15BA:002a; then
PROGRAMMER=interface/ftdi/nucleo-arm-usb-tiny-h.cfg
elif lsusb -d 15BA:0003;then
PROGRAMMER=interface/ftdi/nucleo-arm-usb-ocd.cfg
elif lsusb -d 15BA:002b;then
PROGRAMMER=interface/ftdi/nucleo-arm-usb-ocd-h.cfg
if [$USE_STFLASH = true]; then
st-flash --reset write build/micro-ROS.bin 0x8000000
else
if lsusb -d 0483:374b; then
ST_INTERFACE=interface/stlink-v2-1.cfg
elif lsusb -d 0483:3748; then
ST_INTERFACE=interface/stlink-v2.cfg
else
# TODO: add stlink v3, should it be stlink.cfg ?
echo "Error. Unsuported OpenOCD USB programmer"
exit 1
fi

openocd -f $PROGRAMMER -f target/stm32f7x.cfg -c init -c "reset halt" -c "flash write_image erase build/micro-ROS.bin 0x08000000" -c "reset" -c "exit"
openocd -f $ST_INTERFACE -f target/stm32f7x.cfg -c init -c "reset halt" -c "flash write_image erase build/micro-ROS.bin 0x08000000" -c "reset" -c "exit"
fi
else
echo "build/micro-ROS.bin not found: please compile before flashing."
fi
Expand Down

0 comments on commit 33362c2

Please sign in to comment.