Author Topic: RT1064, boot from SD.  (Read 1945 times)

Offline LuisHS

  • Newbie
  • *
  • Posts: 32
    • View Profile
RT1064, boot from SD.
« on: March 08, 2023, 03:22:50 AM »

Hello Mark.
I was watching your video to run the program in ITC memory, and I have some doubts.
https://youtu.be/fnfLQ-nbscI

If I want my application to boot from an SD card, is it essential that it be loaded and run in ITC?
What maximum size can my application have to boot from SD, is that limit the ITC memory size?

Can't configure my app to boot from SD card to run on SDRAM? it's much bigger, and wouldn't limit the size of my program that much.

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: RT1064, boot from SD.
« Reply #1 on: March 08, 2023, 02:04:31 PM »
Hi

The standard SD card boot loader method is to have he new image on the card and load it to QSPI flash (and delete the SD card image after successful transfer).
At each subsequent boot there are three possibilities:
- copy the code from encrypted QSPI flash to ITC RAM and run it there (fastest operation)
- copy the code from encrypted QSPI flash to SRAM and run it there (second fastest operation but operation s no longer encrypted since the SDRAM operation can be observed)
- Run the code in place in QSPI Flash (XiP) or XiP-BEE (on the fly decryption). XiP is (depending on caching) up to 20x slower that running from ITC and less deterministic since the speed depends on caching so can change) -  XiP BEE is a bit slower again (about 30% I have heard). When the QSPI Flash in internal to the chip (RT1064) it is protected and possibly there is no advantage of using XiP BEE for code protection.

ITC + DTC is limited to the FlexRAM size of the chip. RT105x/6x have 512k so programs up to about 512k would be possible (as long as data is located in SDRAM or 512k OTCRAM2 (in 106x)

Large QSPI Flash are available so program size shouldn't generally be an issue (except for RT1064 where it is fixed at 4MBytes) and SDRAM loses code protection so is not always the best choice.

Regards

Mark

Offline LuisHS

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: RT1064, boot from SD.
« Reply #2 on: March 08, 2023, 05:36:56 PM »

Thanks Mark
And wouldn't it be possible to always boot from SD, without having to copy to flash?

I saw this article from McuonEclipse where they explain how to boot an application from SD, the processor starts the ROM bootloader, then loads the image from the SD card into RAM (ITC) and then runs it. In that configuration no internal or external FLASH memory would be needed.

https://mcuoneclipse.com/2019/01/22/tutorial-booting-the-nxp-i-mx-rt-from-micro-sd-card/

They also explain that the application is copied from SD to ITC RAM from where it runs, but that this limits the program to a maximum of 64k, which seems very little to me.

In your answer you tell me that in ITC+DTC the size of the program would be 512K, that is much more than the 64k indicated in mcuoneclipse. So this leaves me confused.

To always boot from SD, without copying to Flash, would it always be done using the Rom bootloader that would copy to ITC from where the program would run, and what would be the maximum size of the program that could be run?

Regards

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: RT1064, boot from SD.
« Reply #3 on: March 08, 2023, 06:31:48 PM »
Hi

If there were no QSPI flash the only loader available is the ROM loader, which can boot from SD cards but is not necessarily a very good choice since SD cards are unreliable in comparison to QSPI flash and if the card fails, is corrupted or is removed the board can't do anything.

It is possible for the uTasker boot loader to also load directly from SD card to RAM or SDRAM but, due to the above, I would never recommend it for an embedded system - plus why use an expensive (heat sensitive) SD card to hold a small program when a cheap ($0.50) QSPI flash can do it better? [Since a 1064 has this inside anyway it would make even less sense]

I don't know why there is a limit in ITC size in the article but that may be the ROM loader's limitation (unless eFUSEs are set possibly to change the configuration, which cannot be changed back again...!). The uTasker loader (running in the first blocks of QSPI flash) is limited to the chip's 512k ITC (since it can dynamically configure this according to the code's requirement) or much larger in SDRAM (or much larger in QSPI flash).

As noted in the article it is cool to boot from an SD card directly (without any need for QSPI flash) but whether it makes real sense in a real -world embedded system is highly unlikely.

Regards

Mark