iMXRT1060 and Boot from FlexSPI

cancel
Showing results for 
Search instead for 
Did you mean: 

iMXRT1060 and Boot from FlexSPI

421 Views
Contributor I

Hi All,


I am working with iMXRT1060 and have a SPI NOR Flash connected to FlexSPI. I want to boot from this memory and in the delopment stage I don't need any security. I have created a simple image in IAR tool chain and now are trying to make file for SPI NOR for booting from it. During the boot stage I hope that the image will be copied to the ITCM address 0x0000 and started.

As I understood for this purpose I can use elftosb.exe utility using as input my created image file in S-Recod or ELF format, simple .BD file and after launching the utility I will get the output binary or .srec file, which I can program to the SPI NOR Flash using any Flash programmer.

Am I correct?

I have found the very simple .BD file:

--------- itcm.bd -------------

options {
flags = 0x00;
# Note: This is an example address, it can be any non-zero address in ITCM region
startAddress = 0x400;
ivtOffset = 0x400;
initialLoadSize = 0x1000;
# Note: This is required if the default entrypoint is not the Reset_Handler
# Please set the entryPointAddress to the base address of vector table
// entryPointAddress = 0x1400;
}

sources {
elfFile = extern(0);
}

section (0)
{
}

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

I copy my elf file in the folder with elftosb.exe  and I launch

elftosb.exe -f imx -V -c itcm.bd -o out.srec   

As a result output file is empty (the file length is 0).

My questions:

- why does the output file have zero length?

- how does "elftosb.exe" undestand the input file name and where it lays (how can I specify the input name)?

- can I use not elf but srec file format as input file?

Thanks and regards,

George Volokh.

0 Kudos
12 Replies

132 Views
NXP TechSupport
NXP TechSupport

Hi George Volokh,

Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
To provide the fastest possible support, I'd highly recommend you to refer to the post:
https://community.nxp.com/docs/DOC-341317 for details.

Have a great day,
TIC

 

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

132 Views
Contributor I

Dear Jeremy,

It's nice but absolutely not working in my case.

As I have already said I am working in the IAR tool chain.

What must I do in this situation?

Regards,

George Volokh.

0 Kudos

132 Views
NXP TechSupport
NXP TechSupport

Hi George Volokh,

Thanks for your reply.
To generating a bootable image, the first step: generating an image file, likes BIN, S19, Hex files, is not the same for different kinds of IDEs, however, rest steps are identical.
So I think https://community.nxp.com/docs/DOC-341317 is helpful.
The attachment presents how to generate a bootable image from an image file that is generated by IAR.

Have a great day,
TIC

 

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

132 Views
Contributor I

Dear Jeremy,

The task is very easy:

- I have a ready-made image (bin, elf or srec, all of them) which must

be loaded to ITCM location 0x0000 and ran,

- I want to create not secure bootable image for SPI Flash, connected to

FlexSPI (without any additional commands for NXP Flashloader).

Which .bd file and elftosb command line must I use?

Thanks in advance.

Best regards,

George Volokh.

0 Kudos

132 Views
NXP TechSupport
NXP TechSupport

Hi George Volokh,

Thanks for your reply.
 Which .bd file and elftosb command line must I use?
-- To implement a bootable image which will run in the ITCM finally, please follow the below steps.
1. To generate the bin file, call the command:
elftosb.exe -f imx -V -c ../../bd_file/imx10xx/imx-itcm-unsigned.bd -o xxx.bin xxx.srec
2 Generate the boot_image.sb
elftosb.exe -f kinetis -V -c ../../bd_file/imx10xx/program_flexspinor_image_qspinor.bd -o boot_image.sb xxx_nopadding.bin

Have a great day,
TIC

 

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

132 Views
Contributor I

Thanks Jeremy,

Please, send me these .bd files from these two stages.

Additional questions:

1. What is generated on this stage?

In the command line I see only .bd file and output file.

Where is the input file? Should the input file be my image file?

2.  What is generated on this stage?

I don't see the input file in the command line too.

Do I have a chance to download my image to the ITCM in the location 0x0000?

Regards,

George Volokh.

0 Kudos

132 Views
NXP TechSupport
NXP TechSupport

Hi George Volokh,

Thanks for your reply.
1) Please download the BD file through the link.
https://cache.nxp.com/secured/assets/downloads/en/programmers/FLASHLOADER-RT106x-1-GA.zip?__gda__=15...
2) About the command, the post and application note both have given a detailed introduction, please refer to them.

Have a great day,
TIC

 

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

132 Views
NXP Employee
NXP Employee

Hi George,

The default bd file that comes with the tools is not setup for booting from FlexSPI. The IVT offset used for FlexSPI boot is 0x1000, but that bd file sets the IVT offset to 0x400 (this is an IVT offset you might use for an SD card boot). I've attached a different BD file that I've modified to use addresses appropriate for booting from FlexSPI to ITCM. Use this bd file in the first command line step instead of imx-itcm-unsigned.bd.

For this file to work, you'll also need to configure your application so that the vector table is at 0x2000. The ROM will copy headers along with the application, so you lose some of the space at the beginning of RAM. You could theoretically use the 0-0x2000 as data space in your application later (can't modify it until after you've booted). This might be difficult to implement, but if you are really tight on RAM it's an option.

Hope this helps,

Melissa

0 Kudos

132 Views
Contributor I

Dear Melissa,

Thanks a lot for your answer.

But my result is the same, I can't generate bootable image.

I use the command line:

elftosb.exe -f imx -V -c imx-itcm-flexspi-boot-unsigned.bd  -o out.bin 

boot.out

imx-itcm-flexspi-boot-unsigned.bd file is yours, I didn't modify it yet.

boot.out - is the elf image from the IAR compiler, where the boot code

is linked from the address 0x2000.

out.bin - is the name of output bootable file which I want to generate.

The result is: the out.bin file is generated, but the file length is 0

bytes.

I am clearly doing something wrong, but what?

Where is a mistake?

Best regards,

George Volokh.

0 Kudos

132 Views
NXP Employee
NXP Employee

Hi George,

I don't see any issues with the command line. Could you share the application you are using for testing? If I could get the file in srec format that would be best. I can try it here.

Regards,

Melissa

0 Kudos

132 Views
Contributor I

Melissa,

As always, thanks a lot for your patience and very professional support.

I saw my mistake. The image was created with some data located in

addresses less than 0x1000.

And the utility elftosb used to make something without any diagnostic

and as a result I got a zero length output file.

Now I have generated correct (in my opinion) image file in srec format

and elftosb works better.

It has generated the binary output file. I am attaching input and output

files.

But I see that in the output file the Configuration Block (the first

0x1000 area) is absolutely empty.

Is it correct? It should begin with the tag 0x42464346 ("FCFB") and

other data (RM page 223).

Should I fill this area myself or using the elftosb utility the second time?

If I must to use elftosb the second time, what should be the .DB file

and command line?

Thanks again.

Best regards,

George Volokh.

0 Kudos

132 Views
NXP Employee
NXP Employee

Hi George,

Glad to hear you are making forward progress now. The file you have so far sounds correct. The second elftosb pass creates the file interpreted by our flashloader. The FCB is actually generated by the flashloader while downloading the final sb file to your board, so you won't have an FCB in the file yet. Actually, the final output won't have the FCB either, but it does have directions the flashloader uses to generate the FCB. 

For the second elftosb pass the program_flexspinor_image_qspinor.bd file recommended by Jeremy is the correct file to use. The command line he recommended is also right (make sure to use -f kinetis for the second efltosb call instead of -f imx like you use for the first round).

Regads,

Melissa

0 Kudos