Using SEGGER J-Link With QSPI FLASH on NXP i.MX Boards
Learn more about using SEGGER J-Link in this tutorial.
Join the DZone community and get the full member experience.Join For Free
In previous posts, "Seeed Studio Arch Mix NXP i.MX RT1052 Board" and "Debug and Execute Code from FLASH on the Seeed Arch Mix NXP i.MX RT1052 Board," I used the NXP LPC-Link2 to debug the Seeed Arch Mix board with the NXP i.MX RT1052, because the SEGGER J-Link does not work out-of-the-box with the i.MX RT using QSPI Flash.
This article shows how the J-Link connection can be changed from HyperFlash to work with QSPI Flash.
Depending on what external FLASH memory is used (SPI Flash, HyperFlash, etc.), the debug connection needs to be made aware so that it can use the correct driver to access and program the memory. The NXP LPC-Link2 debug connection has a flexible way to load the needed flash driver using a setting the Eclipse (MCUXpresso) IDE project properties:
That way, the debugger connection can load the appropriate flash driver. That above flash drive is specific for the LPC-Link2 debug connection.
For the SEGGER J-Link, one would expect that the needed driver could be specified on the command line starting the debug connection, as it is, for example, for the core/device under debug. But instead, the external flash driver setting is configured in a global JLinkDevices.xml file.
By default, (probably because the first NXP boards for i.MX RT1052 were using HyperFlash), the default is using that FLASH technology. To change, it, locate the JLinkDevices.xml file. On Windows, this should be in:
C:\Program Files (x86)\SEGGER\JLink
Open the file with a text editor to edit it (you might need administrative rights).
Note: This file is *global* and changing it will not allow you to connect to a board with HyperFlash and vice versa. If having different boards with different FLASH memory on it means always changing that XML file. Best if using a batch file to switch between different FLASH variants.
Search in the JLinkDevices.xml the device used. In my case, it is the MCIMXRT1052, which is shown in the J-Link connection console:
Search for that device in the XML file:
The loader identifies the driver to program the flash, plus the memory range. The J-Link FLASH drivers are inside the 'Devices' folder of the J-Link installation folder:
In my case, I change it to use the QSPI Flash instead:
With this, I can download and debug the i.MX RT1052 Seeed board with QSPI Flash in Eclipse.
To switch to a different (non-default) FLASH with the SEGGER J-Link, I must manually edit and change the JLinkDevices.xml file inside the JLink installation folder. That works fine, but do not forget to switch back if using a different board with a different FLASH memory device on it. And do not forget to make the change again after installing a new J-Link version.
Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.