-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Hi all,
I need to debug LPC1768 in MKS SBASE v1.3; my origin target was to debug Marlin 2.0. OS is Windows 10 Pro 64bit. I'm using the older original SEGGER version of J-Link Lite. I'm able to connect to the board and talk to LPC1768 via SEGGER's tools, but I didn't manage to get debugging from Platformio working. In order to reduce complexity, I tried to make naked LPC17xx project within Platformio from the scratch, compiled t and ended with following report by trying the debug:
> Executing task: C:\Users\Jirka\.platformio\penv\Scripts\platformio.exe run --target upload <
Processing nxp_lpc1768 (platform: nxplpc-arduino-lpc176x; board: nxp_lpc1768; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nxplpc-arduino-lpc176x/nxp_lpc1768.html
PLATFORM: NXP Arduino LPC176x 0.0.2 > NXP LPC1768
HARDWARE: LPC1768 100MHz, 31.80KB RAM, 464KB Flash
DEBUG: Current (jlink) On-board (cmsis-dap) External (blackmagic, jlink)
PACKAGES: toolchain-gccarmnoneeabi 1.80201.190214 (8.2.1), framework-arduino-lpc176x 0.1.3
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 5 compatible libraries
Scanning dependencies...
No dependencies
Linking .pio\build\nxp_lpc1768\firmware.elf
Building .pio\build\nxp_lpc1768\firmware.bin
Checking size .pio\build\nxp_lpc1768\firmware.elf
Memory Usage -> http://bit.ly/pio-memory-usage
DATA: [ ] 3.3% (used 1077 bytes from 32568 bytes)
PROGRAM: [ ] 2.9% (used 13656 bytes from 475136 bytes)
Configuring upload protocol...
AVAILABLE: blackmagic, cmsis-dap, jlink, mbed
CURRENT: upload_protocol = jlink
Uploading .pio\build\nxp_lpc1768\firmware.bin
SEGGER J-Link Commander V6.52e (Compiled Oct 16 2019 12:18:04)
DLL version V6.52e, compiled Oct 16 2019 12:16:54
J-Link Command File read successfully.
Processing script file...
J-Link connection not established yet but required for command.
Connecting to J-Link via USB...O.K.
Firmware: J-Link ARM Lite V8 compiled Mar 14 2018 16:03:26
Hardware version: V8.00
S/N: 228001020
VTref=3.274V
Target connection not established yet but required for command.
Device "LPC1768" selected.
Connecting to target via SWD
Found SW-DP with ID 0x2BA01477
Scanning AP map to find all available APs
AP[1]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x24770011)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x412FC230. Implementer code: 0x41 (ARM)
Found Cortex-M3 r2p0, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl[0] @ E00FF000
ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 002BB000 SCS
ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 002BB002 DWT
ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 002BB001 ITM
ROMTbl[0][4]: E0040000, CID: B105900D, PID: 002BB923 TPIU-Lite
ROMTbl[0][5]: E0041000, CID: B105900D, PID: 002BB924 ETM-M3
Cortex-M3 identified.
PC = 1FFF0BA2, CycleCnt = FDD1B8FC
R0 = F0000000, R1 = 10000124, R2 = 00000105, R3 = 40084000
R4 = 2009C000, R5 = 00000002, R6 = 40008000, R7 = 00000000
R8 = 4002C000, R9 = 35DF789E, R10= 792E0881, R11= 993EB519
R12= 00000107
SP(R13)= 10007FB8, MSP= 10007FB8, PSP= 6FFD9548, R14(LR) = 1FFF0CBF
XPSR = A1000000: APSR = NzCvq, EPSR = 01000000, IPSR = 000 (NoException)
CFBP = 00000000, CONTROL = 00, FAULTMASK = 00, BASEPRI = 00, PRIMASK = 00
FPU regs: FPU not enabled / not implemented on connected CPU.
Downloading file [.pio\build\nxp_lpc1768\firmware.bin]...
Writing target memory failed.
Reset delay: 0 ms
Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
Script processing completed.
Due to doubts about Platformio's support for old J-Link Lite I made following steps just now:
- I borrowed the original SEGGER's J-Link PRO
- I did uninstall all SEGGER applications and drivers
- I created once a new project for LPC17xx within Platformio and compiled it successfuly
- I connected J-Link to PC and to the MKS SBASE board
- I tried to run debugging session, letting Platformio to install necessary dependencies
==> it was trying to use mbed protocol, hence I modified platformio.ini as follows:
[env:nxp_lpc1768]
platform = nxplpc-arduino-lpc176x
board = nxp_lpc1768
framework = arduino
debug_tool = jlink
upload_protocol = jlink
- after this I'm getting following report:
> Executing task: C:\Users\Jirka\.platformio\penv\Scripts\platformio.exe run --target upload <
Processing nxp_lpc1768 (platform: nxplpc-arduino-lpc176x; board: nxp_lpc1768; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nxplpc-arduino-lpc176x/nxp_lpc1768.html
PLATFORM: NXP Arduino LPC176x 0.0.2 > NXP LPC1768
HARDWARE: LPC1768 100MHz, 31.80KB RAM, 464KB Flash
DEBUG: Current (jlink) On-board (cmsis-dap) External (blackmagic, jlink)
PACKAGES: toolchain-gccarmnoneeabi 1.80201.190214 (8.2.1), framework-arduino-lpc176x 0.1.3
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 5 compatible libraries
Scanning dependencies...
No dependencies
Compiling .pio\build\nxp_lpc1768\src\main.cpp.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\debug_frmwrk.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\lpc17xx_adc.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\lpc17xx_can.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\lpc17xx_clkpwr.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\lpc17xx_dac.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\lpc17xx_emac.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\lpc17xx_exti.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\lpc17xx_gpdma.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\lpc17xx_gpio.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\lpc17xx_i2c.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\lpc17xx_i2s.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\lpc17xx_iap.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\lpc17xx_libcfg_default.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\lpc17xx_mcpwm.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\lpc17xx_nvic.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\lpc17xx_pinsel.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\lpc17xx_pwm.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\lpc17xx_qei.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\lpc17xx_rit.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\lpc17xx_rtc.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\lpc17xx_spi.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\lpc17xx_ssp.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\lpc17xx_systick.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\lpc17xx_timer.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\lpc17xx_uart.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\driver\lpc17xx_wdt.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\lib\chanfs\ff.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\lib\chanfs\ffunicode.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\lib\chanfs\mmc_ssp.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\lib\chanfs\rtc176x.c.o
Compiling .pio\build\nxp_lpc1768\CMSIS\lib\usb\cdcuser.cpp.o
Compiling .pio\build\nxp_lpc1768\CMSIS\lib\usb\mscuser.cpp.o
Compiling .pio\build\nxp_lpc1768\CMSIS\lib\usb\usbcore.cpp.o
Compiling .pio\build\nxp_lpc1768\CMSIS\lib\usb\usbdesc.cpp.o
Compiling .pio\build\nxp_lpc1768\CMSIS\lib\usb\usbhw.cpp.o
Compiling .pio\build\nxp_lpc1768\CMSIS\lib\usb\usbuser.cpp.o
Compiling .pio\build\nxp_lpc1768\CMSIS\system\startup_LPC17xx.S.o
Compiling .pio\build\nxp_lpc1768\CMSIS\system\system_LPC17xx.c.o
Compiling .pio\build\nxp_lpc1768\FrameworkArduino\CDCSerial.cpp.o
Compiling .pio\build\nxp_lpc1768\FrameworkArduino\HardwarePWM.cpp.o
Compiling .pio\build\nxp_lpc1768\FrameworkArduino\HardwareSerial0.cpp.o
Compiling .pio\build\nxp_lpc1768\FrameworkArduino\HardwareSerial1.cpp.o
Compiling .pio\build\nxp_lpc1768\FrameworkArduino\HardwareSerial2.cpp.o
Compiling .pio\build\nxp_lpc1768\FrameworkArduino\HardwareSerial3.cpp.o
Compiling .pio\build\nxp_lpc1768\FrameworkArduino\Print.cpp.o
Archiving .pio\build\nxp_lpc1768\libCMSIS.a
Compiling .pio\build\nxp_lpc1768\FrameworkArduino\SoftwarePWM.cpp.o
Compiling .pio\build\nxp_lpc1768\FrameworkArduino\SoftwareSPI.cpp.o
Compiling .pio\build\nxp_lpc1768\FrameworkArduino\SoftwareSerial.cpp.o
Compiling .pio\build\nxp_lpc1768\FrameworkArduino\Stream.cpp.o
Compiling .pio\build\nxp_lpc1768\FrameworkArduino\Tone.cpp.o
Compiling .pio\build\nxp_lpc1768\FrameworkArduino\WInterrupts.cpp.o
Compiling .pio\build\nxp_lpc1768\FrameworkArduino\Wire.cpp.o
Compiling .pio\build\nxp_lpc1768\FrameworkArduino\arduino.cpp.o
Compiling .pio\build\nxp_lpc1768\FrameworkArduino\main.cpp.o
Compiling .pio\build\nxp_lpc1768\FrameworkArduino\pwm.cpp.o
Archiving .pio\build\nxp_lpc1768\libFrameworkArduino.a
Linking .pio\build\nxp_lpc1768\firmware.elf
Building .pio\build\nxp_lpc1768\firmware.bin
Checking size .pio\build\nxp_lpc1768\firmware.elf
Memory Usage -> http://bit.ly/pio-memory-usage
DATA: [ ] 3.3% (used 1077 bytes from 32568 bytes)
PROGRAM: [ ] 2.9% (used 13656 bytes from 475136 bytes)
Configuring upload protocol...
AVAILABLE: blackmagic, cmsis-dap, jlink, mbed
CURRENT: upload_protocol = jlink
Uploading .pio\build\nxp_lpc1768\firmware.bin
'JLink.exe' is not recognized as an internal or external command,
operable program or batch file.
*** [upload] Error 1
================================================================================================== [FAILED] Took 5.08 seconds ==================================================================================================
The terminal process terminated with exit code: 1
Terminal will be reused by tasks, press any key to close it.
and DEBUG CONSOLE:
undefinedError:
Could not launch Debug Server 'JLinkGDBServerCL.exe'. Please check that it is installed and is included in a system PATH
- I'm very fresh PlatformIO beginner, so I'm not sure, whether my expectation, that Platformio is able to detect J-Link by itself and install all needed SW is correct, hence next step -> I do install SEGGER J-Link package V652e once more by myself... (for the installation I selected "New Instance")
- I added the correct path to GDB server into system PATH variable as well
- Connection J-Link Pro <-> LPC1768 works, I can erase and program FLASH of LPC
- attempt for debugging session -> the same result as above (before installin SEEGER's J-Link package) - and the result is pretty much the same, I have seen with origin Marlin project and that old J-Link Lite:
DEBUG CONSOLE:
undefinedSEGGER J-Link GDB Server V6.52e Command Line Version
JLinkARM.dll V6.52e (DLL compiled Oct 16 2019 12:16:54)
Command line: -singlerun -if SWD -select USB -device LPC1768 -port 2331
-----GDB Server start settings-----
GDBInit file: none
GDB Server Listening port: 2331
SWO raw output listening port: 2332
Terminal I/O port: 2333
Accept remote connection: localhost only
Generate logfile: off
Verify download: off
Init regs on start: off
Silent mode: off
Single run mode: on
Target connection timeout: 0 ms
------J-Link related settings------
J-Link Host interface: USB
J-Link script: none
J-Link settings file: none
------Target related settings------
Target device: LPC1768
Target interface: SWD
Target interface speed: 4000kHz
Target endian: little
Connecting to J-Link...
Reading symbols from c:\Users\Jirka\Documents\PlatformIO\Projects\LPC1768_JLink\.pio\build\nxp_lpc1768\firmware.elf...
undefinedC:\Users\Jirka\.platformio\packages\toolchain-gccarmnoneeabi\bin\arm-none-eabi-gdb.exe: warning: Couldn't determine a path for the index cache directory.
PlatformIO Unified Debugger -> http://bit.ly/pio-debug
PlatformIO: debug_tool = jlink
PlatformIO: Initializing remote target...
.pioinit:14: Error in sourced command file:
:2331: Nemohlo b�t vytvo�eno ��dn� p�ipojen�, proto�e c�lov� po��ta� je aktivn� odm�tl.
(the last sentence says: "Connection wasn't established because it was actively refused by target computer")
- Interesting change did happen when I started the SEGGER's GDB server manualy before trying the degbugging session in Platformio - DEBUG CONSOLE:
undefinedSEGGER J-Link GDB Server V6.52e Command Line Version
JLinkARM.dll V6.52e (DLL compiled Oct 16 2019 12:16:54)
Command line: -singlerun -if SWD -select USB -device LPC1768 -port 2331
-----GDB Server start settings-----
GDBInit file: none
GDB Server Listening port: 2331
SWO raw output listening port: 2332
Terminal I/O port: 2333
Accept remote connection: localhost only
Generate logfile: off
Verify download: off
Init regs on start: off
Silent mode: off
Single run mode: on
Target connection timeout: 0 ms
------J-Link related settings------
J-Link Host interface: USB
J-Link script: none
J-Link settings file: none
------Target related settings------
Target device: LPC1768
Target interface: SWD
Target interface speed: 4000kHz
Target endian: little
Connecting to J-Link...
Reading symbols from c:\Users\Jirka\Documents\PlatformIO\Projects\LPC1768_JLink\.pio\build\nxp_lpc1768\firmware.elf...
undefinedC:\Users\Jirka\.platformio\packages\toolchain-gccarmnoneeabi\bin\arm-none-eabi-gdb.exe: warning: Couldn't determine a path for the index cache directory.
PlatformIO Unified Debugger -> http://bit.ly/pio-debug
PlatformIO: debug_tool = jlink
PlatformIO: Initializing remote target...
0x1fff0ba4 in ?? ()
Temporary breakpoint 1 at 0x45d4: file C:\Users\Jirka\.platformio\packages\framework-arduino-lpc176x\cores\arduino\main.cpp, line 43.
J-Link is connected.
Firmware: J-Link Pro V4 compiled Aug 12 2019 10:38:28
Hardware: V4.00
S/N: 174300738
Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB
Checking target voltage...
Target voltage: 3.33 V
ERROR: Failed to listen at socket (Err = -1)
ERROR: Failed to open listener port 2331
Resetting target
Loading section .text, size 0x33ec lma 0x4000
Loading section .ARM.exidx, size 0x8 lma 0x73ec
Loading section .data, size 0x28c lma 0x73f4
Start address 0x41e8, load size 13952
Restoring target state and closing J-Link connection...
Transfer rate: 3406 KB/sec, 4650 bytes/write.
Shutting down...
Failed to open listener port 2331
Resetting target
PlatformIO: Initialization completed
PlatformIO: Resume the execution to `debug_init_break = tbreak main`
PlatformIO: More configuration options -> http://bit.ly/pio-debug
========================
Sorry for long message. I just wanted to provide you with as much of details as possible, because I have to return back the J-Link Pro tomorrow morning.
May i please ask you for creating smallest possible project for generic LPC1768 and configure it for successful debugging via J-Link?
With such a working reference it might be easier for me to investigate for root cause on my side.
Thank you in advance
brgds
dzejaar