Hi,
This is the continuation of the SF ticket 103:
https://sourceforge.net/p/openocd/tickets/103/
Refer to the aforementioned ticket for background information.
*Reply to the ticket*
> a code page size of zero is because of a bad SWD connection, yes?
It's not about the bad SWD connection, but rather about the bug in the
chip. The chip is: nRF51822 QFAACA.
The problem is that, in some revisions of the chip, if you enter
SYSTEMOFF mode, it's not possible for the debugger to connect to the
chip any more. To connect again, you either have to wake-up the chip or
recover the chip using Nordic's nrfjprog.
> It's still a fatal error, but openocd should just print an error and fail
> cleanly instead of crashing?
Well, you know the answer;) Generally, when I write the code and I have
to handle data coming from the outside (e.g. some SPI sensor, etc.) I
perform checks if the data is not rubbish.
Anyway, here comes the test case for the problem:
################################################################################
# Correctly working case:
################################################################################
#include "nrf.h"
/******************************************************************************/
int main(void)
/******************************************************************************/
{
while (1)
{
asm("nop");
asm("nop");
}
return 0;
}
################################################################################
$ openocd -f interface/jlink.cfg -c "transport select swd" -f
target/nrf51.cfg
################################################################################
Open On-Chip Debugger 0.9.0 (2015-07-13-14:05)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : JLink SWD mode enabled
swd
cortex_m reset_config sysresetreq
adapter speed: 1000 kHz
Info : J-Link Lite-Cortex-M V8 compiled Aug 20 2015 17:57:19
Info : J-Link caps 0xb8ea7a3b
Info : J-Link hw version 80000
Info : J-Link hw type J-Link
Info : J-Link max mem block 7664
Info : J-Link configuration
Info : USB-Address: 0x0
Info : Kickstart power on JTAG-pin 19: 0xffffffff
Info : Vref = 3.875 TCK = 0 TDI = 0 TDO = 1 TMS = 1 SRST = 1 TRST = 1
Info : J-Link JTAG Interface ready
Info : clock speed 1000 kHz
Info : SWD IDCODE 0x0bb11477
Info : nrf51.cpu: hardware has 4 breakpoints, 2 watchpoints
Info : accepting 'telnet' connection on tcp/4444
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x0000005e msp: 0x200007fc
Info : nRF51822-QFAA(build code: CA/C0) 256kB Flash
################################################################################
$ telnet localhost 4444
################################################################################
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> halt
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x0000005e msp: 0x200007fc
> nrf51 mass_erase
nRF51822-QFAA(build code: CA/C0) 256kB Flash
################################################################################
# Case when OpenOCD breaks:
################################################################################
#include "nrf.h"
/******************************************************************************/
int main(void)
/******************************************************************************/
{
while (1)
{
asm("nop");
asm("nop");
NRF_POWER->SYSTEMOFF = 1UL;
}
return 0;
}
################################################################################
$ openocd -f interface/jlink.cfg -c "transport select swd" -f
target/nrf51.cfg
################################################################################
Open On-Chip Debugger 0.9.0 (2015-07-13-14:05)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : JLink SWD mode enabled
swd
cortex_m reset_config sysresetreq
adapter speed: 1000 kHz
Info : J-Link Lite-Cortex-M V8 compiled Aug 20 2015 17:57:19
Info : J-Link caps 0xb8ea7a3b
Info : J-Link hw version 80000
Info : J-Link hw type J-Link
Info : J-Link max mem block 7664
Info : J-Link configuration
Info : USB-Address: 0x0
Info : Kickstart power on JTAG-pin 19: 0xffffffff
Info : Vref = 3.882 TCK = 0 TDI = 0 TDO = 1 TMS = 1 SRST = 1 TRST = 1
Info : J-Link JTAG Interface ready
Info : clock speed 1000 kHz
Info : SWD IDCODE 0x0bb11477
Info : nrf51.cpu: hardware has 4 breakpoints, 2 watchpoints
Info : accepting 'telnet' connection on tcp/4444
Info : Halt timed out, wake up GDB.
Error: timed out while waiting for target halted
Warn : Unknown device (HWID 0x00000000)
Floating point exception
################################################################################
$ telnet localhost 4444
################################################################################
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> halt
Halt timed out, wake up GDB.
timed out while waiting for target halted
> nrf51 mass_erase
Unknown device (HWID 0x00000000)
Connection closed by foreign host.
--
Best regards,
Andrzej Telszewski
------------------------------------------------------------------------------
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel