<?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 const address in ColdFire/68K Microcontrollers and Processors</title>
    <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/const-address/m-p/151264#M3936</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'm using codewarrior but I get a "illegal constant expression" when declaring something like:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;u08* const ptr = (u08* const)&amp;nbsp; ( (u32)&amp;amp;array[16] &amp;amp; ~0xF );&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;It seems to me that the above expression be evaluated before runtime.&lt;/DIV&gt;&lt;DIV&gt;Can anybody help?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks in advance.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Feb 2009 01:50:50 GMT</pubDate>
    <dc:creator>Caius</dc:creator>
    <dc:date>2009-02-11T01:50:50Z</dc:date>
    <item>
      <title>const address</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/const-address/m-p/151264#M3936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'm using codewarrior but I get a "illegal constant expression" when declaring something like:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;u08* const ptr = (u08* const)&amp;nbsp; ( (u32)&amp;amp;array[16] &amp;amp; ~0xF );&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;It seems to me that the above expression be evaluated before runtime.&lt;/DIV&gt;&lt;DIV&gt;Can anybody help?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks in advance.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2009 01:50:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/const-address/m-p/151264#M3936</guid>
      <dc:creator>Caius</dc:creator>
      <dc:date>2009-02-11T01:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: const address</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/const-address/m-p/151265#M3937</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi&lt;BR /&gt;&lt;BR /&gt;I have notices similar things with CW.&lt;BR /&gt;&lt;B&gt;&lt;/B&gt;&lt;BR /&gt;It is (probably) due to array[] not being a real constant but rather being built on the stack. In this case it is not possible for the linker to deliver a const pointer value (since it is only known at run time).&lt;BR /&gt;I expect that you have array[] only actually alive in a limited part of code, like&lt;BR /&gt;&lt;B&gt;case 1:&lt;BR /&gt;{&lt;BR /&gt;const u32 array[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18};&lt;BR /&gt;u08* const ptr = (u08* const)&amp;nbsp; ( (u32)&amp;amp;array[16] &amp;amp; ~0xF );&lt;BR /&gt;}&lt;/B&gt;&lt;BR /&gt;This means that the contents of the array are 'handled' as const (no changes are allowed by code) but are not necessarily consts in FLASH.&lt;BR /&gt;If you add &lt;B&gt;static&lt;/B&gt; it should solve it. This forces them to be committed to FLASH.&lt;BR /&gt;&lt;BR /&gt;&lt;B&gt;static const u32 array[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18};&lt;/B&gt;&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;&lt;BR /&gt;Mark&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.uTasker.com" rel="nofollow" target="_blank"&gt;www.uTasker.com&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2009 07:47:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/const-address/m-p/151265#M3937</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2009-02-11T07:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: const address</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/const-address/m-p/151266#M3938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;The legality of this declaration depends on storage duration of the variable &lt;B&gt;ptr&lt;/B&gt;. If this variable has static storage duration, then the language standard requires that the initializer be a &lt;I&gt;constant expression&lt;/I&gt;. As the compiler rightly says, this is not a legal &lt;I&gt;constant expression&lt;/I&gt;.&lt;BR /&gt;This expression could be evaluated at compile time, but that would be extending the language beyond the standard. In practice, it would require a more complex format for object files emitted by the compiler and a more intelligent linker capable of complex address arithmetics. That would be too much complexity just for one questionable feature.&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2009 14:40:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/const-address/m-p/151266#M3938</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2009-02-11T14:40:31Z</dc:date>
    </item>
  </channel>
</rss>

