Topic : 2D array at specific location in flash

Forum : ARM

Original Post
Post Information Post
September 12, 2011 - 4:28pm
Guest

Hi All,

I'm trying to create a 2D array of 153,6 KB on the STM32F103 flash memory.

uint16_t ImageBuffer[240][320];

When I try to build the project, I receive this message in the Build Log:

Building C:\tmp\Colour LCD\407Test.rapp 
 Running: LD Linker 
 "C:\Program Files\Raisonance\Ride\arm-gcc\bin\arm-none-eabi-gcc.exe" -mcpu=cortex-m3 -mthumb -Wl,-T -Xlinker "C:\tmp\Colour LCD\407Test.elf.ld" -u _start -Wl,-static -Wl,--gc-sections -nostartfiles -Wl,-Map -Xlinker "C:\tmp\Colour LCD\407Test.map"   
 c:/program files/raisonance/ride/arm-gcc/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/bin/ld.exe: C:\tmp\Colour LCD\407Test.elf section `.bss' will not fit in region `RAM'  
 c:/program files/raisonance/ride/arm-gcc/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/bin/ld.exe: region `RAM' overflowed by 89032 bytes  
 collect2: ld returned 1 exit status  
  
Build failed 

What can be the problem?
Thanks for your help.

Replies
Post Information Post
+1
0
-1
September 13, 2011 - 7:58am
Guest

Now, I understand why I get this message. The compiler copies the variables onto the stack. But, how can I overcome this as I also have to write to this portion of memory. Or should I use the flash programming manual and see the writing to flash examples to see how to write to flash?
Thanks for your help.

+1
0
-1
September 13, 2011 - 11:25am
Raisonance Support Team

Hi,

On GCC you just need 2 things to make your array located in flash:
- Qualify it as "const"
- Initilialize it in the declaration.

For example:

const uint16_t ImageBuffer[240][320] = {0}; 

Best Regards,

+1
0
-1
September 13, 2011 - 1:01pm
Guest

Hi Bruno,

Thanks a lot for your reply.
I'm sorry, I forgot to mention something important that I have to do with that array. I want to be able to change the content of that array.

In fact, I want to use it as a frame buffer for my controller less TFT LCD. So far, I have been able to fill the display with one color, and display bitmap images coded in RGB565 format which were stored in MCU flash.

The only thing I'm left with creating some text and GUI objects. I'm not using any external RAM so I will have to rely on the MCU flash considering the display resolution and the size of one pixel (320 * 240 * 2 bytes).

That's why I want to have a 2D array to ease my task with indexing and in order to be able to control my x and y positions.

Thanks.

+1
0
-1
September 16, 2011 - 12:06pm
Guest

Hi all,

I found a way to do it. I'm not using 2D array. I'm writing directly to flash. I figured that out by making some memory address calculations. So far I have been able to draw rectangles, lines, and display texts.

Thanks