J-Link Segger stops part way through programming on Ubuntu Linux

cancel
Showing results for 
Search instead for 
Did you mean: 

J-Link Segger stops part way through programming on Ubuntu Linux

639 Views
TomGibson
Contributor II

I am using MCUXpresso 11.4.1 on Ubuntu 20.04, with a J-Link "Base" unit and cannot successfully debug my board from within the IDE. I have cleared the debug configuration and created a new one with the auto-detected default values.

The issue is the JLinkServer stops part way through the process of programming the board and I can't understand why. The log from the JLinkServer terminal is as follows:

JLinkARM.dll V7.54b (DLL compiled Sep 14 2021 16:11:24)

Command line: -nosilent -swoport 2332 -select USB=50126301 -telnetport 2333 -singlerun -endian little -noir -speed auto -port 2331 -vd -device MK65FN2M0xxx18 -if SWD -halt -reportuseraction
-----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:      yes
Generate logfile:              off
Verify download:               on
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:                 MK65FN2M0xxx18
Target interface:              SWD
Target interface speed:        auto
Target endian:                 little

Connecting to J-Link...
J-Link is connected.
Device "MK65FN2M0XXX18" selected.
Firmware: J-Link V10 compiled Aug  9 2021 10:30:48
Hardware: V10.10
S/N: xxxxxxxx
Feature(s): GDB
Checking target voltage...
Target voltage: 3.35 V
Listening on TCP/IP port 2331
Connecting to target...
InitTarget()
Found SW-DP with ID 0x2BA01477
DPIDR: 0x2BA01477
Scanning AP map to find all available APs
AP[2]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x24770011)
AP[1]: JTAG-AP (IDR: 0x001C0000)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl[0] @ E00FF000
[0][0]: E000E000 CID B105E00D PID 000BB00C SCS-M7
[0][1]: E0001000 CID B105E00D PID 003BB002 DWT
[0][2]: E0002000 CID B105E00D PID 002BB003 FPB
[0][3]: E0000000 CID B105E00D PID 003BB001 ITM
[0][4]: E0040000 CID B105900D PID 000BB9A1 TPIU
[0][5]: E0041000 CID B105900D PID 000BB925 ETM
[0][6]: E0042000 CID B105900D PID 003BB907 ETB
[0][7]: E0043000 CID B105900D PID 001BB908 CSTF
InitTarget()
Found SW-DP with ID 0x2BA01477
DPIDR: 0x2BA01477
AP map detection skipped. Manually configured AP map found.
AP[0]: AHB-AP (IDR: Not set)
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl[0] @ E00FF000
[0][0]: E000E000 CID B105E00D PID 000BB00C SCS-M7
[0][1]: E0001000 CID B105E00D PID 003BB002 DWT
[0][2]: E0002000 CID B105E00D PID 002BB003 FPB
[0][3]: E0000000 CID B105E00D PID 003BB001 ITM
[0][4]: E0040000 CID B105900D PID 000BB9A1 TPIU
[0][5]: E0041000 CID B105900D PID 000BB925 ETM
[0][6]: E0042000 CID B105900D PID 003BB907 ETB
[0][7]: E0043000 CID B105900D PID 001BB908 CSTF
Connected to target
Waiting for GDB connection...Connected to 127.0.0.1
Reading all registers
Read 4 bytes @ address 0x00004988 (Data = 0xD1FB2B00)
Read 4 bytes @ address 0x00004BE0 (Data = 0xF003697B)
Reading 64 bytes @ address 0x20013D00
Reading 64 bytes @ address 0x20013D40
Connected to 127.0.0.1
Reading all registers
Read 4 bytes @ address 0x00004988 (Data = 0xD1FB2B00)
Read 4 bytes @ address 0x00004BE0 (Data = 0xF003697B)
Reading 64 bytes @ address 0x20013D00
Reading 64 bytes @ address 0x20013D40
Received monitor command: reset
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
AfterResetTarget()
Resetting target
Downloading 16016 bytes @ address 0x00000000 - Verified OK
Downloading 16096 bytes @ address 0x00003E90 - Verified OK
Downloading 16096 bytes @ address 0x00007D70 - Verified OK
Downloading 16144 bytes @ address 0x0000BC50 - Verified OK
Downloading 16096 bytes @ address 0x0000FB60 - Verified OK
Downloading 16160 bytes @ address 0x00013A40 - Verified OK
Downloading 16064 bytes @ address 0x00017960 - Verified OK
Downloading 16128 bytes @ address 0x0001B820 - Verified OK
Downloading 6504 bytes @ address 0x0001F720 - Verified OK
Downloading 280 bytes @ address 0x00021088 - Verified OK
J-Link: Flash download: Bank 0 @ 0x00000000: 1 range affected (139264 bytes)
J-Link: Flash download: Total: 2.221s (Prepare: 0.137s, Compare: 0.080s, Erase: 0.229s, Program & Verify: 1.706s, Restore: 0.066s)
J-Link: Flash download: Program & Verify speed: 79 KB/s
Writing register (PC = 0x     20c)
GDB closed TCP/IP connection (Socket 11)
GDB closed TCP/IP connection (Socket 10)

