Hi,
I am having trouble turning off the compiler optimizations in CCS4. In Build Properties -> Compiler -> Basic Options, I have explicitly set the optimization level to 0, however, it seems no effect at all.
I have this piece of codes:
unsigned long address = 0;
address = APP_START_ADDRESS + sizeof(unsigned long);
(*((void (*)(void))(*(unsigned long *)address)))();
The compiler seems to have optimized the address variable for me and the value of address becomes 0xFFFFFFFF when it runs to the last line of code. I have to explicitly declare address as volatile in order to have the correct value.
Best regards,
Wilson Fok, PMP