From HiveTool
Jump to: navigation, search

Install OpenOCD
# openocd -f interface/raspberrypi-native.cfg -c "transport select swd; set WORKAREASIZE 0" -f target/nrf51.cfg
# openocd -f interface/raspberrypi2-native.cfg -c "transport select swd; set WORKAREASIZE 0" -f target/nrf52.cfg
# openocd
Open On-Chip Debugger 0.10.0+dev-00096-gf605a23 (2017-04-05-19:26)                                                                                                                  
Licensed under GNU GPL v2                                                                                                                                                           
For bug reports, read                                                                                                                                                               

BCM2835 GPIO nums: swclk = 25, swdio = 24
BCM2835 GPIO config: srst = 18
srst_only separate srst_gates_jtag srst_push_pull connect_deassert_srst
adapter speed: 10000 kHz
cortex_m reset_config sysresetreq
srst_only separate srst_nogate srst_push_pull connect_deassert_srst
adapter_nsrst_delay: 100
adapter_nsrst_assert_width: 100
Info : BCM2835 GPIO JTAG/SWD bitbang driver
Info : SWD only mode enabled (specify tck, tms, tdi and tdo gpios to add JTAG mode)
Info : clock speed 4061 kHz
Info : SWD DPIDR 0x2ba01477
Error: Could not find MEM-AP to control the core
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* nrf52.cpu          cortex_m   little nrf52.cpu          unknown
Error: Could not find MEM-AP to control the core
Error: Target not examined, will not halt after reset!
TARGET: nrf52.cpu - Not halted
in procedure 'reset' called at file "openocd.cfg", line 14
in procedure 'ocd_bouncer'

Telnet in to the OCD server

telnet localhost 4444

(must first apt-get install telnet)

Need to turn off access port protection

dap apreg 1 0x0c
dap apreg 1 0x04 0x01

To cross compile on Pi

gcc -mcpu=cortex-m4 -nostdlib <What Do YOU WANT>

Simple, but doesn't work:

error:target CPU does not support ARM mode

Flashing the nRF5x

Alternative BLE software stacks