Server has been shut down.

The corresponding log from the GDB Server tab is as follows:

762,743 2-list-thread-groups
762,744 2^done,groups=[{id="i1",type="process"}]
762,745 (gdb) 
763,539 3-gdb-version
763,540 ~"GNU gdb (GNU Arm Embedded Toolchain 10-2020-q4-major) 10.1.90.20201028-git\n"
763,540 ~"Copyright (C) 2020 Free Software Foundation, Inc.\n"
763,540 ~"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."
763,540 ~"\nType \"show copying\" and \"show warranty\" for details.\n"
763,540 ~"This GDB was configured as \"--host=x86_64-linux-gnu --target=arm-none-eabi\".\n"
763,540 ~"Type \"show configuration\" for configuration details.\n"
763,540 ~"For bug reporting instructions, please see:\n"
763,540 ~"<https://www.gnu.org/software/gdb/bugs/>.\n"
763,540 ~"Find the GDB manual and other documentation resources online at:\n    <http://www.gnu.org/\
software/gdb/documentation/>."
763,540 ~"\n\n"
763,540 ~"For help, type \"help\".\n"
763,540 ~"Type \"apropos word\" to search for commands related to \"word\".\n"
763,540 3^done
763,540 (gdb) 
763,541 4-environment-cd /home/user/workingdir/frdmk66f_lwip_dhcp_usb_freer\
tos
763,541 4^done
763,541 (gdb) 
763,542 5-gdb-set breakpoint pending on
763,542 5^done
763,542 (gdb) 
763,542 6-enable-pretty-printing
763,542 6^done
763,542 (gdb) 
763,543 7-gdb-set python print-stack none
763,543 7^done
763,543 (gdb) 
763,543 8-gdb-set print object on
763,543 8^done
763,543 (gdb) 
763,544 9-gdb-set print sevenbit-strings on
763,544 9^done
763,544 (gdb) 
763,544 10-gdb-set charset ISO-8859-1
763,545 10^done
763,545 (gdb) 
763,546 11-gdb-set dprintf-style gdb
763,546 11^done
763,546 (gdb) 
763,547 12-gdb-set target-async on
763,547 12^done
763,547 (gdb) 
763,547 13-gdb-set auto-solib-add on
763,547 13^done
763,547 (gdb) 
763,551 14symbol-file /home/user/workingdir/frdmk66f_lwip_dhcp_usb_freertos\
/Debug/frdmk66f_lwip_dhcp_usb_freertos.axf

