clarification on copied to RAM at startup

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

clarification on copied to RAM at startup

Jump to solution
607 Views
vihaanred
Contributor III

Hi,

i  have read the following statement in code warrior build tool utilities

DEFAULT_ROM INTO READ_ONLY  0xA00 TO 0xBFF;

reserves the address range from 0xA00 to 0xBFF for allocation of read only objects .text subsumes all linked functions, all constant variables, all string constants and all initialization parts of variables, copied to RAM at start up.

 

i did not understand the statement "copied to RAM at startup" what is copied into RAM and why it is copied? please help me to understand?

 

thanks and regards,

vihaan

Labels (1)
0 Kudos
1 Solution
416 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hello vihaan,

do you refer to the "copied to RAM at startup" in default Start08.c or Start12.c?

if yes, this part of code is to    copy initialization data from ROM to RAM  .

for example we define a global variable:

unsigned int g_val = 0x1234;

before power on chip, g_val is in ROM, it's not possible in RAM because RAM can't store anything when power off,

once power on, "copied to RAM at startup" routine is needed to copy g_val value from ROM to RAM, becuase g_val is global variable, it must be in RAM memory when power on.

does this clarify the issue?

Best Regards,

Zhang Jun.

==============================================================

this answer is for you, if it helps, please click on "Correct Answer" button. Thanks!

==============================================================

View solution in original post

0 Kudos
3 Replies
417 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hello vihaan,

do you refer to the "copied to RAM at startup" in default Start08.c or Start12.c?

if yes, this part of code is to    copy initialization data from ROM to RAM  .

for example we define a global variable:

unsigned int g_val = 0x1234;

before power on chip, g_val is in ROM, it's not possible in RAM because RAM can't store anything when power off,

once power on, "copied to RAM at startup" routine is needed to copy g_val value from ROM to RAM, becuase g_val is global variable, it must be in RAM memory when power on.

does this clarify the issue?

Best Regards,

Zhang Jun.

==============================================================

this answer is for you, if it helps, please click on "Correct Answer" button. Thanks!

==============================================================

0 Kudos
416 Views
vihaanred
Contributor III

Thank you very much. Yes it does clarify my doubt.  

0 Kudos
416 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

you are welcome!

0 Kudos