XIP from FlexSPI and read/write to same flash

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

XIP from FlexSPI and read/write to same flash

1,855 Views
muhammadumairkh
Contributor III

Hello NXP,

I am working on an iMXRT1176 based platform and the use case is that I want to boot from FlexSPI NOR flash and also use the same flash as a memory device at an offset of a few blocks so that it does not overwrite the executable image. To prevent conflicts with XIP, I linked the flash driver in RAM by modifying the linker file while the rest of the code executes out of flash. I have a few questions if you can answer:

  1. Is it possible to achieve this use-case? I am using NXP SDK for this purpose.
  2. I also discovered the presence of ROM API on iMXRT1176. Can ROM API be used to achieve this? 
  3. If answer to second question is yes, then can I call ROM API functions from flash or should they also be in RAM?
  4. I could not find a comprehensive documentation of the ROM API. Specially, the reasons behind the error statuses are not properly described. Can you share a ROM API user guide?

Thanks in advance.

0 Kudos
Reply
4 Replies

1,783 Views
jay_heng
NXP Employee
NXP Employee

No matter you relocate FlexSPI driver into RAM or call ROM API to erase/write flash, you still need to disable global interrupt during Flash operation (in case interrupt happened that time). because most Flash device doesn't support Read-While-Write feature.

0 Kudos
Reply

1,801 Views
jeremyzhou
NXP Employee
NXP Employee

Hi @muhammadumairkh ,

Thanks for your reply.
It needs to get the flexspi_nor_get_config prior to initializing the FLEXSPI module, you can refer to the evkmimxrt1170_fsl_romapi_cm7 demo to learn how to use the ROM API.
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
Reply

1,842 Views
jeremyzhou
NXP Employee
NXP Employee

Hi @muhammadumairkh ,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
1) Is it possible to achieve this use-case? I am using NXP SDK for this purpose.
-- Yes, it's able to make it.
2) I also discovered the presence of ROM API on iMXRT1176. Can ROM API be used to achieve this?
-- Yes, besides relocating the FlexSPI into the RAM, the ROM API is another option.
3) I could not find a comprehensive documentation of the ROM API. Specially, the reasons behind the error statuses are not properly described. Can you share a ROM API user guide?
-- Please refer to the 10.13 ROM APIs in the RM, further, there's a demo for the ROM API in the SDK.
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
Reply

1,805 Views
muhammadumairkh
Contributor III

Thank you @jeremyzhou for the response.

I have adopted an alternate strategy now. Just for feedback, I would mention that section 10.13 of the TRM is not comprehensive enough especially when the ROM API does not work straightaway and the user wants to debug it. Similarly, I also couldn't find details on how the ROM API gets details of the NOR flash. Is it from the "qspiflash_config" structure or something else? Because whenever I called the flexspi_nor_get_config(), it returned invalid flash parameters and came back with an error. Thinking that I might need to configure it first by calling flexspi_nor_flash_init() I tried this route as well but this too failed with an error code. So I had no idea how to proceed forward.

Anyway, thanks for the response and I hope you will add these details in the future revisions of the TRM.

Best Regards,
Umair