i.MX6 SPI Flash boot

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

i.MX6 SPI Flash boot

1,787 Views
neilturner
Contributor III

Hi,

I am developing a 'bare metal' project based on the  SCM-i.MX 6Q which internally has a 10Mbyte SPI flash device wired to ESCPI1.

I am trying to build a small boot image to program into the SPI flash which I want the boot ROM code to load and run from OCRAM. Are there any restrictions as to where the boot ROM code will load an image? According to page 382 of the i.MX6 Reference Manual, OCRAM above address 0x00907000 is shown as 'Free Area' so I am hoping I can load and execute a small program in this area. Is this allowed by the Boot ROM code? 

So far I have created the image containing an IVT which gets programmed at offset 0x400 from the base of the SPI Flash, I have also defined the boot data to load the image at address 0x00917000. (I have written my own flash programmer and can see this is correctly programmed into the flash).

When I power cycle the board, it does not boot, but if I attach with a jtag debugger (without loading a program) I can see that the boot ROM has loaded the first 4K of the SPI flash into OCRAM at address 0x00907000 (which is supposed to be free memory!) but has done nothing else. The memory where my program should be (0x0091700) is uninitialized. 

Should this work or am I trying to do something which is not allowed by the boot ROM code?

3 Replies

873 Views
neilturner
Contributor III

Hi Gary, igor,

Thank you for your help! I am now able to get the boot ROM to load and run my image from SPI flash. The problem was due to the IVT somehow becoming written in flash big endian rather than little endian, hence it was rejected.  All working now. Thanks again.

Regards,

Neil

0 Kudos

873 Views
igorpadykov
NXP Employee
NXP Employee

Hi Neil

one can look at baremetal example (ivt in startup.s) on

https://community.nxp.com/message/422530?commentID=422530#comment-422530 

Best regards
igor

871 Views
gary_bisson
Senior Contributor III

Hi,

Yes it is fine to load your bootloader in OCRAM (if it fits), there's nothing that prevents that behavior.

It is used for all the platforms that use U-Boot SPL, or for instance the QNX IPL is also loaded in OCRAM with no issue.

I suggest you check your IVT header, a good test would be to first check your image with imx_usb_loader or sb_loader so you don't have to flash it every single time. If it works with SDP (serial download protocol) it will work from the SPI NOR.

Regards,

Gary