Kinetis sections definitios (ICF?)

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

Kinetis sections definitios (ICF?)

Jump to solution
2,858 Views
sebasira
Senior Contributor I

Hello everybody!

I'm new to Kinetis family, and I can not find where the sections are defined. On ColdFire MCUs this was done inside the LCF file. Now, I've seen a ICF file, and I was guessing it would be it. But it starts with:

/*###ICF### Section handled by ICF editor, don't touch! ****/

So I'll ask before I touch it.

I'm working with IAR Workbench and the TWRK60 (K60N512). What I'd like is to define:

CODE           from     0x00000000 to 0x0007F7FF

NVM_data     from     0x0007F800 to 0x0007FFFF

How/Where can I do that?

Thanks in advance!

Best Regards,

SebaS

Labels (1)
0 Kudos
1 Solution
1,300 Views
chris_brown
NXP Employee
NXP Employee

Hi SebaS,

You can do this using the define this using the "define region" directive in the ICF (see the IAR help files - search for Define region directive).  An example of this would be:

define region ROM_region   = mem:[from __ICFEDIT_region_ROM_start__   to __ICFEDIT_region_ROM_end__]

The __ICFEDIT_region... text in this statement are simply symbols that were defined and they are the memory locations of with ROM begins and ends.  You can see more examples in the linker files in our Kinetis sample code.

As for your second question, you're just wanting to know how you make sure a variable will be stored in this section that you just created?  Yes?

Hope this helps,

Chris

View solution in original post

0 Kudos
8 Replies
1,300 Views
sebasira
Senior Contributor I

Also, if you could pelase provide an example on how to declare a constant 'variable' within this segment in the IAR IDE. (maybe using somekind of pragma).

Thank you!

SebaS

0 Kudos
1,301 Views
chris_brown
NXP Employee
NXP Employee

Hi SebaS,

You can do this using the define this using the "define region" directive in the ICF (see the IAR help files - search for Define region directive).  An example of this would be:

define region ROM_region   = mem:[from __ICFEDIT_region_ROM_start__   to __ICFEDIT_region_ROM_end__]

The __ICFEDIT_region... text in this statement are simply symbols that were defined and they are the memory locations of with ROM begins and ends.  You can see more examples in the linker files in our Kinetis sample code.

As for your second question, you're just wanting to know how you make sure a variable will be stored in this section that you just created?  Yes?

Hope this helps,

Chris

0 Kudos
1,300 Views
sebasira
Senior Contributor I

Chris, thanks for your reply!

Question 1 is now solve! About the other one, yes, you're right. That's what I need.

Assuming that in ICF I've got:


define region NVM_DATA_region   = mem:[from __ICFEDIT_region_NVM_DATA_start__   to __ICFEDIT_region_NVM_DATA_end__]



How can I put a variable (constant) inside NVM_DATA_region?

0 Kudos
1,300 Views
sebasira
Senior Contributor I

For those who would need the answer to the second question:

In ICF file:

place in NVM_DATA_region  {readonly section NVM_DATA_section};

and then before any variable you want you must:

#pragma location="NVM_DATA_section"

const int var;

Then var would be in NVM_DATA_region 

0 Kudos
1,300 Views
chris_brown
NXP Employee
NXP Employee

Ok.  So to put a variable in that section you now have to do a couple of other items.

1) In the linker, add this:   place in NVM_DATA_region {section NVM_DATA_section};

2) In your code, add this line immediately before (this line before) you declare your variable:  #pragma location = "NVM_DATA_section"

3) In your code, add __root just in front of your variable declaration, like this:  __root uint16 YourVariable;

That should get that variable in your section.

Hope this helps,

Chris

1,300 Views
sebasira
Senior Contributor I

What is the __root for?

0 Kudos
1,300 Views
chris_brown
NXP Employee
NXP Employee

I'm really not exactly sure what __root is for.  I was following an example from an IAR tech note.

Absolute placement (EWARM v.5.x and 6.x) (in C source) (Technical Note 36121)

0 Kudos
1,300 Views
sebasira
Senior Contributor I

Thanks Chris!

I have figure it out reading the IAR documentation... We must have posted at the same time!

Thanks for your help!

SebaS

0 Kudos