<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: data in memory after compilation and link in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/data-in-memory-after-compilation-and-link/m-p/131924#M1213</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;I did both steps as you said. There is no that option -D__ONLY_INIT_SP in "Compiler for HC12"&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Do you mean the gobal variable is defined for the system instead of the&amp;nbsp;global variables declared for my application.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;My case is like that. when power outage occurs, I have to decide whether my application restarts completely or returns to where it was before power outage. If the duration is longer than 2 seconds, it will go to restart, otherwise return to where it was. I don't have a problem with restart, but I do have a problem with returning back. Remember that, There is a hug capacitor on board so that it can hold power for memory about 5 minutes.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;When power surge occurs (less than 2 seconds), my application should go back where it was. So it will skip all my application's initializations and jump to&amp;nbsp;its main loop. It appears that I missed something when I make a jump. Therefore, I want to learn if it will keep my data in the memory intact after MCU has been reset by CPU RESET.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Do you have any other concerns and advice about power surge and system restart?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Pang&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 28 Apr 2007 00:48:28 GMT</pubDate>
    <dc:creator>Pang</dc:creator>
    <dc:date>2007-04-28T00:48:28Z</dc:date>
    <item>
      <title>data in memory after compilation and link</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/data-in-memory-after-compilation-and-link/m-p/131922#M1211</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Enir.: CW4.5 and MC9S12XDP512&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Problem:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;#include ...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;int i = 5;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;void main(...)&lt;/DIV&gt;&lt;DIV&gt;{&lt;/DIV&gt;&lt;DIV&gt;....&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Since I am not familar with the Principle of Compiler and Linker, I am wondering, when MCU starts running, will it run a machine code to assign 5 to the memory of i or 5 has already been put into the mory of i after CW debugger loads the program into S12X system.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks a lot for any inputs.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Pang&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Apr 2007 04:03:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/data-in-memory-after-compilation-and-link/m-p/131922#M1211</guid>
      <dc:creator>Pang</dc:creator>
      <dc:date>2007-04-27T04:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: data in memory after compilation and link</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/data-in-memory-after-compilation-and-link/m-p/131923#M1212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;When you are using CodeWarrior for HC12, the default startup code we are delivering is initializing the global variable to their initialization value automatically.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Just make sure:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; 1 - You have created your project using the wizard (or a stationery)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; 2- You did select "ANSI C startup" in the wizard when you have created the project.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If you are not sure about item 2 above, just check the Compiler for HC12 commend line:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; - Start the IDE&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; - Open the project&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; - Open the target settings dialog (press ALT+F7)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; - Switch to "Compiler for HC12" panel.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If you see the option -D__ONLY_INIT_SP this is wrong.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Just remove that option from the command line and you should be fine.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;And make sure you are using the startup code we are delivering (module is called start12.c).&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I hope this helps.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Apr 2007 12:51:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/data-in-memory-after-compilation-and-link/m-p/131923#M1212</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2007-04-27T12:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: data in memory after compilation and link</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/data-in-memory-after-compilation-and-link/m-p/131924#M1213</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;I did both steps as you said. There is no that option -D__ONLY_INIT_SP in "Compiler for HC12"&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Do you mean the gobal variable is defined for the system instead of the&amp;nbsp;global variables declared for my application.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;My case is like that. when power outage occurs, I have to decide whether my application restarts completely or returns to where it was before power outage. If the duration is longer than 2 seconds, it will go to restart, otherwise return to where it was. I don't have a problem with restart, but I do have a problem with returning back. Remember that, There is a hug capacitor on board so that it can hold power for memory about 5 minutes.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;When power surge occurs (less than 2 seconds), my application should go back where it was. So it will skip all my application's initializations and jump to&amp;nbsp;its main loop. It appears that I missed something when I make a jump. Therefore, I want to learn if it will keep my data in the memory intact after MCU has been reset by CPU RESET.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Do you have any other concerns and advice about power surge and system restart?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Pang&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Apr 2007 00:48:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/data-in-memory-after-compilation-and-link/m-p/131924#M1213</guid>
      <dc:creator>Pang</dc:creator>
      <dc:date>2007-04-28T00:48:28Z</dc:date>
    </item>
    <item>
      <title>Re: data in memory after compilation and link</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/data-in-memory-after-compilation-and-link/m-p/131925#M1214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I am not sure I understand what you are trying to achieve here.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;When you want to continue where you were previously, this is usually not the Startup code, but some other place in the application.&lt;/DIV&gt;&lt;DIV&gt;So In my opinion you are not running the Startup code again in that situation.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If you are not able to continue from where you where, it might be that the processor entered an un-determined state that you cannot recover from.&lt;/DIV&gt;&lt;DIV&gt;Also I am not sure whether (and how long) the hardware keeps the content of the RAM.&lt;/DIV&gt;&lt;DIV&gt;You might have lost the content of the stack or the value of the global variable at that time.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2007 14:09:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/data-in-memory-after-compilation-and-link/m-p/131925#M1214</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2007-04-30T14:09:18Z</dc:date>
    </item>
  </channel>
</rss>