763,551 &"symbol-file /home/user/workingdir/frdmk66f_lwip_dhcp_usb_freertos\
/Debug/frdmk66f_lwip_dhcp_usb_freertos.axf\n"
763,552 ~"Reading symbols from /home/user/workingdir/frdmk66f_lwip_dhcp_usb\
_freertos/Debug/frdmk66f_lwip_dhcp_usb_freertos.axf...\n"
763,556 14^done
763,556 (gdb) 
763,556 &"\n"
763,556 ^done
763,556 (gdb) 
763,557 15-target-select remote localhost:2331

763,667 =thread-group-started,id="i1",pid="42000"
763,667 &"warning: No executable has been specified and target does not support\ndetermining executa\
ble automatically.  Try using the \"file\" command."
763,667 &"\n"
763,667 =thread-created,id="1",group-id="i1"
763,744 ~"0x00004988 in SysTick_DelayTicks (n=1000) at ../source/lwip_dhcp_usb_freertos.c:369\n"
763,744 ~"369\t\twhile (g_systickCounter != 0U) {\n"
763,744 *stopped,frame={addr="0x00004988",func="SysTick_DelayTicks",args=[{name="n",value="1000"}],f\
ile="../source/lwip_dhcp_usb_freertos.c",fullname="/home/user/workingdir/fr\
dmk66f_lwip_dhcp_usb_freertos/source/lwip_dhcp_usb_freertos.c",line="369",arch="arm"},thread-id="1",\
stopped-threads="all"
763,744 15^connected
763,744 (gdb) 
763,744 &"\n"
763,744 ^done
763,744 (gdb) 
763,747 16monitor reset
763,747 &"monitor reset\n"
763,842 @"Resetting target\r\n"
763,843 16^done
763,843 (gdb) 
763,845 17load /home/user/workingdir/frdmk66f_lwip_dhcp_usb_freertos/Debug/\
frdmk66f_lwip_dhcp_usb_freertos.axf 

764,124 18-list-thread-groups

Loading up the same project in MCUXpresso 11.4.1 on Windows, creating a new Debug configuration, and debugging with the same J-Link "Base" unit works fine.

What's different about my Ubuntu environment? I have tried clean installing MCUXpresso (using apt remove --purge to uninstall the mcuxpressoide and jlink packages then running the installer again) I have also created a fresh workspace and re-imported my project.

Unfortunately it is not trivial for me to try another sample from the SDK as the target is a custom board, and it took some time to change the sample to suit the hardware. I don't have any NXP dev kits to hand either, we have ordered some but they are hard to get hold of at the moment. In any case as the project builds and debugs just fine in the same version of the IDE on Windows I don't think the project is at issue.

Thanks in advance.

0 Kudos
3 Replies

604 Views
garabito
Contributor III

Hi TomGibson

I use Linux Gentoo to program a FRDM K64F, without a problems, so, I would like if you can post step by step what are you doing to get the problem (because the log don't say the problem), and when the problem happens, in a terminal write "dmesg" (maybe need a superuser access), take a screen shot, and show us. Maybe help us to see where the problem is. 

 

Best regards

Carlos Enrique 

0 Kudos

536 Views
TomGibson
Contributor II

Thanks for your reply. There isn't unfortunately anything in DMESG when the error occurs.

Since my post last week I have discovered I can create new projects from the SDK samples and debug these fine using the J-Link debugger, but old projects created a while ago do not debug. It may be something to do with they are created using SDK 2.7.0 rather than the latest 2.11.0, however if I create a new project based on an SDK 2.7.0 sample it builds and runs just fine.

It seems likely the issue is in my project configuration, but I'm not going to spend ages debugging this as we are moving to a new hardware platform with a new MCU shortly anyway, so I will be creating fresh projects which hopefully will avoid this issue.

632 Views
TomGibson
Contributor II

I have managed to get debugging working in MCUXpresso by installing the "Embedded C/C++ J-Link Debugging 6.1.2.202102181132" plugin from the repository https://download.eclipse.org/embed-cdt/updates/v6/ 

Why does this plugin work when the built in plugin does not?

0 Kudos