Closed matthiasbock closed 9 years ago
Now it magically works (??)
$ openocd -f openocd.cfg -c "init; sleep 500; nrf51 mass_erase; sleep 500; program main.elf" Open On-Chip Debugger 0.10.0-dev-g79fdeb3 (2015-08-10-22:55) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html adapter speed: 500 kHz Info : FTDI SWD mode enabled Warn : Transport "swd" was already selected cortex_m reset_config sysresetreq adapter speed: 1000 kHz Info : clock speed 1000 kHz Info : SWD IDCODE 0x0bb11477 Info : nrf51.cpu: hardware has 4 breakpoints, 2 watchpoints Info : nRF51822-QFAC(build code: A1) 256kB Flash target state: halted target halted due to debug-request, current mode: Thread xPSR: 0xc1000000 pc: 0xfffffffe msp: 0xfffffffc ** Programming Started ** auto erase enabled Warn : using fast async flash loader. This is currently supported Warn : only with ST-Link and CMSIS-DAP. If you have issues, add Warn : "set WORKAREASIZE 0" before sourcing nrf51.cfg to disable it Warn : target was in unknown state when halt was requested Info : SWD IDCODE 0x0bb11477 Error: error waiting for target flash write algorithm Error: Failed to write to nrf51 flash Error: error writing to flash at address 0x00000000 at offset 0x00000000 embedded:startup.tcl:454: Error: ** Programming Failed ** in procedure 'program' in procedure 'program_error' called at file "embedded:startup.tcl", line 510 at file "embedded:startup.tcl", line 454
$ openocd -f openocd.cfg -c "init; reset; nrf51 mass_erase; program main.elf" Open On-Chip Debugger 0.10.0-dev-g79fdeb3 (2015-08-10-22:55) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html adapter speed: 500 kHz Info : FTDI SWD mode enabled Warn : Transport "swd" was already selected cortex_m reset_config sysresetreq adapter speed: 1000 kHz Info : clock speed 1000 kHz Info : SWD IDCODE 0x0bb11477 Info : nrf51.cpu: hardware has 4 breakpoints, 2 watchpoints Error: nrf51.cpu -- clearing lockup after double fault target state: halted target halted due to debug-request, current mode: Handler HardFault xPSR: 0xc0000003 pc: 0xfffffffe msp: 0xaf00b560 Polling target nrf51.cpu failed, trying to reexamine Info : nrf51.cpu: hardware has 4 breakpoints, 2 watchpoints Info : nRF51822-QFAC(build code: A1) 256kB Flash target state: halted target halted due to debug-request, current mode: Thread xPSR: 0xc1000000 pc: 0xfffffffe msp: 0xfffffffc ** Programming Started ** auto erase enabled Warn : using fast async flash loader. This is currently supported Warn : only with ST-Link and CMSIS-DAP. If you have issues, add Warn : "set WORKAREASIZE 0" before sourcing nrf51.cfg to disable it wrote 1024 bytes from file main.elf in 0.065361s (15.300 KiB/s) ** Programming Finished **
As the warning states, setting the WORKAREASIZE to zero prior to flashing resolves the issue:
openocd -c "set WORKAREASIZE 0;" -f openocd.cfg -c "init; reset halt; program main.bin 0x00 verify; shutdown;"