program image structure

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

program image structure

2,675 次查看
syed1
Contributor II

Hello

We are currently utilizing the MIMXRT1011CAE4A processor and MCU Expresso IDE tool for our board. We intend to boot our board via an external NOR flash (MT25QU512ABB). We have already placed a bin file of our application in the external flash. However, in the IMXRT1010 reference manual, it is mentioned that the program image should have an Image Vector Table and Boot data along with the application code. If yes, how do we add the IVT and boot data to our program image?

0 项奖励
回复
12 回复数

2,658 次查看
Pablo_Ramos
NXP Employee
NXP Employee

Hi @syed1 
In order to add the IVT and boot data to the image you need to:
Right click on the project -> Properties -> Settings -> Check if the XIP_EXTERNAL_FLASH & XIP_BOOT_HEADER_ENABLE are set to 1

Pablo_Ramos_1-1715897887688.png

With this during compilation the IVT and boot data will automatically be added to your Image

Hope it help you!

 

0 项奖励
回复

2,646 次查看
syed1
Contributor II

Hi @Pablo_Ramos

Thanks for the reply.

As you mentioned, the settings XIP_EXTERNAL_FLASH and XIP_BOOT_HEADER_ENABLE is set to 1. I've generated a binary file of evkmimxrt1010TOGGLE_igpio_led_output, and I will provide the link. I've used another example, flexspi_nor_polling_transfer, to transfer this binary file to external flash using file handling functions (fopen, fread, fwrite, fseek). I will also provide the binary file. When I turn on the board, the GPIO pin should toggle, which is my application code. However, that is not happening. Where did I go wrong? Are there any other settings that I should consider? Explain booting from external flash in detail.gpio.png

 

 

0 项奖励
回复

2,633 次查看
Pablo_Ramos
NXP Employee
NXP Employee

Hi @syed1

Looking at your binary file, I notice that it doesn't have the IVT and boot data in it. You can see in the image how your binary starts directly with the code, but in the binary with IVT and boot data starts with some FF and then the boot data.

Pablo_Ramos_6-1715978532859.pngPablo_Ramos_7-1715978536880.png

In order to check if the binary is generated correctly you can go to the xip folder and check the evkmimxrt1010_flexspi_nor_config.c & fsl_flexspi_nor_boot.c files.

Pablo_Ramos_2-1715978367191.png

In these two files you could see how the IVT and boot data are generated, if XIP_EXTERNAL_FLASH & XIP_BOOT_HEADER_ENABLE are set to 1 the code on these files would be enable (not in gray).

Pablo_Ramos_8-1715978550447.png

Pablo_Ramos_9-1715978554031.png

If this is not the case, try to rebuild the project.
When the code is enabled, you can generate the binary going to the Debug folder -> right click on the .axf file - > Binary Utilities -> Create binary

Pablo_Ramos_10-1715978561265.png

Hope it help you!

 

 

0 项奖励
回复

2,385 次查看
syed1
Contributor II

Hello @Pablo_Ramos 

Thanks for your reply.

I've generated a new binary file that includes the IVT structure at 0x1000. As you mentioned, the binary file starts with some FF and boot data, followed by the IVT structure. However, booting from the external flash still isn't happening. What could be the reasons for this?

While transferring bin file to flash I've written flash start address as 0. Is it correct?

bin 2.png

 
 

 

0 项奖励
回复

2,357 次查看
Pablo_Ramos
NXP Employee
NXP Employee

Hi @syed1 
There could be different reason. For example, the most common are:

FlexSPI configuration
GPIO configuration
Image address location.

In order to check the FlexSPI configuration you can use MCUXpresso Secure Provisioning Tool.
MCUXpresso Secure Provisioning Tool | NXP Semiconductors

This tool will help you to generate a bootable image according to your memory.
In some cases, you would need to customize the FlexSPI NOR template that the tool provides because the SDK examples are made and tested for the EVK's memory.

