-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
swd: Add debug script for GDB, and openocd command line
- Loading branch information
Showing
2 changed files
with
33 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,27 @@ | ||
# Run OpenCD: | ||
~/install/bin/openocd -s ~/install/share/openocd/scripts/ -f interface/cmsis-dap.cfg -f target/at32f4xx.cfg | ||
|
||
# In another window, run GDB (note elf image name is hardcoded in the script): | ||
gdb-multiarch -x scripts/gdb-commands | ||
|
||
# Telnet commands: | ||
telnet localhost 4444 | ||
mdb 0x1fffc000 512 # Read USD on 435 | ||
mdb 0x1ffff800 512 # Read USD on 415 | ||
reset init # FPEC operations need to be in reset state | ||
at32f4xx mass_erase | ||
at32f4xx usd_erase # NB. Enables RDP! | ||
at32f4xx usd_write 0 0xa5 # Disable RDP -- Do this before resetting!!!!!! | ||
|
||
# If you reset after usd_erase, you can no longer read any flash including USD! | ||
# To get out of this do the following: | ||
at32f4xx usd_write 0 0xa5 # Slow (it mass erases main Flash) | ||
reset init # Makes Flash and USD readable again | ||
|
||
# Oh no, after a USD erase, AT32F435 1MB+ Flash parts only have 128kB SRAM! | ||
# To fix this: | ||
at32f4xx usd_write 8 0xfa # Sets EOPB0 to 384kB SRAM mode | ||
|
||
# Some more general stuff: | ||
flash write_image [erase] flashfloppy/out/at32f435/debug/floppy/target.hex | ||
reset run|halt|init |
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,6 @@ | ||
file /home/keir/flashfloppy/out/at32f435/debug/floppy/target.elf | ||
target extended-remote localhost:3333 | ||
# Reset the target and call its init script | ||
monitor reset init | ||
# Halt the target. The init script should halt the target, but just in case | ||
monitor halt |