-
-
Notifications
You must be signed in to change notification settings - Fork 54
/
flash-app.ocd
35 lines (28 loc) · 1.12 KB
/
flash-app.ocd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# This is an OpenOCD script that connects ST-Link or Raspberry Pi to the nRF52 and flashes the Application ROM.
# Used by tasks.json for "Load Application" command.
# Equivalent to "newt load -v nrf52_my_sensor".
# From https://devzone.nordicsemi.com/f/nordic-q-a/42824/flashing-nrf5832-using-only-st-link-v2-and-openocd
gdb_flash_program enable
gdb_breakpoint_override hard
$_TARGETNAME configure -event reset-init {
# Arm Semihosting is used to show debug console output and may only be enabled after init event. We wait for the event and enable Arm Semihosting.
echo "Enabled ARM Semihosting to show debug output"
arm semihosting enable
}
# Connect to the device.
init
# Raspberry Pi fails with timeout when calling "reset halt" here, so we "reset" then "halt".
echo "Stopping..."
reset
halt
echo ""
# Application address must sync with hw/bsp/nrf52/bsp.yml
echo "Flashing Application..."
program bin/targets/nrf52_my_sensor/app/apps/my_sensor_app/my_sensor_app.img verify 0x00008000
echo ""
# Restart the device and start the bootloader.
echo "Restarting..."
reset init
resume
echo ""
echo "**** Done! Press Ctrl-C to exit..."