diff --git a/tools/scripts/flash_firmware.cfg b/tools/scripts/flash_firmware.cfg new file mode 100644 index 00000000..2032a25d --- /dev/null +++ b/tools/scripts/flash_firmware.cfg @@ -0,0 +1,38 @@ +# an openocd config file for flashing both bootloader and main firmware for AM32 +# This assumes you have a bootloader image in bl.bin and a main firmware in fw.bin +# this script may be useful as part of a production line testing system + +# first off uncomment for the type of debug adapter you have +source [find interface/stlink.cfg] +#source [find interface/cmsis-dap.cfg] +#source [find interface/jlink.cfg] + +# now uncomment the right line for which MCU your ESC uses +#source [find target/stm32f0x.cfg] # for F031 or F051 +#source [find target/at32f415xx.cfg] +#source [find target/at32f421xx.cfg] +#source [find target/gd32e23x.cfg] # for E230 +#source [find target/stm32g0x.cfg] +source [find target/stm32l4x.cfg] + +# initialise +init +halt + +# now erase all of flash +echo "erasing" +flash erase_sector 0 0 last + +# now flash the bootloader, just comment out these lines if you don't +# want to flash the bootloader +echo "Flashing bootloader" +flash write_bank 0 bl.bin 0x0 +flash verify_bank 0 bl.bin 0x0 + +# now flash and verify the main firmware +echo "Flashing main firmware" +flash write_bank 0 fw.bin 0x1000 +flash verify_bank 0 fw.bin 0x1000 + +echo "Success!" +exit