<?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 LPC4370 Flash usage issue: maxed out at 20% in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4370-Flash-usage-issue-maxed-out-at-20/m-p/1092060#M41843</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi to you all,&lt;BR /&gt;I'm developing on a LPC4370 using LPC-Link2 as evaluation board.&lt;BR /&gt;I have a problem with the flash memory, as &lt;A _jive_internal="true" href="https://community.nxp.com/thread/389142"&gt;for my understanding&lt;/A&gt; it should be 1MB, but I can only use 19.80% of it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's my memory configuration:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Selection_087.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/104117i9C598C3CB4423F0D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Selection_087.png" alt="Selection_087.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;To specifically use the SPIFI section I allocate data this way:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;__DATA(SPIFI) int32_t buffer1[BUFF_SIZE] = {0};&lt;BR /&gt;__DATA(SPIFI) int32_t buffer2[2*BUFF_SIZE] = {0};&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The problem is that when the dimension exceeds roughly the 20% of the memory capacity, the linker start to put stuff in the much smaller RAM (RamLoc128), which easily overflows giving me the following error:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;/usr/local/mcuxpressoide-11.1.1_3241/ide/plugins/com.nxp.mcuxpresso.tools.linux_11.1.0.202001081728/tools/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: s2d_single_core.axf section `.data' will not fit in region `RamLoc128'&lt;BR /&gt;&lt;BR /&gt;/usr/local/mcuxpressoide-11.1.1_3241/ide/plugins/com.nxp.mcuxpresso.tools.linux_11.1.0.202001081728/tools/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: region `RamLoc128' overflowed by 19212 bytes&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Selection_088.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/104881i5286E1ACCFD031CC/image-size/large?v=v2&amp;amp;px=999" role="button" title="Selection_088.png" alt="Selection_088.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Any guess why I am unable to fully use the memory?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Andrea&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 27 Jul 2020 09:51:20 GMT</pubDate>
    <dc:creator>a_bet</dc:creator>
    <dc:date>2020-07-27T09:51:20Z</dc:date>
    <item>
      <title>LPC4370 Flash usage issue: maxed out at 20%</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4370-Flash-usage-issue-maxed-out-at-20/m-p/1092060#M41843</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi to you all,&lt;BR /&gt;I'm developing on a LPC4370 using LPC-Link2 as evaluation board.&lt;BR /&gt;I have a problem with the flash memory, as &lt;A _jive_internal="true" href="https://community.nxp.com/thread/389142"&gt;for my understanding&lt;/A&gt; it should be 1MB, but I can only use 19.80% of it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's my memory configuration:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Selection_087.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/104117i9C598C3CB4423F0D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Selection_087.png" alt="Selection_087.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;To specifically use the SPIFI section I allocate data this way:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;__DATA(SPIFI) int32_t buffer1[BUFF_SIZE] = {0};&lt;BR /&gt;__DATA(SPIFI) int32_t buffer2[2*BUFF_SIZE] = {0};&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The problem is that when the dimension exceeds roughly the 20% of the memory capacity, the linker start to put stuff in the much smaller RAM (RamLoc128), which easily overflows giving me the following error:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;/usr/local/mcuxpressoide-11.1.1_3241/ide/plugins/com.nxp.mcuxpresso.tools.linux_11.1.0.202001081728/tools/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: s2d_single_core.axf section `.data' will not fit in region `RamLoc128'&lt;BR /&gt;&lt;BR /&gt;/usr/local/mcuxpressoide-11.1.1_3241/ide/plugins/com.nxp.mcuxpresso.tools.linux_11.1.0.202001081728/tools/bin/../lib/gcc/arm-none-eabi/8.3.1/../../../../arm-none-eabi/bin/ld: region `RamLoc128' overflowed by 19212 bytes&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Selection_088.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/104881i5286E1ACCFD031CC/image-size/large?v=v2&amp;amp;px=999" role="button" title="Selection_088.png" alt="Selection_088.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Any guess why I am unable to fully use the memory?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Andrea&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Jul 2020 09:51:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4370-Flash-usage-issue-maxed-out-at-20/m-p/1092060#M41843</guid>
      <dc:creator>a_bet</dc:creator>
      <dc:date>2020-07-27T09:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: LPC4370 Flash usage issue: maxed out at 20%</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4370-Flash-usage-issue-maxed-out-at-20/m-p/1092061#M41844</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have told the compiler to place the buffer into flash, but you have not told it that it is read-only and so it will still try to place it into RAM. You also cannot initialise it. You need to define your buffers as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #f6f6f6;"&gt;_DATA(SPIFI) const int32_t buffer1[BUFF_SIZE] ;&lt;/SPAN&gt;&lt;BR style="color: #51626f;" /&gt;&lt;SPAN style="color: #51626f; background-color: #f6f6f6;"&gt;__DATA(SPIFI) const int32_t buffer2[2*BUFF_SIZE] ;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Jul 2020 10:06:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4370-Flash-usage-issue-maxed-out-at-20/m-p/1092061#M41844</guid>
      <dc:creator>converse</dc:creator>
      <dc:date>2020-07-27T10:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: LPC4370 Flash usage issue: maxed out at 20%</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4370-Flash-usage-issue-maxed-out-at-20/m-p/1092062#M41845</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/converse"&gt;converse&lt;/A&gt;‌ ,&lt;BR /&gt;thanks a lot for the reply.&lt;BR /&gt;So I tried your definition, but GCC now complains every time I try to write to it.&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;../src/S2D_main.c:250:25: error: assignment of read-only location 'buffS_unpacked[j]'&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I mean, what it the correct way to use this memory for variables and data holders?&amp;nbsp;&lt;BR /&gt;I found&amp;nbsp;&lt;A href="https://www.geeksforgeeks.org/how-to-modify-a-const-variable-in-c/#:~:text=Changing%20Value%20of%20a%20const%20variable%20through%20pointer&amp;amp;text=The%20compiler%20will%20give%20warning,through%20a%20non-constant%20pointer."&gt;this&lt;/A&gt;&amp;nbsp;on how to write to const vars, but it is far from elegant I guess.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Jul 2020 10:20:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4370-Flash-usage-issue-maxed-out-at-20/m-p/1092062#M41845</guid>
      <dc:creator>a_bet</dc:creator>
      <dc:date>2020-07-27T10:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: LPC4370 Flash usage issue: maxed out at 20%</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4370-Flash-usage-issue-maxed-out-at-20/m-p/1092063#M41846</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's flash - you cannot 'just write' to flash, it needs to be programmed in blocks. Flash is treated at read-only memory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Flash is normally used for persistent storage - things such as code, images, fixed data. Flash is normally changed very infrequently - for example when&amp;nbsp;you make a new release of your code, or want to change an image. When you do want to change it, it first needs to be erased, and then the new data is written in blocks (typically several kilobytes at a time).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, no, you cannot use it for variables and 'data holders' unless they are constant.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Jul 2020 10:32:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4370-Flash-usage-issue-maxed-out-at-20/m-p/1092063#M41846</guid>
      <dc:creator>converse</dc:creator>
      <dc:date>2020-07-27T10:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: LPC4370 Flash usage issue: maxed out at 20%</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4370-Flash-usage-issue-maxed-out-at-20/m-p/1092064#M41847</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First timer in using flash memory? Here I am!&lt;BR /&gt;Thanks a lot, I am running out of memory so I'm exploring.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Jul 2020 10:38:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4370-Flash-usage-issue-maxed-out-at-20/m-p/1092064#M41847</guid>
      <dc:creator>a_bet</dc:creator>
      <dc:date>2020-07-27T10:38:56Z</dc:date>
    </item>
  </channel>
</rss>