Here are some steps that could help you to test the configuration for your memory.

Create a workspace, select the processor and go to boot memory configuration.

Pablo_Ramos_0-1716323403262.png

You will see a new window where you can select the configuration of the memory, once you finish the configuration you can check the communication with the test button.

Pablo_Ramos_1-1716323424883.png

If the communication is successful, you can write an image using the tool.

Refer to chapter 6.2 of User Guide - MCUXpresso Secure Provisioning Tool

Pablo_Ramos_2-1716323456064.png

The post explains further how you can configurate the FlexSPI to boot from an external memory.

i.MX RT FLEXSPI booting guide - NXP Community

About the address issue, if you are able to read the content of the flash memory you would need to check if the IVT is in the expected address.

 

0 项奖励
回复

2,277 次查看
syed1
Contributor II

Hello @Pablo_Ramos 

Thank you for reaching out.

I'm using the MIMXRT1011CAE4A processor with the MCU Expresso IDE tool. I aim to boot the processor from the external NOR flash (MT25QU512ABB) through FlexSPI. I'm wondering if it's necessary to load the flashloader binary (ivt_flashloader.bin) into the RAM.

I've generated a binary file of my application code, which includes boot data and the IVT structure alongside the application code. Should I directly flash the program image to the flash memory, or do I need to load the Flash loader first and then repeat this process?

Currently, I'm simply writing the program image (which is the binary file of my application code) through file handling functions in the MCU Expresso IDE tool. Could you please clarify and explain the required process to boot my processor from external flash?

BR,

Syed 

 

0 项奖励
回复

2,171 次查看
Pablo_Ramos
NXP Employee
NXP Employee

Hi @syed1 ,

Regarding your questions:

What is the purpose of using the secure provisioning tool?
The tool will help you to generate and write a bootable image according to your memory, in addition you can check if you are able to communicate with the chip and memory.

There is another option of using serial port. Can we use that instead of USB?
Yes, there is an option where you can communicate your chip to the tool via serial port. But you can only use LPUART1 pins.

Pablo_Ramos_7-1717020584123.pngPablo_Ramos_8-1717020588857.png

For booting process, we directly placed program image in the flash. Is this wrong?
There is no issue of programing the image directly to the flash, that is the procedure.

Do we need to load ivt_flashloader.bin file first and after that required image?
No, once you program your image in to the memory you don't need the flashloader anymore.

Could you please clarify and explain the required process to boot my processor from external flash?
The first thing that happens when you boot your processor is the power-up sequence, if this isn't made correctly the processor boot could fail.
In the MIMXRT1011CAE4A the power up sequence is the following.

Pablo_Ramos_9-1717020607353.png

If you want to check more about the power-up sequence or any other hardware specification you can check the Hardware Development Guide from the RT1010 documentation page.

Pablo_Ramos_10-1717020623748.png

The next step is the boot mode, the boot rom will check the status of the boot mode pins to determine boot mode (boot from fuses, serial downloader or internal boot)

The way the boot mode works is the following.

Pablo_Ramos_11-1717020631851.png

Refer to
Chapter 9.3.1 of i.MX RT1010 Processor Reference Manual

Then the boot rom will check the boot config pins, once the processor knows he will read the image from an external memory he needs to configure the FlexSPI in order to do so.
The steps that the processor does are the following:

Pablo_Ramos_12-1717020644106.png

Refer to
Chapter 9.6.1.1 of i.MX RT1010 Processor Reference Manual

Also, there is a video from the official NXP YouTube page where you can find some explanation about the boot options and some code examples:

MCU Tech Minutes | Boot Options for i.MX RT Crossover MCUs (youtube.com)

Hope it helps you

 

0 项奖励
回复

2,162 次查看
syed1
Contributor II

Hello @Pablo_Ramos 

Thank you for reaching out.

