Hi all,
I face a problem using gcc and ld on embedded target.
I just want to declare a constant value (designed to be located in flash memory), and I want to have it compile, linked and allocated in my output file.
For instance:
const volatile unsigned long myvar __attribute__((section(".flashdata"), used)) = 0xAAAAAAA;
using linker script with:
MEMORY
{
[...]
flashdata_memory (wa) : org = 0x20000000, len = 128K
[..]
};
FORCE_COMMON_ALLOCATION
PHDRS
{
[...]
flashdata PT_LOAD;
[...]
};
SECTIONS
{
[...]
.flash_data :
{
. = ALIGN(4);
*(.flashdata .flashdata.*);
} > flashdata_memory :flashdata
[...]
}
the only way to have it allocated is to insert "a" in the section attribute as:
const volatile unsigned long myvar __attribute__((section(".flashdata, [B]\"a\"[/B]"), used)) = 0xAAAAAAA;
I find this dirty as all the variables in my section flashdata should be allocated. :yawn:
Is there a way in the linker script to force the allocation of the section?
(I hope I am not using 'allocation' word for something else..)
I thought FORCE_COMMON_ALLOCATION would help doing so, but it has no effect on my created section.
Thank you for your help,:$
Fred