Re: NXP RT1064 board and JLink Debugging


Lawrence King
 

Hi Maureen:

 

Actually I don’t think mcuxpresso is using JLink, however during the install, mcuxpresso did remove JLink 6.44 and install JLink 6.42. I suspect this is due to the fact that the ide can work with many debuggers.

 

It appears to be using something called redlinksrv to do debugging. I can see redlinksrv and crt_emu_cm_redlink  in the ‘ps -aux’ output while my blinky is running on the RT1064 board

 

Unfortunately I do not have an external JLink probe that I can use.

 

 

The NXP documentation claims that Zephyr is supported by the board, and there seems to be a lot of RT1064 specific code in the Zephyr tree. How have you been testing Zephyr on the RT1064 board?

 

 

Lawrence King

Principal Developer

+1(416)627-7302

 

From: Maureen Helm <maureen.helm@...>
Sent: Friday, April 5, 2019 3:28 PM
To: Lawrence King <lawrence.king@...>; antoine@...; Zephyr-users@...
Cc: users@...
Subject: RE: [Zephyr-users] NXP RT1064 board and JLink Debugging

 

Hi Lawrence,

You’re right, I forgot that RT1064-EVK has a different onboard debug circuit than RT1050-EVK. Do you have an external JLink probe you can use?

 

Are you sure you’re using the JLink GDB server in MCUXpresso IDE? It doesn’t make sense with the DAPLink firmware.

 

Maureen

 

From: Lawrence King [mailto:lawrence.king@...]
Sent: Thursday, April 4, 2019 4:43 PM
To: Maureen Helm <maureen.helm@...>; antoine@...; Zephyr-users@...
Cc: users@...
Subject: RE: [Zephyr-users] NXP RT1064 board and JLink Debugging

 

Hi Maureen:

 

Yes, I added the two configs, and I am only trying “ninja debug”. I did try using OpenSDA from https://www.segger.com/downloads/jlink/OpenSDA_V2_1 unfortunately it will not load onto the RT1064 board, it always fails, and leaves a message in the mass storage device that it has timed out. I think there are two reasons for this 1) the RT1064 board does not use a k20 processor for the debugger, it uses a lpc4322 microcontroller, and 2) I think the image needs to be signed, or at least have a valid crc (hence the “crc” in the bin file nameHere is what I see after copying OpenSDA_V2_1.bin to the maintenance drive. The contents of fail.txt says “The transfer timed out.”

 

 

 

I have tried all of the following bin files with no joy:

49_OpenSDA_MIMXRT1050-EVK-Hyperflash.bin

K20dx_mimxrt1064_qspi_if_crc.bin

OpenSDA_V2_1.bn

Open_SDA_V3_2.bin

 

The JLink gdb Server works fine with the lpc4322__mimxrt1064_evk_if_crc_20180810.bin firmware when called from the Xpresso IDE.

 

Lawrence King

Principal Developer

+1(416)627-7302

 

From: users@... <users@...> On Behalf Of Maureen Helm
Sent: Thursday, April 4, 2019 5:11 PM
To: Lawrence King <lawrence.king@...>; antoine@...; Zephyr-users@...
Cc: users@...
Subject: Re: [Zephyr-users] NXP RT1064 board and JLink Debugging

 

Hi Lawrence,

You have to use JLink firmware to use the JLink GDB server. “lpc4322__mimxrt1064_evk_if_crc_20180810.bin” is DAPLink firmware, not JLink firmware. Try https://www.segger.com/downloads/jlink/OpenSDA_V2_1 instead. Note that this firmware does not enumerate a USB mass storage device.

 

Did you reconfigure your Zephyr application to link into internal SRAM? To do this, add the following to your prj.conf file:

CONFIG_CODE_ITCM=y

CONFIG_DATA_DTCM=y

 

This configuration will not work with ‘ninja flash’, you can only use ‘ninja debug’.

 

I don’t think your VM is a problem. I use virtual box all the time.

 

Maureen

 

From: Lawrence King [mailto:lawrence.king@...]
Sent: Thursday, April 4, 2019 1:02 PM
To: Maureen Helm <maureen.helm@...>; antoine@...; Zephyr-users@...
Cc: users@...
Subject: RE: [Zephyr-users] NXP RT1064 board and JLink Debugging

 

