How to create two initialized data sections

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

How to create two initialized data sections

623 Views
a8Chcx
Contributor V

Hi,

I am using MCUXpresso V11.5.0 for my FRDM-K66. I have a question:

Here is the part of link file:

.data : AT(__DATA_ROM)
{
. = ALIGN(4);
__DATA_RAM = .;
__data_start__ = .; /* create a global symbol at data start */
*(.data) /* .data sections */
*(.data*) /* .data* sections */
KEEP(*(.jcr*))
. = ALIGN(4);
__data_end__ = .; /* define a global symbol at data end */
} > m_data1

/* Symbol is used by startup for data initialization */
__DATA_END = __DATA_ROM + (__data_end__ - __data_start__) ;

/* Uninitialized data section */
.bss :
{
/* This is used by the startup in order to initialize the .bss section */
. = ALIGN(4);
__START_BSS = .;
__bss_start__ = .;
*(.bss)
*(.bss*)
*(COMMON)
. = ALIGN(4);
__bss_end__ = .;
__END_BSS = .;
/* } > m_data1*/
} > m_data2

 

It will put the initialized data into m_data1 SRAM(64K) and works fine...

I want to put some initialized data into m_data2 SRAM(192K)...

I tried several ways and got failed...

Can anybody help me to define two initialized data sections for my project?

Thanks,

Christie

0 Kudos
Reply
1 Reply

591 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

To place some initialized data into m_data2, you need to:
-Create a new section in your linker script for the initialized data that should go into m_data2.
-Use a section attribute in your source code to place specific variables into that section.

Best regards,
Omar

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2135002%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EHow%20to%20create%20two%20initialized%20data%20sections%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2135002%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI%20am%20using%20MCUXpresso%20V11.5.0%20for%20my%20FRDM-K66.%20I%20have%20a%20question%3A%3C%2FP%3E%3CP%3EHere%20is%20the%20part%20of%20link%20file%3A%3C%2FP%3E%3CP%3E.data%20%3A%20AT(__DATA_ROM)%3CBR%20%2F%3E%7B%3CBR%20%2F%3E.%20%3D%20ALIGN(4)%3B%3CBR%20%2F%3E__DATA_RAM%20%3D%20.%3B%3CBR%20%2F%3E__data_start__%20%3D%20.%3B%20%2F*%20create%20a%20global%20symbol%20at%20data%20start%20*%2F%3CBR%20%2F%3E*(.data)%20%2F*%20.data%20sections%20*%2F%3CBR%20%2F%3E*(.data*)%20%2F*%20.data*%20sections%20*%2F%3CBR%20%2F%3EKEEP(*(.jcr*))%3CBR%20%2F%3E.%20%3D%20ALIGN(4)%3B%3CBR%20%2F%3E__data_end__%20%3D%20.%3B%20%2F*%20define%20a%20global%20symbol%20at%20data%20end%20*%2F%3CBR%20%2F%3E%7D%20%26gt%3B%20m_data1%3C%2FP%3E%3CP%3E%2F*%20Symbol%20is%20used%20by%20startup%20for%20data%20initialization%20*%2F%3CBR%20%2F%3E__DATA_END%20%3D%20__DATA_ROM%20%2B%20(__data_end__%20-%20__data_start__)%20%3B%3C%2FP%3E%3CP%3E%2F*%20Uninitialized%20data%20section%20*%2F%3CBR%20%2F%3E.bss%20%3A%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%2F*%20This%20is%20used%20by%20the%20startup%20in%20order%20to%20initialize%20the%20.bss%20section%20*%2F%3CBR%20%2F%3E.%20%3D%20ALIGN(4)%3B%3CBR%20%2F%3E__START_BSS%20%3D%20.%3B%3CBR%20%2F%3E__bss_start__%20%3D%20.%3B%3CBR%20%2F%3E*(.bss)%3CBR%20%2F%3E*(.bss*)%3CBR%20%2F%3E*(COMMON)%3CBR%20%2F%3E.%20%3D%20ALIGN(4)%3B%3CBR%20%2F%3E__bss_end__%20%3D%20.%3B%3CBR%20%2F%3E__END_BSS%20%3D%20.%3B%3CBR%20%2F%3E%2F*%20%7D%20%26gt%3B%20m_data1*%2F%3CBR%20%2F%3E%7D%20%26gt%3B%20m_data2%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EIt%20will%20put%20the%20initialized%20data%20into%20m_data1%20SRAM(64K)%20and%20works%20fine...%3C%2FP%3E%3CP%3EI%20want%20to%20put%20some%20initialized%20data%20into%26nbsp%3Bm_data2%20SRAM(192K)...%3C%2FP%3E%3CP%3EI%20tried%20several%20ways%20and%20got%20failed...%3C%2FP%3E%3CP%3ECan%20anybody%20help%20me%20to%20define%20two%20initialized%20data%20sections%20for%20my%20project%3F%3C%2FP%3E%3CP%3EThanks%2C%3C%2FP%3E%3CP%3EChristie%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2136762%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20How%20to%20create%20two%20initialized%20data%20sections%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2136762%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3ETo%20place%26nbsp%3Bsome%20initialized%20data%20into%26nbsp%3Bm_data2%2C%26nbsp%3Byou%20need%20to%3A%3CBR%20%2F%3E-Create%20a%20new%20section%26nbsp%3Bin%20your%20linker%20script%20for%20the%20initialized%20data%20that%20should%20go%20into%26nbsp%3Bm_data2.%3CBR%20%2F%3E-Use%20a%20section%20attribute%26nbsp%3Bin%20your%20source%20code%20to%20place%20specific%20variables%20into%20that%20section.%3C%2FP%3E%0A%3CP%3EBest%20regards%2C%3CBR%20%2F%3EOmar%3C%2FP%3E%3C%2FLINGO-BODY%3E