This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: .text variable and optimization issue


On 04/07/12 22:30, Marcin S wrote:
> 2012/7/4 Václav Zeman:
>> The compiler probably sees through your games. The language defines that
>> constants are really, constant, AFAIK. Try changing the 'const uint16_t
>> CFlashSignature::SIGNATURE' to 'const volatile uint16_t
>> CFlashSignature::SIGNATURE' or just drop the const entirely (and add
>> volatile).
> Hi,
> Yes, i did tried this before, unfortunately with this modifier
> (volatile or omitting const at all) makes variable not to land in
> .text (flash) but in RAM, so, this won't do me any good if flag will
> reset after power down - i need it to be persistent, thats the whole
> point.
Have you tried adding an explicit section attribute?

__attribute__ ((section (".text")));

http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#index-g_t_0040code_007bsection_007d-function-attribute-2598



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]