Page 2 of 2
Re: Memory sections in linker script
Posted: Thu Apr 11, 2013 12:33 pm
by Laurent
By the way, my .map file contains this:
Code: Select all
*(.bss.*)
0x20005740 . = ALIGN (0x4)
*(COMMON)
COMMON 0x20005740 0xa CMakeFiles/test.dir/main.c.obj
0x20005740 my_var
So how should I refer to my variable in the linker script?
Re: Memory sections in linker script - vars in CCM
Posted: Mon Feb 03, 2014 6:45 pm
by pito
This works for me - I've tried to place my two float arrays (re[], im[], 32kB each) into CCM:
In the linker script add:
Code: Select all
..
.ccm :
{
KEEP(*(.ccmbuf))
} > ccmram
And in the main.c for example:
Code: Select all
..
#define intoCCM __attribute__((section(".ccmbuf"))) __attribute__((aligned(4)))
#define N 8192
float re[N] intoCCM;
float im[N] intoCCM;
That places the two arrays into CCM memory section - see the map file:
Code: Select all
..
.ccm 0x10000000 0x10000
*(.ccmbuf)
.ccmbuf 0x10000000 0x10000 build/obj/main.o
0x10000000 re
0x10008000 im
.bss 0x20000c38 0x183c8
This way I put 5x32kB of arrays into the STMF4:
Code: Select all
..
#define intoCCM __attribute__((section(".ccmbuf"))) __attribute__((aligned(4)))
#define N 8192
float re[N] intoCCM;
float im[N] intoCCM;
float test[N];
float test1[N];
float test2[N];
..
If the vars do not fit into the CCM you will get an error:
Code: Select all
..
#define N 8192
float re[N] intoCCM;
float im[N] intoCCM;
float re1[100] intoCCM;
Code: Select all
.../arm-none-eabi/bin/ld.exe: region `ccmram' overflowed by 400 bytes
collect2.exe: error: ld returned 1 exit status