Compiler data location management

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Compiler data location management

1,306 Views
brucebowling
Contributor I

I am using the S32DS tool with the KEAZ128 device, and I am creating a large number of display bitmap images. loading these in as static initialized data variables is causing issue, it appears the compiler/linker is not loading these in flash. I am receiving the following error:

 

xxxx.elf section `.data' will not fit in region `SRAM'

 

I want to specify that these data should be within section FLASH_2 section. I am trying to use pragmas to specify the placement but they are not working as far as I can tell. I am using the format:

 

#pragma arm section rodata

 

to place in section .rodata which is part of FLASH_2 definition in the linker file. FLASH_2 has a length of 0x1FBF0 which should be plenty of space.

 

Any documents, etc that I should be reviewing about placement of static defined variables?

Labels (2)
Tags (3)
0 Kudos
1 Reply

1,048 Views
stanish
NXP Employee
NXP Employee

Hi Bruce,

I'd recommend you to declare these bitmaps as constant instead of static variables e.g.:

const unsigned char BitMapImage[] = {0,1,2,3,4};

BitMapImage will be placed into .rodata

if you want to have them in a custom flash section you should adjust your linker file (.ld)

KEA.ld:

...
.text :
 {
 . = ALIGN(4);
 *(.text) /* .text sections (code) */
 *(.text*) /* .text* sections (code) */
 *(.rodata) /* .rodata sections (constants, strings, etc.) */
 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
 *(.glue_7) /* glue arm to thumb code */
 *(.glue_7t) /* glue thumb to arm code */
 *(.eh_frame)
 KEEP(*(.my_bitmap_flash)) /* bitmap flash section*/
 KEEP (*(.init))
 KEEP (*(.fini))
 . = ALIGN(4);
 } > FLASH_2
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

source file:

__attribute__((section(".my_bitmap_flash")))
const unsigned char BitMapImage[] = {0,1,2,3,4};

Hope it helps.

Stan

0 Kudos