Bruno Albrecht

Declare constant in ROM

Discussion created by Bruno Albrecht on Nov 25, 2011
Latest reply on Nov 7, 2014 by Willi Hoffmann

Hi,
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.


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."

 

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?

 

Regards,
Bruno

Outcomes