How to change compile level in GCC_RELEASE(hp)?
Orionxer opened this issue · comments
Description
I don't know how to change compile level in GCC_RELEASE(hp).
There're few ways I have been tried but all failed, test with a global vriable:
-
Defined a global variable with
__attribute__ ((optimize("O0")))
, e.g.,volatile char *s __attribute__ ((optimize("O0"))) = "Hello World string from KM4";
, after flashing and entering gdb shell, tried to print the variable but no symbol
Once the variable is used, such as printf,DiagPrintf("The km4_string is : %s\n", s);
it can keep away from being optimized,
-
Surrounded the global vriable by pragma
#pragma GCC push_options #pragma GCC optimize ("O0") char *s = "Hello World string from KM4"; #pragma GCC pop_options
I also noted the compile option has been changed from "O2" to "Os" in Git 210714_317d518b to Git 210809_a30eac93 but I have no idea what to do.
Thanks in advance.