Looking for a minimalist approach to programming through serial downloader...

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Looking for a minimalist approach to programming through serial downloader...

1,249 Views
EdSutter
Senior Contributor II

I'm working on my first imxRT system (imxRT1020-EVK right now), just trying to understand how to program a "bare" board; ultimately for use on my custom hardware. My goal is to just use the ROM based serial downloader over USB, so I started playing with imx_usb_loader tool from Boundary Devices.  Using that I was able to read/write OCRAM, push a character out the LPUART1 interface, etc... Just enough to know that the interface does work.

The next step would be to actually push a bootable image to the SPI flash on board; but that gets a bit more complicated.  Has anyone used that tool for iMXRT systems?  If yes, any tips?  If no, what is the common approach for doing this?

Seems I can also use MCUXpresso or MfgTool, but I'd prefer to stick with a command line interface if possible.

0 Kudos
8 Replies

969 Views
EdSutter
Senior Contributor II

Ok, I made some progress thanks to pointers from folks on the forum. Right now I'm trying to stick to the tools that NXP provides...

  • elftosb to create a bootable image from an elf file.
  • sdphost to install flashloader through the ROM serial loader
  • blhost to install applications through flashloader

So far I've managed to build/install the flashloader (see this post for detail).  Next I'm going to take the hello-world demo-app, re-map it to SDRAM and attempt to use flashloader to push it into Serial-NOR so that the board will boot up, pull it out of Serial NOR and load it to SDRAM for run-time execution.  I read somewhere that XIP execution directly out of FlexSPI-serial-NOR is more efficient than SDRAM; so I may eventually switch to that.  

Does that make sense or am I totally off track here?

I will continue to track my progress through this for the sake of others that may be stumbling as I am.

0 Kudos

969 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hello Ed,

Yes you are correct. Here are other documents that will help along this stage.

https://community.nxp.com/docs/DOC-341317 

A way to create a binary that is copied to RAM from the ROM bootloader in RT1050 

Best Regards,

Sabina

969 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hello Ed,

Hope you are doing well.

I have a couple of resources that can help you get started:

Get Started with the MIMXRT1020-EVK | NXP : This one will guide you through step by step to a simple demo.

First Steps with the NXP i.MX RT1020 EVK Board | MCU on Eclipse  

Hardware Development Guide : This is useful for different considerations to be taken in different stages of your application development. 

MCU Boot Utility This is a gui tool that was created to get started with NXP MCU secure boot and support iMRT series. 

It supports both UART and USB-HID serial downloader modes

Hope it helps!

Sabina

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

----------------------------------------------------------------------------------------------------------------------- 

0 Kudos

969 Views
EdSutter
Senior Contributor II

Hi Sabina, thanks for responding...

I've actually gone through all three of those walkthroughs.  They are helpful to get started with the EVK, but I want to quickly dig deeper to understand how to create a bootable image (some combination of .text/.data/ivt/dcd) that can be pumped over USB using the ROM-based serial loader (without any additional debug interface).  Ideally, for this exercise, I want to avoid even using any IDE just so that I can script (and fully understand) all the steps.

Ed

0 Kudos

969 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hi Ed,

There is not exactly a step by step guide on what you need. However, I did find other application notes that might lead you in the correct path.

What may be of interest in these documents is the MFGTool, which is a Gui that helps build and load images. It supports I.MXRT BootROM and KBOOT based Flashloader, it can be used in factory production environment.

AN12108

AN12238

Generate bootable image guide: This guide explains very useful steps that you may consider it uses mcuxpresso but only to create certain files(it is not used to debug or load the image) so it is focused on using the command line based tool to load the images. 

These are for reference as they use the imxRT1050.

Best Regards,

Sabina

969 Views
mjbcswitzerland
Specialist V

Hi

Try this for various protocols and command line methods: https://www.nxp.com/docs/en/supporting-information/Flashloader_i.MXRT1050_GA_updated.zip 

I however have preferred to use https://github.com/JayHeng/NXP-MCUBootUtility
for loading code and reading back memory.

For more comfort you can also install a USB-MSD loader which allows you to program with drag-and-drop:
https://www.utasker.com/iMX/RT1020.html

Try loading the application there too since it allows you to dump all internal RAM content and SPI Flash via USB-disk drive and view SPI flash (plus experiment with writing and erasing) from the application (on USB-MSD, Telnet or UART command line menu).

Regards

Mark
[uTasker project developer for Kinetis and i.MX RT]

969 Views
EdSutter
Senior Contributor II

Thanks for responding...

I've been working through the 1020 version of that (Flashloader_RT1020_1.0_GA.zip).  As far as I can tell, most of it discusses the features of the bootloader itself (rather than the fundamentals of how an image is prepared & loaded onto a bare-metal board), and I don't get a warm and fuzzy feeling when I attempt to build the code right out of the SDK with MCUXpresso and it fails to build (looks like a simple memory map adjustment, but still...).

Anyway, I'm just trying to get over my first complete bare-metal build & install...

  • build a small program
  • post-process the created ELF file (elftosb??)
  • use the ROM serial-downloader to install it 
  • then allow the CPU to autoboot from the device that I just installed the program to (internal flash or SPI flash).

I wanna do this with simple tools (make, gcc and something like imx_usb_loader).  Once I can do that, then I'll figure out what (if any) bootloader to use.

I can do some of this with MCUXpresso and the demo_apps, but its a mystery regarding the post-processing of the elf file (elftosb maybe?) and  how it builds and installs the application to the board.  Plus, it uses the OpenSDA debugger and I want to start with nothing (just USB and ROM bootloader).

0 Kudos

969 Views
mjbcswitzerland
Specialist V

Ed

I build with a bat file that calls make. The bat file post processes the output with utilities that create all the files needed:
https://www.utasker.com/forum/index.php?topic=1445.0

including encrypting if required

Then I load via the USB ROM loader the first time and, once the serial loader is installed, subsequently with drag and drop.

Therefore I double click on the bat. file and drag and drop the generated output on the board, which is much easier and faster than needing multiple tools.

Regards

Mark
[uTasker project developer for Kinetis and i.MX RT]