Question:
How to create large data buffers in sdram without initialization
Answer:
We can create own memory section for SDRAM by adding the appropriate INPUT_SECTIONS commands with NO_INIT qualifier to your LDF in a suitable place in app.ldf, like below.
custom_section_name NO_INIT //Output section
{
INPUT_SECTIONS( $OBJS_LIBS(custom_section_name) ) // Input section
} > MEM_SDRAM0_BANK0// Memory section
Below is an example snippet to create own memory section for SDRAM to avoid running out of memory issue.
The INPUT_SECTIONS commands for custom sections(own memory section) which to be included in the app.ldf file
dxe_sdram_data0 NO_INIT
{
INPUT_SECTION_ALIGN(4)
INPUT_SECTIONS($OBJS_LIBS(sdram_data0))
} > MEM_SDRAM0_BANK0
dxe_sdram_data1 NO_INIT
{
INPUT_SECTION_ALIGN(4)
INPUT_SECTIONS($OBJS_LIBS(sdram_data1))
} > MEM_SDRAM0_BANK1
dxe_sdram_data2 NO_INIT
{
INPUT_SECTION_ALIGN(4)
INPUT_SECTIONS($OBJS_LIBS(sdram_data2))
} > MEM_SDRAM0_BANK2
dxe_sdram_data3 NO_INIT
{
INPUT_SECTION_ALIGN(4)
INPUT_SECTIONS($OBJS_LIBS(sdram_data3))
} > MEM_SDRAM0_BANK3
Also, please ensure that #pragma section("custom_section_name",NO_INIT)directive is added before appropriate buffer as follows:
#pragma section("sdram_data0",NO_INIT)
unsigned char buffer1[1024 * 1024 * 4];
#pragma section("sdram_data0",NO_INIT)
unsigned char buffer2[1024 * 1024 * 4];