My target is a K10DX128 with 32K of RAM splits evenly into two 16K sections (SRAM_L and SRAM_H). My latest code build utilizes more than 16K of global variables. The linking process failed due to SRAM_L overflow and the linker dont seem to know to put excessive variables into SRAM_H. So I attempted to modify .ld (linker control file) by specifying a certain file and its variables to be included in SRAM_U space. I added the following block into the linker control file:
.extra_data :
{
file1.o (.bss)
. = ALIGN(4);
} > m_data_20000000 /* this section refers to SRAM_U starting at 0x2000000 */
I re-built my project again. This time the linker generated "can't find file1.o" error. And yet file1.c was complied and the corresponding obj file (file1.o) was created under project/Flash folder. Any ideal what went wrong?
Hi Ming,
Use this in front declaration of any variable or routine you want to place in the memory section .extra_data
__attribute__((section(".extra_data"))) char str[10] = " hello world";
You can see you .map file to check if the contents indeed have been placed in SRAM location 0x2000000.
No changes required to linker file.