Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added script for demonstrating how to flash with openocd #75

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions tools/scripts/flash_firmware.cfg
Original file line number Diff line number Diff line change
@@ -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
Loading