Last active
January 14, 2021 23:45
-
-
Save pfeerick/59bdb78710bb43670d44c0ab5f8a2572 to your computer and use it in GitHub Desktop.
stlink pinetime swd
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
#!/bin/bash | |
OCD_SCRIPTS=/home/pfeerick/repos | |
openocd -f ${OCD_SCRIPTS}/stlink.cfg -f ${OCD_SCRIPTS}/flash_app.ocd |
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
if {[ info exists filename ]} { | |
echo "**** Flashing specified firmware : $filename" | |
} else { | |
set filename "/home/pfeerick/repos/Pinetime/build/output/image-0.10.0.bin" | |
# set filename "/home/pfeerick/repos/joaq-pinetime/build/src/pinetime-app-0.9.1.bin" | |
echo "**** Flashing default firmware : $filename" | |
} | |
echo "**** Connecting to device..." | |
init | |
echo "**** Flashing new firmware..." | |
program $filename verify 0x00008000 | |
#program $filename verify 0x00000000 | |
echo "**** Restarting PineTime..." | |
reset init | |
echo "**** Done!" | |
exit |
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
if {[ info exists bootloader ]} { | |
echo " ==> Flashing custom bootloader: $bootloader" | |
} else { | |
set bootloader "/home/pfeerick/repos/Pinetime/build/output/bootloader.bin" | |
echo " ==> Flashing default bootloader : $bootloader" | |
} | |
if {[ info exists firmware ]} { | |
echo " ==> Flashing custom app firmware: $firmware" | |
} else { | |
set firmware "/home/pfeerick/repos/Pinetime/build/output/image-0.10.0.bin" | |
echo " ==> Flashing default app firmware : $firmware" | |
} | |
echo " ==> Connecting to device..." | |
init | |
echo " ==> Flashing bootloader..." | |
program $bootloader verify 0x00000000 | |
echo " ==> Flashing app firmware..." | |
program $firmware verify 0x00008000 | |
echo " ==> Restarting PineTime..." | |
reset | |
echo " ==> Done!" | |
exit |
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
#!/bin/bash | |
OCD_SCRIPTS=/home/pfeerick/repos | |
openocd -f ${OCD_SCRIPTS}/stlink.cfg -f ${OCD_SCRIPTS}/flash_bootloader_app.ocd |
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
Open On-Chip Debugger 0.10.0+dev-01514-ga8edbd020-dirty (2020-11-18-17:44) | |
Licensed under GNU GPL v2 | |
For bug reports, read | |
http://openocd.org/doc/doxygen/bugs.html | |
force hard breakpoints | |
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD | |
nRF52 device has a CTRL-AP dedicated to recover the device from AP lock. | |
A high level adapter (like a ST-Link) you are currently using cannot access | |
the CTRL-AP so 'nrf52_recover' command will not work. | |
Do not enable UICR APPROTECT. | |
==> Flashing default bootloader : /home/pfeerick/repos/Pinetime/build/output/bootloader.bin | |
==> Flashing default app firmware : /home/pfeerick/repos/Pinetime/build/output/image-0.10.0.bin | |
==> Connecting to device... | |
Info : clock speed 1000 kHz | |
Info : STLINK V2J31S7 (API v2) VID:PID 0483:3748 | |
Info : Target voltage: 3.245563 | |
Info : nrf52.cpu: hardware has 6 breakpoints, 4 watchpoints | |
Info : starting gdb server for nrf52.cpu on 3333 | |
Info : Listening on port 3333 for gdb connections | |
==> Flashing bootloader... | |
target halted due to debug-request, current mode: Thread | |
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc | |
** Programming Started ** | |
Info : nRF52832-QFAA(build code: E0) 512kB Flash, 64kB RAM | |
Warn : Adding extra erase range, 0x00005490 .. 0x00005fff | |
** Programming Finished ** | |
** Verify Started ** | |
** Verified OK ** | |
==> Flashing app firmware... | |
target halted due to debug-request, current mode: Thread | |
xPSR: 0x01000000 pc: 0x000000d8 msp: 0x20010000 | |
** Programming Started ** | |
Warn : Adding extra erase range, 0x0004bf84 .. 0x0004bfff | |
** Programming Finished ** | |
** Verify Started ** | |
** Verified OK ** | |
==> Restarting PineTime... | |
==> Done! |
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
source [find interface/stlink.cfg] | |
transport select hla_swd | |
gdb_flash_program enable | |
gdb_breakpoint_override hard | |
source [find target/nrf52.cfg] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment