Questions about crt_emu_cm_redlink

cancel
Showing results for 
Search instead for 
Did you mean: 

Questions about crt_emu_cm_redlink

Jump to solution
1,545 Views
nxa15473
NXP Employee
NXP Employee

1. How to use "<MCUXPressoIDE>/ide/bin/crt_emu_cm_redlink.exe" and gdb to debugging the program, rather that the GUI? I find a post redscript / redlink commandline usage | www.LPCware.com, but this is not useful for me. 

2. And how about the gdb commands for redlink server? I not find it in user's guide.

3. Does the crt_emu_cm_redlink support to download exetuable files from other compilers to flash? I tried that there is no error in the programming process, but the program start failure.

Thanks 

Labels (1)
0 Kudos
1 Solution
788 Views
lpcxpresso_supp
NXP Employee
NXP Employee

The first question I always ask is why you would want to use the GDB+crt_emu_cm_nxp standalone? You can certainly debug this way, but it's not the best use of your time. The crt_emu_cm_nxp console application is used by GDB as a target extended remote.

Example GDB setup using crt_emu_cm_nxp:

(gdb) set remotetimeout 100000
(gdb) target extended-remote | ./| crt_emu_cm_redlink -msg-port=1838 -g -mi -2 -pMK64FN1M0xxx12 -vendor=NXP -reset= -ProbeHandle=1 -CoreIndex=0 -cache=disable -x C:/Users/Haley/mcuxpresso/01/mcuxpressoide_packages_support/MK64FN1M0xxx12_support --flash-dir C:/Users/Haley/mcuxpresso/01/.mcuxpressoide_packages_support/MK64FN1M0xxx12_support/Flash
(gdb) set mem inaccessible-by-default off
(gdb) mon ondisconnect continue
(gdb) set arm force-mode thumb

(gdb) file <path>\example.axf

(gdb) load

The MCUXpresso gdb-traces console gives an example of the stub command line used by the GUI but this would need to be modified for standalone use (see above),. To name two changes, the '--mi' and ''--msg-port' options must be removed.

The Redlink server does not use GDB commands. It has its' own command set. The HELP command will list the available commands. What are you trying to do here? The

MCUXpresso RedlinkServer console will capture example debug connections. You can also review connect/reset script examples within the Scripts folder of your installation. The Redlink server manual is pending release.

Thanks and regards,

MCUXpresso Support

EDIT: NXP does not support GDB standalone debug, so you'll need to rely on the forum for future help.

View solution in original post

0 Kudos
6 Replies
789 Views
lpcxpresso_supp
NXP Employee
NXP Employee

The first question I always ask is why you would want to use the GDB+crt_emu_cm_nxp standalone? You can certainly debug this way, but it's not the best use of your time. The crt_emu_cm_nxp console application is used by GDB as a target extended remote.

Example GDB setup using crt_emu_cm_nxp:

(gdb) set remotetimeout 100000
(gdb) target extended-remote | ./| crt_emu_cm_redlink -msg-port=1838 -g -mi -2 -pMK64FN1M0xxx12 -vendor=NXP -reset= -ProbeHandle=1 -CoreIndex=0 -cache=disable -x C:/Users/Haley/mcuxpresso/01/mcuxpressoide_packages_support/MK64FN1M0xxx12_support --flash-dir C:/Users/Haley/mcuxpresso/01/.mcuxpressoide_packages_support/MK64FN1M0xxx12_support/Flash
(gdb) set mem inaccessible-by-default off
(gdb) mon ondisconnect continue
(gdb) set arm force-mode thumb

(gdb) file <path>\example.axf

(gdb) load

The MCUXpresso gdb-traces console gives an example of the stub command line used by the GUI but this would need to be modified for standalone use (see above),. To name two changes, the '--mi' and ''--msg-port' options must be removed.

The Redlink server does not use GDB commands. It has its' own command set. The HELP command will list the available commands. What are you trying to do here? The

MCUXpresso RedlinkServer console will capture example debug connections. You can also review connect/reset script examples within the Scripts folder of your installation. The Redlink server manual is pending release.

Thanks and regards,

MCUXpresso Support

EDIT: NXP does not support GDB standalone debug, so you'll need to rely on the forum for future help.

View solution in original post

0 Kudos
55 Views
vdupaquis
Contributor I

One of the reasons not to use mcuexpresso is to setup automated testing (continous integration).

If, for instance I want to setup a docker image for running a non-regression of my application, I will probably want to have only the gdb-server, and I won't use MCUExpresso.

For instance, this is easy with STM32 parts, as st-util (which is the gdbserver) is available as a debian package, where with NxP, you need to grab the whole MCUexpresso package ...

Vincent.

0 Kudos
788 Views
martin_elshuber
Contributor I

Hi,

I also want to use GDB (command line) in with my PN7462AU soldered on one of your devkits, and I have a similar problem but the solution only works partially.

Basically I extracted the commands from MCUX presso IDE and tried the following commands (including variations)

set non-stop on
set pagination off
set mi-async
set remotetimeout 60000
target extended-remote | crt_emu_cm_redlink -g -2 -pPN7462AU-C3-00 -vendor=NXP -ConnectScript=PN7xxxxx_Connect.scp -ResetScript=PN7xxxxx_Reset.scp -reset= --flash-driver PN7xxxxx_158k.cfx
set mem inaccessible-by-default off
mon ondisconnect cont
set arm force-mode thumb
mon capabilities
set remote hardware-breakpoint-limit 4
file PN7462AU_ex_phExCcid.axf

load

run

Loading and running works, however when hitting ^C to stop the target I get the error "No support for interrupting the remote target."

However I know that the target supports this because within the MCUX presso IDE stopping works as expected.

I am using the LPC Link 2 Probe and a PNEV7462B development board. My host OS is Linux (a recent Debian)

kr Martin

Here is a the output of gdb:

arm-none-eabi-gdb
GNU gdb (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 8.0.50.20171128-git
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-linux-gnu --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) set non-stop on
(gdb) set pagination off
(gdb) set remotetimeout 60000
<g -2 -pPN7462AU-C3-00 -vendor=NXP -ConnectScript=PN7xxxx\
<=PN7xxxxx_Reset.scp -reset= --flash-driver PN7xxxxx_158k.cfx
Remote debugging using | crt_emu_cm_redlink -g -mi -2 -pPN7462AU-C3-00 -vendor=NXP -ConnectScript=PN7xxxxx_Connect.scp -ResetScript=PN7xxxxx_Reset.scp -reset= --flash-driver PN7xxxxx_158k.cfx
Ns: MCUXpresso IDE RedlinkMulti Driver v10.2 (Jul 25 2018 11:28:11 - crt_emu_cm_redlink build 555)
Pc: ( 0) Reading remote configuration
Wc(03). No cache support.
Pc: ( 5) Remote configuration complete
Wc: ============= SCRIPT: PN7xxxxx_Connect.scp =============
Wc: DpID = 0BB11477
Wc: APID = 0x04770021
Wc: ============= END SCRIPT ===============================
Nc: Probe Firmware: LPC-LINK2 CMSIS-DAP V5.183 (NXP Semiconductors)
Nc: Serial Number: I3FSJZAS
Nc: VID:PID: 1FC9:0090
Nc: USB Path: /dev/hidraw3
Nc: Using memory from core 0:0 after searching for a good core
Pc: ( 30) Emulator Connected
Pc: ( 40) Debug Halt
Pc: ( 50) CPU ID
Nc: debug interface type = Cortex-M0 (DAP DP ID 0BB11477) over SWD TAP 0
Nc: processor type = Cortex-M0 (CPU ID 00000C20) on DAP AP 0
Nc: number of h/w breakpoints = 4
Nc: number of flash patches = 0
Nc: number of h/w watchpoints = 2
Nc: Probe(0): Connected&Reset. DpID: 0BB11477. CpuID: 00000C20. Info: <None>
Nc: Debug protocol: SWD. RTCK: Disabled. Vector catch: Disabled.
Ns: Content of CoreSight Debug ROM(s):
Nc: RBASE E00FF000: CID B105100D PID 04000BB471 ROM dev (type 0x1)
Nc: ROM 1 E000E000: CID B105E00D PID 04000BB008 ChipIP dev SCS (type 0x0)
Nc: ROM 1 E0001000: CID B105E00D PID 04000BB00A ChipIP dev DWT (type 0x0)
Nc: ROM 1 E0002000: CID B105E00D PID 04000BB00B ChipIP dev FPB (type 0x0)
Nc: Inspected v.2 On-chip Flash Memory PN7xxxxx_158k.cfx
Nc: Image 'PN7xxxxx_158k Mar 8 2016 16:35:06'
Nc: NXP: PN7462AU-C3-00
Pc: ( 65) Chip Setup Complete
Nt: Connected: was_reset=false. was_stopped=false
Pc: ( 70) License Check Complete
Pc: ( 85) Registered Semihost Handler
Pc: (100) Target Ready
Na: GDB nonstop mode enabled
warning: No executable has been specified and target does not support
determining executable automatically. Try using the "file" command.
warning: No executable has been specified and target does not support
determining executable automatically. Try using the "file" command.

Program stopped.
0x0021a2de in ?? ()
(gdb) set mem inaccessible-by-default off
(gdb) mon ondisconnect cont
Ni: monitor command completed.
(gdb) set arm force-mode thumb
(gdb) mon capabilities
CRTv00.1/ApFe/MB04W02C1S/rt/Lf
Ni: monitor command completed.
(gdb) set remote hardware-breakpoint-limit 4
(gdb) file PN7462AU_ex_phExCcid.axf
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
Reading symbols from PN7462AU_ex_phExCcid.axf...done.
(gdb) lo
Loading section .text, size 0x199f8 lma 0x203000
Loading section .data, size 0xc lma 0x21c9f8
Nc: Opening flash driver PN7xxxxx_158k.cfx
Nc: Sending VECTRESET to run flash driver
Nt: Writing 104964 bytes to address 0x00203000 in Flash
Pb: 1 of 1 ( 0) Writing pages 0-51 at 0x00203000 with 104964 bytes
Ps: ( 0) at 00203000: 0 bytes - 0/104964
Ps: ( 1) at 00203000: 2048 bytes - 2048/104964
Ps: ( 3) at 00203800: 2048 bytes - 4096/104964
Ps: ( 5) at 00204000: 2048 bytes - 6144/104964
Ps: ( 7) at 00204800: 2048 bytes - 8192/104964
Ps: ( 9) at 00205000: 2048 bytes - 10240/104964
Ps: ( 11) at 00205800: 2048 bytes - 12288/104964
Ps: ( 13) at 00206000: 2048 bytes - 14336/104964
Ps: ( 15) at 00206800: 2048 bytes - 16384/104964
Ps: ( 17) at 00207000: 2048 bytes - 18432/104964
Ps: ( 19) at 00207800: 2048 bytes - 20480/104964
Ps: ( 21) at 00208000: 2048 bytes - 22528/104964
Ps: ( 23) at 00208800: 2048 bytes - 24576/104964
Ps: ( 25) at 00209000: 2048 bytes - 26624/104964
Ps: ( 27) at 00209800: 2048 bytes - 28672/104964
Ps: ( 29) at 0020A000: 2048 bytes - 30720/104964
Ps: ( 31) at 0020A800: 2048 bytes - 32768/104964
Ps: ( 33) at 0020B000: 2048 bytes - 34816/104964
Ps: ( 35) at 0020B800: 2048 bytes - 36864/104964
Ps: ( 37) at 0020C000: 2048 bytes - 38912/104964
Ps: ( 39) at 0020C800: 2048 bytes - 40960/104964
Ps: ( 40) at 0020D000: 2048 bytes - 43008/104964
Ps: ( 42) at 0020D800: 2048 bytes - 45056/104964
Ps: ( 44) at 0020E000: 2048 bytes - 47104/104964
Ps: ( 46) at 0020E800: 2048 bytes - 49152/104964
Ps: ( 48) at 0020F000: 2048 bytes - 51200/104964
Ps: ( 50) at 0020F800: 2048 bytes - 53248/104964
Ps: ( 52) at 00210000: 2048 bytes - 55296/104964
Ps: ( 54) at 00210800: 2048 bytes - 57344/104964
Ps: ( 56) at 00211000: 2048 bytes - 59392/104964
Ps: ( 58) at 00211800: 2048 bytes - 61440/104964
Ps: ( 60) at 00212000: 2048 bytes - 63488/104964
Ps: ( 62) at 00212800: 2048 bytes - 65536/104964
Ps: ( 64) at 00213000: 2048 bytes - 67584/104964
Ps: ( 66) at 00213800: 2048 bytes - 69632/104964
Ps: ( 68) at 00214000: 2048 bytes - 71680/104964
Ps: ( 70) at 00214800: 2048 bytes - 73728/104964
Ps: ( 72) at 00215000: 2048 bytes - 75776/104964
Ps: ( 74) at 00215800: 2048 bytes - 77824/104964
Ps: ( 76) at 00216000: 2048 bytes - 79872/104964
Ps: ( 78) at 00216800: 2048 bytes - 81920/104964
Ps: ( 79) at 00217000: 2048 bytes - 83968/104964
Ps: ( 81) at 00217800: 2048 bytes - 86016/104964
Ps: ( 83) at 00218000: 2048 bytes - 88064/104964
Ps: ( 85) at 00218800: 2048 bytes - 90112/104964
Ps: ( 87) at 00219000: 2048 bytes - 92160/104964
Ps: ( 89) at 00219800: 2048 bytes - 94208/104964
Ps: ( 91) at 0021A000: 2048 bytes - 96256/104964
Ps: ( 93) at 0021A800: 2048 bytes - 98304/104964
Ps: ( 95) at 0021B000: 2048 bytes - 100352/104964
Ps: ( 97) at 0021B800: 2048 bytes - 102400/104964
Ps: ( 99) at 0021C000: 2048 bytes - 104448/104964
Ps: (100) at 0021C800: 2048 bytes - 106496/104964
Nt: Erased/Wrote page 0-51 with 104964 bytes in 2362msec
Nc: Closing flash driver PN7xxxxx_158k.cfx
Pb: (100) Finished writing Flash successfully.
Nt: Flash Write Done
Nt: Flash Program Summary: 104964 bytes in 2.36 seconds (43.40 KB/sec)
Wc: ============= SCRIPT: PN7xxxxx_Reset.scp =============
Wc: ============= END SCRIPT =============================
Start address 0x2031e0, load size 104964
Transfer rate: 38 KB/sec, 13120 bytes/write.
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Na: nonstop - GDB killing (vKill) non-existent PID 0xA410 (killing anyway)
Starting program: /home/theo/cherry/kc1000mc/workspace/PN7462AU_ex_phExCcid/ReleasePN7462AU/PN7462AU_ex_phExCcid.axf
Wc: ============= SCRIPT: PN7xxxxx_Reset.scp =============
Wc: ============= END SCRIPT =============================
Wc: ============= SCRIPT: PN7xxxxx_Reset.scp =============
Wc: ============= END SCRIPT =============================
^CNo support for interrupting the remote target.

 

