<?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>S12 / MagniV MicrocontrollersのトピックRe: Copy Values from ROM to RAM at startup</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Copy-Values-from-ROM-to-RAM-at-startup/m-p/140435#M3110</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Hello Donal,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;I do not quite understand why the variables at the two different locations cannot have&amp;nbsp;different names.&amp;nbsp; I assume that the RAM locations could be global variables, and explicitly assigned an initial value corresponding to the required constant value.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Or have I missed something obvious?&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Regards,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Mac&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 Dec 2006 18:55:08 GMT</pubDate>
    <dc:creator>bigmac</dc:creator>
    <dc:date>2006-12-18T18:55:08Z</dc:date>
    <item>
      <title>Copy Values from ROM to RAM at startup</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Copy-Values-from-ROM-to-RAM-at-startup/m-p/140434#M3109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hello All,&lt;BR /&gt;I have a problem where I need to copy calibrations from ROM to RAM upon startup, but I wish to keep the same variable name throughout the application code.&lt;BR /&gt;&lt;BR /&gt;For example, a calibration variable initialization is as follows:&lt;BR /&gt;&lt;BR /&gt;#pragma CONST_SEG EEPROM_CALS&lt;BR /&gt;extern const U32 Sb10_Constant8 = 0x0023;&lt;BR /&gt;&lt;BR /&gt;Now, this variable is used throughout the application. And there are certain situations when I will want to modify this value, to test the behaviour of the application to this new value. I may also want to flash this new value back into EEPROM.&lt;BR /&gt;&lt;BR /&gt;There can't be a second RAM variable for this, as part of the application is auto generated.&lt;BR /&gt;So the following simple solution would not suffice:&lt;BR /&gt;Sb10_Constant8_RAM = Sb10_Constant8_ROM;&lt;BR /&gt;&lt;BR /&gt;Is there any method to allow the variable initialization to occur but upon start-up the value is copied into RAM with the variable name Sb10_Constant8 always residing in RAM?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Donal&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Dec 2006 18:32:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Copy-Values-from-ROM-to-RAM-at-startup/m-p/140434#M3109</guid>
      <dc:creator>Donal</dc:creator>
      <dc:date>2006-12-18T18:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Values from ROM to RAM at startup</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Copy-Values-from-ROM-to-RAM-at-startup/m-p/140435#M3110</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Hello Donal,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;I do not quite understand why the variables at the two different locations cannot have&amp;nbsp;different names.&amp;nbsp; I assume that the RAM locations could be global variables, and explicitly assigned an initial value corresponding to the required constant value.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Or have I missed something obvious?&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Regards,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Mac&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Dec 2006 18:55:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Copy-Values-from-ROM-to-RAM-at-startup/m-p/140435#M3110</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2006-12-18T18:55:08Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Values from ROM to RAM at startup</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Copy-Values-from-ROM-to-RAM-at-startup/m-p/140436#M3111</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 assume you are using CodeWarrior for HC08 or HC12 as development software. Am I right?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If this is the case, the standard Startup code we are delivering is copying initialization value from ROM to RAM at startup. Just make sure you are using ANSI C startup and not minimal startup code when creating your application.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If you have already created your project, make sure to remove the option -D__ONLY_INIT_SP from the compiler command line and rebuild your application.&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, 18 Dec 2006 19:47:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Copy-Values-from-ROM-to-RAM-at-startup/m-p/140436#M3111</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2006-12-18T19:47:47Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Values from ROM to RAM at startup</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Copy-Values-from-ROM-to-RAM-at-startup/m-p/140437#M3112</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi Mac : The names of the calibration variables are global, but we can't change them as they are autogenerated along with a large proportion of the code. If we were to have different names then it would involve a lot or rework each time the autogenerated code is updated.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;CrasyCat: I am using Codewarrior for the HCS12. So I have to modify this startup code so that it will copy my calibrations from ROM to RAM. Will the varibale names also point to the RAM copies rather than ROM?&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Donal&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Dec 2006 19:51:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Copy-Values-from-ROM-to-RAM-at-startup/m-p/140437#M3112</guid>
      <dc:creator>Donal</dc:creator>
      <dc:date>2006-12-18T19:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Values from ROM to RAM at startup</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Copy-Values-from-ROM-to-RAM-at-startup/m-p/140438#M3113</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;What you wish to do is to allocate a variable at two locations. That isn't possible, since it doesn't make sense. But if you must, you could simulate that behaviour with macros. Lets assume that MY_VAR is the holy name that you use all over the code which cannot be changed:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#define MY_VAR (*address)&lt;BR /&gt;&lt;BR /&gt;#pragma CONST_SEG GLOBAL_ROM&lt;BR /&gt;const volatile int myVarROM = something;&lt;BR /&gt;&lt;BR /&gt;#pragma DATA_SEG GLOBAL_RAM&lt;BR /&gt;volatile int myVarRAM = myVarROM;&lt;BR /&gt;&lt;BR /&gt;volatile int* address = &amp;amp;myVarROM&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt;...&lt;BR /&gt;myVarRAM = changedToSomething;&lt;BR /&gt;address = &amp;amp;myVarRAM;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Dec 2006 22:56:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Copy-Values-from-ROM-to-RAM-at-startup/m-p/140438#M3113</guid>
      <dc:creator>Lundin</dc:creator>
      <dc:date>2006-12-18T22:56:37Z</dc:date>
    </item>
  </channel>
</rss>

