Debug and Execute Code from FLASH on the Seeed Arch Mix NXP i.MX RT1052 Board

In my previous article “Seeed Studio Arch Mix NXP i.MX RT1052 Board” I described how I can use and debug the Seeed Arch Mix Board. But so far I only had things running in RAM. Ultimately I want to use the QSPI FLASH memory on the device with my firmware and running code on it. This article shows how to get from RAM execution to SPI FLASH in-place execution (XiP).

Seeed Arch Mix NXP i.MX RT1052 Board

Seeed Arch Mix NXP i.MX RT1052 Board

💡 Executing from FLASH is typically slower than running from RAM. But running from FLASH does not need any special loading at runtime.

With still no schematics of the board available (I have asked Seeed for that) I had to do some reverse engineering to find out more about the Arch Mix board.

💡 UPDATE: Seeed has uploaded the schematics of the board to http://wiki.seeedstudio.com/Arch_Mix/

I have found the ‘ShareBoard’ (see links at the end of this article) which seems to be like the predecessor of the Seeed Arch Mix board. That way I have found out some of the address mapping and peripherals.

I have setup the board for SWD debugging (see “Seeed Studio Arch Mix NXP i.MX RT1052 Board“). I’m using the Eclipse based MCUXpresso IDE V11.0.0 with the NXP LPC-Link2 debug probe with a 3D printed enclosure.

Debugging the Seeed Arch Mix i.MX RT1052 Board with LPC-Link2 and MCUXpresso IDE

Debugging the Seeed Arch Mix i.MX RT1052 Board with LPC-Link2 and MCUXpresso IDE

💡 Do *not* install the jumper JP2 (provide power to the target), as with this debugging most likely will fail.

So here is how to go from ‘RAM’ to ‘SPI FLASH’ with the NXP i.MX RT1052 on the Seeed Arch Mix board….

Because there is not much documentation available, I looked at the i.MX RT1020 board projects (see “First Steps with the NXP i.MX RT1020 EVK Board“) as this board is using the same SPI FLASH device.

i.MX RT1052 with the i.MX RT1020-EVK

i.MX RT1052 with the i.MX RT1020-EVK

First, create an ’empty’ project with the Wizard in the MCUXpresso IDE using ‘New Project…’. Select the MIMXRT1052xxxxB with the MCUXpresso SDK:

SDK Wizard

SDK Wizard

The RT1052 on the board uses the CVL5B package:

MIMXRT1052CVL5B

MIMXRT1052CVL5B

So I select that package to be used:

Selecting CVL5B Package

Selecting CVL5B Package

The rest leave with the defaults and have the project created. That project is setup for RAM only:

RAM project

RAM project

So debugging that project will run it in RAM (actually the DTC RAM), as seen in the disassembly window of the IDE:

Running in RAM

Running in RAM

So how to add the ability to download and debug in the external SPI FLASH?

The FLASH chip on the board is the IS25LP064A-BLE (64 MBit (8 MByte), the same as on the i.MX RT1020-EVK.

S25LP064A

S25LP064A

First, copy the XiP folder from the i.MX RT1020 project as it contains all the needed data to configure and identify the external FLASH device. The files can be renamed t match the 1050/52:

copy of XiP

Don’t forget to include that new folder for the build (see “Include Source Files for a Build in Eclipse“).

The files need the fsl_common, so make sure it is added to the project. Manage the SDK components:

Manage SDK components

Manage SDK components

Make sure the common driver is added:

common SDK component

common SDK component

To make the FLASH device size known, add the following define to board.h:

#define BOARD_FLASH_SIZE (0x800000U)
board.h with BOARD_FLASH_SIZE

board.h with BOARD_FLASH_SIZE

These files need 3 defines in the project settings, so have them added:

XIP_EXTERNAL_FLASH=1
XIP_BOOT_HEADER_ENABLE=1
XIP_BOOT_HEADER_DCD_ENABLE=1
XIP Defines in Compiler Settings

XIP Defines in Compiler Settings

Finally, add the Flash at the beginning of the Memory list in the project settings:

Added Flash Memory

Added Flash Memory

  • Type: Flash
  • Location: 0x60000000
  • Size: 0x80000
  • Driver: MIMXRT1050-EVK_IS25WP064A.cfx

That’s it. Build the project and debug it:

Running and debugging in FLASH memory the Seeed Arch Mix i.MX RT1052

Running and debugging in FLASH memory the Seeed Arch Mix i.MX RT1052

Victory! We have programmed the Flash and are debugging it :-).

The project is available as example on my GitHub site too.

Happy Flashing 🙂

Links

4 thoughts on “Debug and Execute Code from FLASH on the Seeed Arch Mix NXP i.MX RT1052 Board

  1. Pingback: Restoring Default Firmware on Seeed Arch Mix NXP i.MX RT1052 Board | MCU on Eclipse

  2. Hi Erich

    I have a problem if I use the i.mx RT1020 xip files with the RT1050:
    Booting from flash works fine but the external SDRAM dosnt work. Maybe the RT1020 EVK board uses a different type of SDRAM chip than the 1050 EVK board?
    I replaced the files with the ones found on this webside (Attachment QSPI_xip.zip):
    https://community.nxp.com/community/mcuxpresso/mcuxpresso-ide/blog/2017/12/07/overview-of-using-the-mimxrt1050-evk-with-mcuxpresso-ide
    With those files the both the external flash and SDRAM work fine…

    Regards
    Dave

    Like

  3. Pingback: Using SEGGER J-Link with QSPI FLASH on NXP i.MX Boards | MCU on Eclipse

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.