-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added script for demonstrating how to flash with openocd
- Loading branch information
1 parent
aeab1cb
commit b5b73ca
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |