<?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>Classic/Legacy CodeWarriorのトピックDeclare constant in ROM</title>
    <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Declare-constant-in-ROM/m-p/186281#M4510</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;BR /&gt;I'm working in a project with a MC56F8006 and an OLED Display, so I have to allocate about 1 KB of "screens" for my display. I'm trying to allocate this 1 KB in internal flash memory, because they won't be changed ever (they are constants). I'm currently declaring it as "static const UWord8 screenN[] = { lots of bytes};", but it seems to be occupying the RAM segment, since I ran out of RAM, even though I have only about 500 bytes of variables.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I found some people saying to declare the screens as "__pmem static UWord8 screenN[] = { lots of bytes };" and use level 4 optimizations. It made my code compile, but got several warnings regarding the linker command file, for example: "F_Pbss_start_addr defined in the Linker Command File is not word-aligned, address in bytes is 7609."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know what else to do. I searched everything and still haven't got a straight answer. How do I declare a array of bytes in flash memory so it doesn't occupy my RAM memory?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Bruno&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 26 Nov 2011 02:33:19 GMT</pubDate>
    <dc:creator>brunolalb</dc:creator>
    <dc:date>2011-11-26T02:33:19Z</dc:date>
    <item>
      <title>Declare constant in ROM</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Declare-constant-in-ROM/m-p/186281#M4510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;BR /&gt;I'm working in a project with a MC56F8006 and an OLED Display, so I have to allocate about 1 KB of "screens" for my display. I'm trying to allocate this 1 KB in internal flash memory, because they won't be changed ever (they are constants). I'm currently declaring it as "static const UWord8 screenN[] = { lots of bytes};", but it seems to be occupying the RAM segment, since I ran out of RAM, even though I have only about 500 bytes of variables.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I found some people saying to declare the screens as "__pmem static UWord8 screenN[] = { lots of bytes };" and use level 4 optimizations. It made my code compile, but got several warnings regarding the linker command file, for example: "F_Pbss_start_addr defined in the Linker Command File is not word-aligned, address in bytes is 7609."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know what else to do. I searched everything and still haven't got a straight answer. How do I declare a array of bytes in flash memory so it doesn't occupy my RAM memory?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Bruno&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 26 Nov 2011 02:33:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Declare-constant-in-ROM/m-p/186281#M4510</guid>
      <dc:creator>brunolalb</dc:creator>
      <dc:date>2011-11-26T02:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: Declare constant in ROM</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Declare-constant-in-ROM/m-p/186282#M4511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In a project I just declared this:&lt;BR /&gt;&lt;BR /&gt;__pmem const UInt8 CRC8_table[256] = {//lot of bytes};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and work correctly. (the const is not mandatory I think).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try to compile with "Level 2 optimization" or less. I've found out that sometimes compiling with Level 3 or above gives some strange result when using variables in program memory.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By the way you should check the "Targeting 56800E" pdf, it gives some insight on how to use the __pmem command and what are the limitation on putting data in program memory.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can also try the "Pool Strings" and "Reuse Strings" checkbox in Language Settings (In theTarget Settings Panel), they can maybe shrink the memory footprint of the strings...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bye Giacomo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Dec 2011 21:05:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Declare-constant-in-ROM/m-p/186282#M4511</guid>
      <dc:creator>giacomopetrini</dc:creator>
      <dc:date>2011-12-15T21:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: Declare constant in ROM</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Declare-constant-in-ROM/m-p/186283#M4512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's quite an old post, so I think the problem should have been solved now, but for anyone else having this error and not knowing where the problem is: if you are using byte-arrays, make sure to have an even amount of bytes, so you don't break word alignment. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Nov 2014 13:12:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Declare-constant-in-ROM/m-p/186283#M4512</guid>
      <dc:creator>willihoffmann</dc:creator>
      <dc:date>2014-11-07T13:12:00Z</dc:date>
    </item>
  </channel>
</rss>

