ICF file to load code to flash and copy to ITCM for execution

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

ICF file to load code to flash and copy to ITCM for execution

Jump to solution
5,979 Views
itsme12_01
Contributor II

Hello, I wanted to modify the ICF file to achieve the following :

  • Load the code to External Flash
  • Copy the code to ITCM and data to DTCM for execution.

I created data regions Flash_code_region, Itcm_code_region and dtcm_data_region with sufficient memory.

Then I placed the readonly sections in Flash_code_region and readwrite data sections in dtcm_data_region by initialize by copy. Now what do I place in Itcm_data_region for execution ?
Placing the same readonly sections by initialize by copy just results in ambiguous section match. So please tell me how I can achieve it .

0 Kudos
Reply
1 Solution
5,839 Views
itsme12_01
Contributor II

I was able to find the answer to my query.

As I understand it, to load code to flash and then copy to RAM for execution, 

Initialize by copy - readonly, readwrite

Place the required sections in RAM regions

Place only the _init sections in Flash regions

View solution in original post

12 Replies
5,968 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
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.
Moreover, there's an alternative solution for you, the ROM code can copy the bootable image to the RAM and starts up the application binary. It's a NON-XIP mode and the below figure shows the flow.

jeremyzhou_0-1646792780876.png


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
5,961 Views
itsme12_01
Contributor II

Hello,

Thank you for the response.

I did take a look into the post you mentioned. I understand we can place the code in ITCM, DTCM regions.And to execute the code in XiP, it requires certain sections like IVt, BD, Image to be placed in certain location offsets as mentioned in this application note AN12238: i.MX RT Flashloader Use Case – Application Note (nxp.com.cn)

But, say if I wanted to place the code in external flash in a location outside of those offsets. And then I wish to execute the code by copying code and read-write data sections to ITCM and DTCM respectively. Can't this be done by creating the ICF file thereby specifying the regions and placing the sections ?

For that, do we need to mention the area in Flash where the code is to be loaded ?
Or do we just need to mention the areas in ITCM and DTCM where the code and data are to be placed for execution ?

 

0 Kudos
Reply
5,938 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
1) Can't this be done by creating the ICF file thereby specifying the regions and placing the sections?
-- Yes, I think it can do it by modifying the ICF file.
2) For that, do we need to mention the area in Flash where the code is to be loaded?
Or do we just need to mention the areas in ITCM and DTCM where the code and data are to be placed for execution?
-- Actually, I'm not very clear with this question, can you clarify it again.
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
5,935 Views
itsme12_01
Contributor II

Hi,

I had meant that to achieve it by describing the regions and placements in the ICF file,

Should we define a memory region corresponding to the Flash, then place the code in flash. Like,

define region Flashregn : [address range in flash]

And also define a memory region in the ITCM and DTCM of RAM, then place the code and data respectively there as well. Like,

define region itcmregn: [address range in ram itcm]

define region dtcmregn: [address range in ram dtcm]

And if we do have to do that, what sections, like readonly, ro code, ro data etc, would I place in each of these regions, so as to have the code loaded to flash, and then copied to ram for execution. Also do I use the initialize by copy  to have the data copies to RAM.

I hope I was able to explain the scenario.

And thank you for the reply.

0 Kudos
Reply
5,911 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
1) Should we define a memory region corresponding to the Flash, then place the code in flash. Like,
-- Yes.
2) And if we do have to do that, what sections, like readonly, ro code, ro data etc, would I place in each of these regions, so as to have the code loaded to flash, and then copied to ram for execution. Also do I use the initialize by copy to have the data copies to RAM.
-- Yes.
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
5,906 Views
itsme12_01
Contributor II

Hello,

Thank you for the response.

But could you tell me which sections I should be placing in the defined regions, to achieve the load to flash, copy and execute from RAM scenario.

Say, I have defined the following regions, 

define region Flashregn : [address range in flash]

define region itcmregn: [address range in ram itcm]

define region dtcmregn: [address range in ram dtcm]

Which sections should I place in the regions ?

place in Flashregn/itcmregn/dtcmregn { ??? }

Also, 

Initialize by copy { all sections that are placed to ram regions ??? }

0 Kudos
Reply
5,892 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply。
Actually, it's too hard to explain the step-by-step from the start, to provide the fastest possible support, I'd highly recommend you to refer to the article.
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
5,885 Views
itsme12_01
Contributor II

Hello @jeremyzhou ,

The link that you have shared is not accessible. 

0 Kudos
Reply
5,880 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,

Thanks for your reply.
Please check the attachment.
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
5,863 Views
itsme12_01
Contributor II

Hello,

I apologize for the delayed response. The document you had shared was in another language and after translating it, it was really hard to understand.

I could not understand what I should place in my defined regions so that I can load the code to flash, then fully copy to RAM and execute at RAM.

Basically, in the ICF file what to put within the { } below,

place in FlashRgn : { }

place in ITCM : { }

place in DTCM : { }

initialize by copy : { }

 

0 Kudos
Reply
5,840 Views
itsme12_01
Contributor II

I was able to find the answer to my query.

As I understand it, to load code to flash and then copy to RAM for execution, 

Initialize by copy - readonly, readwrite

Place the required sections in RAM regions

Place only the _init sections in Flash regions

5,605 Views
venkat7
Contributor I

Hi,

      I need help regarding similar to what you have done.

 

1. I Want to load code into QSPI NOR flash either through JTAG/SWD. After power on copy code from QSPI flash to internal RAM(in ITCM as i understood from this post)..... uP is i.MXRT1175.

2. Allocating variable Data into DTCM during program itself.

Please suggest me what changes need to be done in an example code given by NXP. Can you share modifications.

Thanks in advance.

K.Venkatarao.

0 Kudos
Reply