ambiot / ambd_sdk

Release SDK for AmebaD

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

  • Changed all the Os to O0 in every related Makefile.
    image

  • 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
    image
    Once the variable is used, such as printf, DiagPrintf("The km4_string is : %s\n", s);it can keep away from being optimized,
    image

  • 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.