Thank you Maureen and Antoine

 

Finally back to this problem.  I tried loading several different bin files to the board while in Maintenance mode, most generate and timeout error and don’t successfully load. The only bin file I could successfully load was “lpc4322__mimxrt1064_evk_if_crc_20180810.bin”. When I restart the board it comes up as RT1064-EVK as expected. When I readout the DETAILS.TXT file I get:

 

# DAPLink Firmware - see https://mbed.com/daplink

Unique ID: 02320000070bfcdd00000000000000000000000097969905

HIC ID: 97969905

Auto Reset: 0

Automation allowed: 0

Overflow detection: 0

Daplink Mode: Interface

Interface Version: 0246

Bootloader Version: 0244

Git SHA: 475c6729c42c688ae33af3af4ea4dbbfe1c35351

Local Mods: 1

USB Interfaces: MSD, CDC, HID, WebUSB

Bootloader CRC: 0xe493996b

Interface CRC: 0x3eb53105

Remount count: 0

 

This all seems reasonable. I loaded the JLinkexe from the Segger site (apt-get didn’t work for me) and it seems to have no problem finding the board. Finally when I run “ninja flash” I get the following output:

 

lawrence@VM:~/workspace/rc-demo/RT1064/build$ ninja debug

[0/1] Debugging mimxrt1064_evk

Using runner: jlink

J-Link GDB server running on port 2331

SEGGER J-Link GDB Server V6.44d Command Line Version

 

JLinkARM.dll V6.44d (DLL compiled Mar 27 2019 17:11:41)

 

-----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:               off

Init regs on start:            off

Silent mode:                   on

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:                 MIMXRT1064

Target interface:              SWD

Target interface speed:        auto

Target endian:                 little

 

GNU gdb (crosstool-NG 1.24.0-rc2-dirty) 8.2.1

Copyright (C) 2018 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-build_pc-linux-gnu --target=arm-zephyr-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"...

Reading symbols from /home/lawrence/workspace/rc-demo/RT1064/build/zephyr/zephyr.elf...done.

Could not connect to J-Link.

Please check power, connection and settings.:2331: Connection timed out.

"monitor" command not supported by this target.

"monitor" command not supported by this target.

You can't do that when your target is `exec'

(gdb)

 

The Segger gdb server seems to start up, but gdb doesn’t find it. Does this have something to do with the fact that I am running on a virtual machine (Ubuntu under VirtualBox under Win10), I don’t think this is the problem, I didn’t have any problems with NRF or ST boards running Zephyr.

 

I did try changing board.cmake to "--device=Cortex-M7", the messages from JLink are slightly different, but the gdb timeout result is the same. Of course “ninja flash” fails.

 

Any ideas what I should try next? Any other information I can supply?

 

 

Lawrence King

Principal Developer

+1(416)627-7302

 

From: Maureen Helm <maureen.helm@...>
Sent: Monday, April 1, 2019 12:39 PM
To: antoine@...; Lawrence King <lawrence.king@...>; Zephyr-users@...
Cc: users@...
Subject: RE: [Zephyr-users] NXP RT1064 board and JLink Debugging

 

Hi Lawrence,

I rewrote the “Programming and Debugging” sections for all the NXP boards in a PR that was just merged on Friday:

https://github.com/zephyrproject-rtos/zephyr/pull/14000

 

For many of the i.MX RT boards I recommend using an external J-Link probe. Only RT1020 and RT1050 have J-Link OpenSDA firmware capable of programming the Hyperflash/QSPI. As Lawrence said, you could use the generic firmware, but you will need to 1) configure your zephyr application to link into internal SRAM (set CONFIG_CODE_ITCM=y and CONFIG_DATA_DTCM=y) and 2) override the Jlink device argument in board.cmake to "--device=Cortex-M7"

 

Maureen

 

From: users@... [mailto:users@...] On Behalf Of Antoine Zen-Ruffinen via Lists.Zephyrproject.Org
Sent: Monday, April 1, 2019 2:20 AM
To: Lawrence King <lawrence.king@...>; Zephyr-users@...
Cc: users@...
Subject: Re: [Zephyr-users] NXP RT1064 board and JLink Debugging

 