We've recently enabled the options XIP_EXTERNAL_FLASH=1 and XIP_BOOT_HEADER_ENABLE=1 in the settings. I'm curious about the necessity of activating XIP mode in the external flash. Additionally, I've noticed that these configuration bits are present in both non-volatile and volatile configuration registers. While I've been able to read these registers using the flexspi_nor_read() functions, I've encountered difficulty when attempting to write to them. If it is indeed necessary to enable these bits, could you advise on how to access and potentially modify them?

status_t flexspi_nor_read(FLEXSPI_Type *base, uint8_t *value)

{

uint32_t temp1;

flexspi_transfer_t flashXfer;

flashXfer.deviceAddress = 0;

flashXfer.port = FLASH_PORT;

flashXfer.cmdType = kFLEXSPI_Read;

flashXfer.SeqNumber = 1;

flashXfer.seqIndex = NOR_CMD_LUT_SEQ_IDX_READNONVOLATILEREG;

flashXfer.data = &temp1;

flashXfer.dataSize = 1;

 

status_t status = FLEXSPI_TransferBlocking(base, &flashXfer);

 

*value = temp1;

 

/* Do software reset or clear AHB buffer directly. */

#if defined(FSL_FEATURE_SOC_OTFAD_COUNT) && defined(FLEXSPI_AHBCR_CLRAHBRXBUF_MASK) && \

defined(FLEXSPI_AHBCR_CLRAHBTXBUF_MASK)

base->AHBCR |= FLEXSPI_AHBCR_CLRAHBRXBUF_MASK | FLEXSPI_AHBCR_CLRAHBTXBUF_MASK;

base->AHBCR &= ~(FLEXSPI_AHBCR_CLRAHBRXBUF_MASK | FLEXSPI_AHBCR_CLRAHBTXBUF_MASK);

#else

FLEXSPI_SoftwareReset(base);

#endif

 

return status;

}

xip3.pngxip 4.png

 

0 项奖励
回复

2,111 次查看
Pablo_Ramos
NXP Employee
NXP Employee

Hi @syed1 ,
You may experience some trouble accessing the memory using SDK example/functions because the examples are made and tested for the EVK and you are using a different hardware, I recommend you compare the LUT from both memory in order to know if the commands are different.

You can find the memory from the EVK in the Schematic from the Design Files.

Pablo_Ramos_0-1717535680087.png

If the commands are different you would need to change the LUT in your code. You can use the following application note to see how you can check if the commands are different and how modify the LUT from your code.

How to Enable Debugging for FLEXSPI NOR Flash (nxp.com)

If you still have questions about this, please help me creating a new post with all the context in order to keep better track of Q&A.

Hope it help you!

0 项奖励
回复

2,098 次查看
syed1
Contributor II

Hello @Pablo_Ramos 

Thank you for reaching out.

I've mistakenly changed the values of NON-VOLATILE configuration register. Now the flash is running in XIP mode instead of SPI mode. For deactivating XIP mode, flash device datasheet mentioned particular procedure which I'll provide below. How to send the bit on DQ0 on first clock dummy cycle? NVCR.png

0 项奖励
回复

2,083 次查看
Pablo_Ramos
NXP Employee
NXP Employee

Please help me creating a new post for these new questions with all the context in order to keep better track of Q&A.

0 项奖励
回复

2,340 次查看
syed1
Contributor II

Hello @Pablo_Ramos 

Thank you for reaching out.

You mentioned a tool, but it requires USB of particular vendor id. But in our customized board we used USB(CYUSB2014-BZXCT). What is the purpose of using the secure provisioning tool?

There is another option of using serial port. Can we use that instead of USB?

For booting process, we directly placed program image in the flash. Is this wrong?

Do we need to load ivt_flashloader.bin file first and after that required image?

I've already explained the process we're following. Correct it if there is any mistake in the process we're following.

I hope you clarify my doubts regarding booting.

I referred the documents you provided before, but unable to understand as i am new to this tool.

BR

Syed

 

0 项奖励
回复