0 Kudos
788 Views
converse
Senior Contributor IV

Try removing

set mi-async

set non-stop on

From the script.

0 Kudos
788 Views
martin_elshuber
Contributor I

Removing these lines did not work. But your instinct seem correct it has something to do with non-stop mode.

To my understanding crt_emu_cm_redlink acts as gdbserver.

Although I do not know much on the gdbserver protocol, I tapped into the pipes and found a differnce.

* When hitting ^C gdb sends "vCtrlC" followed by a "vKill" I guess that the "vKill" is sent because crt_emu answers with an empty packet "$#00"

* When hitting the break button in eclipse gdb sends a series of "vCont" and "vStopped" packets.

Workaround: Instead of running continue in foreground when running it in background by appending an & (e.g.: continue &, or run &) the target can be interrupted with "interrupt".

Do you know a way to make this the default behviour vor ^C?

While getting further a new question raised about semihosting. This could be realy helpfull because the device does not have many uarts.

I tried to add --telnet 3330 to the crt_emu commandline and connected a telnet session to it.

However I do not see any output (even a tcpdump did not reveal and log messages).

I used a firmware in which I confirmed that eclipse prints something.

Any Ideas?

Thank you so far, Martin

0 Kudos
788 Views
nxa15473
NXP Employee
NXP Employee

Thanks a lot, it works, but how can i set pc and sp? and how to monitor reset target?

0 Kudos