<?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>LPC MicrocontrollersのトピックRe: Store constant array into internal flash</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Store-constant-array-into-internal-flash/m-p/778647#M31317</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ranjith,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you declare any constant variable it goes directly to the flash memory. So all you need is to declare the array.&lt;/P&gt;&lt;P&gt;const uint32_t test[2]={1,2};&lt;/P&gt;&lt;P&gt;The array test will go directly to the flash memory of the LPC824. You can check the result in the .map file. Also It is important to check that the compiler is not performing any optimization with the array for not being used.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;Have a great day,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;Victor.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit;"&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;BR style="color: #51626f; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit;"&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;/SPAN&gt;&lt;BR style="color: #51626f; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit;"&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 01 Feb 2018 20:19:12 GMT</pubDate>
    <dc:creator>victorjimenez</dc:creator>
    <dc:date>2018-02-01T20:19:12Z</dc:date>
    <item>
      <title>Store constant array into internal flash</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Store-constant-array-into-internal-flash/m-p/778646#M31316</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you tel how to store constant array into internal flash memory lpc824?&lt;/P&gt;&lt;P&gt;I referred below link. Still not able to save.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt;"&gt;&lt;A href="http://host.lpcware.com/content/forum/compile-and-store-constant-array-external-flash-memory-lpc1788-dev-board"&gt;http://host.lpcware.com/content/forum/compile-and-store-constant-array-external-flash-memory-lpc1788-dev-board&lt;/A&gt; &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt;"&gt;Thanks.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Feb 2018 11:28:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Store-constant-array-into-internal-flash/m-p/778646#M31316</guid>
      <dc:creator>ranjithshanbhag</dc:creator>
      <dc:date>2018-02-01T11:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: Store constant array into internal flash</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Store-constant-array-into-internal-flash/m-p/778647#M31317</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ranjith,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you declare any constant variable it goes directly to the flash memory. So all you need is to declare the array.&lt;/P&gt;&lt;P&gt;const uint32_t test[2]={1,2};&lt;/P&gt;&lt;P&gt;The array test will go directly to the flash memory of the LPC824. You can check the result in the .map file. Also It is important to check that the compiler is not performing any optimization with the array for not being used.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;Have a great day,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;Victor.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit;"&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;BR style="color: #51626f; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit;"&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;/SPAN&gt;&lt;BR style="color: #51626f; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit;"&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Feb 2018 20:19:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Store-constant-array-into-internal-flash/m-p/778647#M31317</guid>
      <dc:creator>victorjimenez</dc:creator>
      <dc:date>2018-02-01T20:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: Store constant array into internal flash</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Store-constant-array-into-internal-flash/m-p/778648#M31318</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;SPAN style="border: 0px currentColor; font-weight: inherit;"&gt;Victor,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="border: 0px currentColor; font-weight: inherit;"&gt;Thanks for your valuable reply.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="border: 0px currentColor; font-weight: inherit;"&gt;I verified .map file for particular data (&lt;STRONG&gt;App1_0[ ]&lt;SPAN style="border: 0px currentColor;"&gt;&lt;SPAN style="font-size: small;"&gt;)&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="border: 0px currentColor;"&gt;which I want to save in flash. I build the project without any optimization.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="border: 0px currentColor; font-weight: inherit;"&gt;I attached .map and .c file attached for your reference.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="border: 0px currentColor; font-weight: inherit;"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="border: 0px currentColor; font-weight: inherit;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="border: 0px currentColor; font-weight: inherit;"&gt;Ranjith&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Feb 2018 08:53:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Store-constant-array-into-internal-flash/m-p/778648#M31318</guid>
      <dc:creator>ranjithshanbhag</dc:creator>
      <dc:date>2018-02-02T08:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: Store constant array into internal flash</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Store-constant-array-into-internal-flash/m-p/778649#M31319</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ranjith,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you giving any use for the array&amp;nbsp;&lt;STRONG&gt;App1_0&lt;/STRONG&gt;? In the .map file that you attach you can see that the compiler is performing a optimization&amp;nbsp;with the array (does this automatically). In the line 118 of the file .map you can see that it says "Discarded input sections" (See image below) and below that in line 131&amp;nbsp;is the array you want App1_0, you will see that the address is&amp;nbsp;0x00000000 that means that the variable is not located in the flash because it was optimized, this always happens because you declare the variable but you are not using it.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Capture.JPG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/34894iCF5AE8F7CB1FAC94/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;For example, I declare the same array than you in a random program and below the declaration I used the array in an IF condition:&lt;/P&gt;&lt;P&gt;if(App1_0[45])&lt;/P&gt;&lt;P&gt;Once I made this I got the next result in the .map file&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Capture2.JPG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/34928iB8DDDE20761C937F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture2.JPG" alt="Capture2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Once you use the variable it declares it in a&amp;nbsp; valid memory address, in this case&amp;nbsp;&amp;nbsp;0x00001de0 instead of the&amp;nbsp;&lt;SPAN&gt;0x00000000 of before.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hope this solve your problem.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;Have a great day,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;Victor.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit;"&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;BR style="color: #51626f; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit;"&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;/SPAN&gt;&lt;BR style="color: #51626f; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit;"&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Feb 2018 16:38:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Store-constant-array-into-internal-flash/m-p/778649#M31319</guid>
      <dc:creator>victorjimenez</dc:creator>
      <dc:date>2018-02-02T16:38:39Z</dc:date>
    </item>
  </channel>
</rss>

