lpcware

Problems debugging

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 18, 2016 by lpcware
Content originally posted in LPCWare by miccio on Thu Mar 24 09:51:43 MST 2016
Hello everyone,

and happy Maundy Thursday. In the past weeks, I have been struggling with a pretty annoying behaviour of LPCXpresso debugging system.
After clicking the "Debug" button in the Quickstart view, I get welcomed with the following 2 error messages:

"Problem Occurred" window

Error in final launch sequence
  Failed to execute MI command:
  -target-download
Error message from debugger back end:
Error finishing flash operation
Error finishing flash operation


"Error reported by target" window

15: Target error from Commit Flash write
  15: Target error from Commit Flash write
  System rejected access at location 0x02001760 - verify Population of memory and peripherals


The error would occur on a semi-random time basis, and common actions like deleting the .launch files, replugging the probe, power-cycling the board etc are rarely effective (after several observations I'd say that they're pretty irrelevant).
The memory location mentioned in the error message varies too, although it would more or less consistently complain about the same chunk - 0x02001000 to 0x02003000 approximately.

My system is a Linux Mint 17.2 (based on Ubuntu 14.04 LTS).
I'm running LPCXpresso 8.1.2 - I know it's not the latest but the problem was occurring with previous versions too.
The debugger probe I use is a LPCXpresso1549 board, flashed with the newest CMSIS-DAP firmware: v5.147.
The debugging target is a custom board featuring an LPC1549JBD64 and connects to the debugger with a standard Cortex Debug Connector (2x5 pins).
The target is powered through an external power supply, and the 3.3V regulator is capable of delivering up to 1A.

Here's the connection diagram for the pin headers:
1 - 3V3
3 - GND
5 - GND
7 - N.C.
9 - GND

2 - SWDIO (pin 44) pulled high
4 - SWCLK (pin 40) pulled low
6 - N.C.
8 - N.C.
10 - nRST (pin 45) pulled high

All pull-up/pull-down resistors are 10K.


Here is the output from the RedlinkServer terminal:

[Started server]
[Connected on port 3025]
redlink>ProbeList
Index = 1
Manufacturer = NXP Semiconductors
Description = LPC-LINK2 CMSIS-DAP V5.147
Serial Number = LRAYAQAR
VID:PID = 1FC9:0090
Path = /dev/hidraw3
redlink>ProbeStatus
Index = 1
Manufacturer = NXP Semiconductors
Description = LPC-LINK2 CMSIS-DAP V5.147
Serial Number = LRAYAQAR
VID:PID = 1FC9:0090
Path = /dev/hidraw3
IsOpen = FALSE
WireInitialized = FALSE
WireProtocol = JTAG
CoresConfigured = FALSE
PacketSize = 1024
Reference Count = 0
HasSWV = FALSE
HasETM = FALSE
HasJTAG = TRUE
HasSWD = TRUE
Probe Type = CMSIS-DAP
Probe Reference Count = 0
redlink>ProbeIsOpen 1
FALSE
redlink>ProbeOpenByIndex 1
Probe Handle 1 Open
redlink>WireIspReset 1
redlink>ProbeStatus
Index = 1
Manufacturer = NXP Semiconductors
Description = LPC-LINK2 CMSIS-DAP V5.147
Serial Number = LRAYAQAR
VID:PID = 1FC9:0090
Path = /dev/hidraw3
IsOpen = FALSE
WireInitialized = FALSE
WireProtocol = JTAG
CoresConfigured = FALSE
PacketSize = 1024
Reference Count = 0
HasSWV = FALSE
HasETM = FALSE
HasJTAG = TRUE
HasSWD = TRUE
Probe Type = CMSIS-DAP
Probe Reference Count = 0
redlink>quit
[Closed]


...from the gdb traces terminal:

265,012 2-gdb-version
265,013 ~"GNU gdb (GNU Tools for ARM Embedded Processors) 7.10.1.20151217-cvs-LPCXpresso001\n"
265,014 ~"Copyright (C) 2015 Free Software Foundation, Inc.\n"
265,014 ~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is fre\
e software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitt\
ed by law.  Type \"show copying\"\nand \"show warranty\" for details.\n"
265,014 ~"This GDB was configured as \"--host=i686-linux-gnu --target=arm-none-eabi\".\nType \"show \
configuration\" for configuration details."
265,014 ~"\nFor bug reporting instructions, please see:\n"
265,014 ~"<http://www.gnu.org/software/gdb/bugs/>.\n"
265,014 ~"Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/soft\
ware/gdb/documentation/>.\n"
265,014 ~"For help, type \"help\".\n"
265,014 ~"Type \"apropos word\" to search for commands related to \"word\".\n"
265,014 2^done
265,015 (gdb)
265,016 3-environment-cd /home/miccio/das-gimbal/firmware/gimbal
265,016 3^done
265,016 (gdb)
265,017 4-gdb-set breakpoint pending on
265,017 4^done
265,017 (gdb)
265,018 5-enable-pretty-printing
265,018 5^done
265,018 (gdb)
265,019 6-gdb-set python print-stack none
265,020 6^done
265,020 (gdb)
265,021 7-gdb-set print object on
265,021 7^done
265,021 (gdb)
265,022 8-gdb-set print sevenbit-strings on
265,023 8^done
265,023 (gdb)
265,023 9-gdb-set charset ISO-8859-1
265,024 9^done
265,024 (gdb)
265,025 10-gdb-set auto-solib-add on
265,025 10^done
265,026 (gdb)
265,029 11-file-exec-and-symbols --thread-group i1 /home/miccio/das-gimbal/firmware/gimbal/Debug/das\
-gimbal.axf
265,152 11^done
265,152 (gdb)
265,157 12-interpreter-exec console "set remotetimeout 60000"
265,157 =cmd-param-changed,param="remotetimeout",value="60000"
265,157 12^done
265,158 (gdb)
265,248 13-target-select extended-remote | crt_emu_cm_redlink -msg-port=54177 -g -mi -2 -pLPC1549 -v\
endor=NXP -vc -ConnectScript=LPC15RunBootRomConnect.scp -ResetScript=LPC15RunBootRomReset.scp -reset\
= -ProbeHandle=1 -CoreIndex=0 -flash-driver=LPC15xx_256K.cfx
265,852 =thread-group-started,id="i1",pid="42000"
265,852 =thread-created,id="1",group-id="i1"
265,853 14-list-thread-groups --available
265,865 ~"0x030000b8 in ?? ()\n"
265,865 *stopped,frame={addr="0x030000b8",func="??",args=[]},thread-id="1",stopped-threads="all"
265,865 13^connected
265,865 (gdb)
265,865 14^error,msg="Can not fetch data now."
265,866 (gdb)
265,912 15-interpreter-exec console "set mem inaccessible-by-default off"
265,912 =cmd-param-changed,param="mem inaccessible-by-default",value="off"
265,912 15^done
265,912 (gdb)
265,914 16-interpreter-exec console "mon ondisconnect cont"
265,914 16^done
265,914 (gdb)
265,915 17-interpreter-exec console "set arm force-mode thumb"
265,916 =cmd-param-changed,param="arm force-mode",value="thumb"
265,916 17^done
265,916 (gdb)
265,918 18-interpreter-exec console "mon capabilities"
265,919 18^done
265,919 (gdb)
265,921 19-interpreter-exec console "set remote hardware-breakpoint-limit 6"
265,922 =cmd-param-changed,param="remote hardware-breakpoint-limit",value="6"
265,922 19^done
265,922 (gdb)
265,923 20-interpreter-exec console "mon semihost enable"
265,924 20^done
265,924 (gdb)
265,925 21-interpreter-exec console "mon info,all"
265,926 21^done
265,977 (gdb)
266,356 22-data-list-register-names
266,357 22^done,register-names=["r0","r1","r2","r3","r4","r5","r6","r7","r8","r9","r10","r11","r12",\
"sp","lr","pc","","","","","","","","","","xpsr","","","","","","","","","","","","","","","","","",\
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\
","","","","","","","","","","","","","","","cycles"]
266,357 (gdb)
266,359 23-target-download
266,361 23+download,{section=".text",section-size="90640",total-size="765449"}
266,363 23+download,{section=".ARM.exidx",section-size="8",total-size="765449"}
266,364 23+download,{section=".data",section-size="176",total-size="765449"}
266,564 24-list-thread-groups
266,820 23^error,msg="Error finishing flash operation"
266,820 (gdb)
266,821 24^error,msg="Reply contains invalid hex digit 111"
266,821 (gdb)
266,824 25-target-disconnect
266,824 26-gdb-exit
266,857 =thread-group-exited,id="i1"
266,857 25^done
266,857 (gdb)
266,857 26^exit


...and from the Debug messages terminal:

LPCXpresso RedlinkMulti Driver v8.1 (Mar  4 2016 17:16:40 - crt_emu_cm_redlink build 659)
============= SCRIPT: LPC15RunBootRomConnect.scp =============
No probes found
DpID = 2BA01477
AP_ID = 0x24770011
Halt on reset vector catch
Halt on watchpoint write of ROMWSCTRL register
============= END SCRIPT =====================================
Probe Firmware: LPC-LINK2 CMSIS-DAP V5.147 (NXP Semiconductors)
Serial Number:  LRAYAQAR
VID:PID:  1FC9:0090
USB Path: /dev/hidraw3
Vector catch on SYSRESETREQ signal
Emu(0): Connected&Reset. DpID: 2BA01477. CpuID: 410FC230. Info: <None>
Debug protocol: SWD. RTCK: Disabled. Vector catch: Enabled.
inspected v.2 On-chip Flash Memory /usr/local/lpcxpresso_8.1.2_603/lpcxpresso/bin/Flash/LPC15xx_256K.cfx
image 'LPC15 (256K Flash) Feb 16 2016 09:18:59'
NXP: LPC1549  Part ID: 0x00000000
( 65) Chip Setup Complete
Connected: was_reset=true. was_stopped=true
LPCXpresso Free License - Download limit is 256K
Writing 90824 bytes to address 0x00000000 in Flash
Target error from Commit Flash write: Em(12). System rejected access at location 0x02001760 - verify Population of memory and peripherals
(crt_emu_cm_redlink) terminating on communication loss: Pipe has been closed by GDB.


I hope someone of you knows what's going on, thanks in advance.

Outcomes