Hi Lawrence,

 

I've been trough that too. It seems that two things are missing on your side. First, you need to install the J-Link tools on your development host. Secondly, you should swap the "OpenSDA" firmware of the debug adapter MCU (U23 on the borad) to enable support for JLink. The default OpenSDA firmware support the CIMSIS-DAP that is supported by OpenOCD for instance. But OpenOCD is not able to program the i.MXRT familly for now (It is still good for RAM runs). 

 

To install the J-Link tools, if you are under Ubuntu Linux, you could just run "sudo apt install jlink". It's what I did and it do the job. Else, you have to manually download and install it from https://www.segger.com/downloads/jlink/. That should provide you the "JLinkExe" command that is missing in your logs.

 

The "SEGGER" OpenSDA firmware can be downloaded from https://www.segger.com/downloads/jlink/#JLinkOpenSDAGenericFirmwares. Unfortunately it seems that Segger has not released  firmware specific to the RT1064 eval board yet. I would try the one for the "MIMXRT1050-EVK-Hyperflash" as the chip are very similar from the memory point of view. How to change the firmware is explained in the board user guide, but in short:

 

1) Unplug USB.

2) Press&hold SW4 (reset, near debug USB).

3) Replug USB and hold SW4 for 1 or more seconds.

4) A new drive must show up in your host, named "MAINTENANCE"

5) Drag& drop the new firmware to that firmware. After a short programming time, the board shows up as "SEGGER" in the "lsusb" command.

 

You can revert to the original FW in the same way. The Original FW can be downloaded from https://www.nxp.com/support/developer-resources/run-time-software/kinetis-developer-resources/ides-for-kinetis-mcus/opensda-serial-and-debug-adapter:OPENSDA?&tid=vanOpenSDA.

 

If you can still not program the board, check that you have the right rights for the USB device. That can requires to setup the proper udev daemon rule. If you install JLink form unbunt repository, that should be already set.

 

Hope it helps!

 

Regards,

 

Antoine


From: users@... <users@...> on behalf of Lawrence King <lawrence.king@...>
Sent: Saturday, March 30, 2019 4:21:25 AM
To:
Zephyr-users@...
Subject: [Zephyr-users] NXP RT1064 board and JLink Debugging

 

Dear All

 

On my business trip last week I was handed a i.MX RT1064 board, so today I tried to build and install the blinky progam for it. Unfortunately I am having problem getting Ninja flash or ninja debug to run.

 

When I started building at the cmake step I discovered my tools were out of date (zephyr-sdk-0.9.5-setup.run instead of zephyr-sdk-0.10.0-setup.run) no problem download the right tools and install them. Then my west install was out of date, again no problem, ‘west update’. Unfortunately it looks like I don’t have JLink support installed. What do I need to do to get that?

 

Curiously, when I look at the attached USB devices it says my board is ‘ARM DAPLink CIMSIS-DAP [0100]’ which is the same as my nrf52xx boards which run just fine with pyocd. Do I have a i.MX board with a ‘newer’ debugger that is ARM standard, or possibly the people that handed me the board updated it?

 

Of course I haven’t go to the step where the blinky program actually runs…

 

FYI - Here is the error message I get when I try ‘ninja flash’:

 

[0/1] Re-running CMake...

Zephyr version: 1.14.0

-- Selected BOARD mimxrt1060_evk

-- Found west: /home/lawrence/.local/bin/west (found suitable version "0.5.6", minimum required is "0.5.6")

-- Loading /home/lawrence/workspace/rc-demo/zephyr/zephyr/boards/arm/mimxrt1060_evk/mimxrt1060_evk.dts as base

-- Overlaying /home/lawrence/workspace/rc-demo/zephyr/zephyr/dts/common/common.dts

Parsing Kconfig tree in /home/lawrence/workspace/rc-demo/zephyr/zephyr/Kconfig

Loading /home/lawrence/workspace/rc-demo/RT1060/build/zephyr/.config as base

Configuration written to '/home/lawrence/workspace/rc-demo/RT1060/build/zephyr/.config'

-- Cache files will be written to: /home/lawrence/.cache/zephyr

