How to define variable on same RAM area?

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

How to define variable on same RAM area?

1,068 Views
leilovelei100
Contributor II

I want to define two array on some RAM area.

 

__attribute__ ((section(".mysection1"))) char test1[128] = "aaaaaaa";

__attribute__ ((section(".mysection2"))) char test2[128] = "bbbbbbb";

 

    .mysection1 ORIGIN(SRAM_UPPER_96): ALIGN(4)

    {

       . += 0;

       . = ALIGN(4) ;   

    } > SRAM_UPPER_96

   

    .mysection2 ORIGIN(SRAM_UPPER_96) :  ALIGN(4)

    {

 

       . += 0;

       . = ALIGN(4) ;   

    } > SRAM_UPPER_96

 

but it comes error:  arm-none-eabi/bin/ld.exe: section .mysection2 loaded at [20018000,2001807f] overlaps section .mysection1 loaded at [20018000,2001817f]

 

what shall I do? thanks!

1 Reply

885 Views
lpcxpresso_supp
NXP Employee
NXP Employee

Take a look at the __DATA / __BSS macros provided by MCUXpresso IDE's cr_section_macros.h header file. For more details see section 12.9.6 "Placement of specific code/data items" in the MCUXpresso IDE v10.0.0 User Guide.

Regards,

MCUXpresso IDE Support