I have a microcontroller project using the GCC toolchain.
gcc version 4.7.4 20130913 (release) [ARM/embedded-4_7-branch revision 202601]
The controller has a 512k flash memory. The first 64k are occupied by the bootloader and 448k remain for the project. I defined a script builder with dimensions for FLASH and RAM. I also added sections. Here is an excerpt:
MEMORY
{
FLASH (rx) : ORIGIN = 0x00010000, LENGTH = 448K
RAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
}
SECTIONS
{
.text :
{
. = ALIGN(4);
*(.text)
} > FLASH
.fini_array :
{
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(.fini_array*))
PROVIDE_HIDDEN (__fini_array_end = .);
_eflash = .;
} >FLASH
_sidata = .;
.data : AT ( _sidata )
{
*(.data)
*(.data*)
_edata = .;
} >RAM
}
The component works great, placing all sections in their places. The problem is that the linker does not check if there is enough space for partitions .dataand .data*in FLASH in place _sidata. The result exceeds the memory size without warning.
How can I adapt the linker script so that ld uses initialization data (.data) in the size calculation?
Edit: is there a command line option to provide reasonable data placement?