Including module(s): tinycbor

-- Configuring done

-- Generating done

-- Build files have been written to: /home/lawrence/workspace/rc-demo/RT1060/build

[99/105] Linking C executable zephyr/zephyr_prebuilt.elf

Memory region         Used Size  Region Size  %age Used

           FLASH:       24332 B         8 MB      0.29%

            SRAM:        6388 B        32 MB      0.02%

        IDT_LIST:          72 B         2 KB      3.52%

[104/105] Flashing mimxrt1060_evk

Using runner: jlink

Flashing Target Device

Traceback (most recent call last):

  File "/home/lawrence/.local/bin/west", line 11, in <module>

    sys.exit(main())

  File "/home/lawrence/.local/lib/python3.6/site-packages/west/_bootstrap/main.py", line 479, in main

    wrap(wrap_argv)

  File "/home/lawrence/.local/lib/python3.6/site-packages/west/_bootstrap/main.py", line 465, in wrap

    west.main.main(argv)

  File "/home/lawrence/workspace/rc-demo/zephyr/.west/west/src/west/main.py", line 576, in main

    args.handler(args, unknown)

  File "/home/lawrence/workspace/rc-demo/zephyr/.west/west/src/west/main.py", line 331, in ext_command_handler

    command.run(*west_parser.parse_known_args(argv))

  File "/home/lawrence/workspace/rc-demo/zephyr/.west/west/src/west/commands/command.py", line 85, in run

    self.do_run(args, unknown)

  File "/home/lawrence/workspace/rc-demo/zephyr/zephyr/scripts/west_commands/flash.py", line 32, in do_run

    'ZEPHYR_BOARD_FLASH_RUNNER')

  File "/home/lawrence/workspace/rc-demo/zephyr/zephyr/scripts/west_commands/run_common.py", line 228, in do_run_common

    runner.run(command_name)

  File "/home/lawrence/workspace/rc-demo/zephyr/zephyr/scripts/west_commands/runners/core.py", line 407, in run

    self.do_run(command, **kwargs)

  File "/home/lawrence/workspace/rc-demo/zephyr/zephyr/scripts/west_commands/runners/jlink.py", line 99, in do_run

    self.flash(**kwargs)

  File "/home/lawrence/workspace/rc-demo/zephyr/zephyr/scripts/west_commands/runners/jlink.py", line 150, in flash

    self.check_call(cmd)

  File "/home/lawrence/workspace/rc-demo/zephyr/zephyr/scripts/west_commands/runners/core.py", line 466, in check_call

    subprocess.check_call(cmd)

  File "/usr/lib/python3.6/subprocess.py", line 286, in check_call

    retcode = call(*popenargs, **kwargs)

  File "/usr/lib/python3.6/subprocess.py", line 267, in call

    with Popen(*popenargs, **kwargs) as p:

  File "/usr/lib/python3.6/subprocess.py", line 709, in __init__

    restore_signals, start_new_session)

  File "/usr/lib/python3.6/subprocess.py", line 1344, in _execute_child

    raise child_exception_type(errno_num, err_msg, err_filename)

FileNotFoundError: [Errno 2] No such file or directory: 'JLinkExe': 'JLinkExe'

FAILED: zephyr/cmake/flash/CMakeFiles/flash

cd /home/lawrence/workspace/rc-demo/RT1060/build && /usr/local/bin/cmake -E env /home/lawrence/.local/bin/west flash --skip-rebuild

ninja: build stopped: subcommand failed.

 

Lawrence King

Principal Developer

Connected Transport Market Unit

https://www.Irdeto.com

+1(416)627-7302

 

1  2 - linkedin  3 - instagram  4 - youtube  6 - facebook  7

            

CONFIDENTIAL: This e-mail and any attachments are confidential and intended solely for the use of the individual(s) to whom it is addressed. It can contain proprietary confidential information and be subject to legal privilege and/or subject to a non-disclosure Agreement. Unauthorized use, disclosure or copying is strictly prohibited. If you are not the/an addressee and are in possession of this e-mail, please delete the message and notify us immediately. Please consider the environment before printing this e-mail. Thank you.

 

 

 

Join users@lists.zephyrproject.org to automatically receive all group messages.