In zephyr-rtos, how to set compilation -O0 flags at build time?
I'am new to both embedded/rtos dev and zephyr. Following the official zephyr doc, I managed to install zephyr/west and build/flash/run the blinky example that works from-debian-on-the-board.
Following the doc, west debug runs fine but it seems the build is done in RelWithDebInfo by default so the gdb doesn't have all infos at debug time.
How to pass -O0 at build time to get full scope debugging latter on with west debug?
To set
-O0, you can provide the KConfigCONFIG_NO_OPTIMIZATIONSoption to west. Command for blinky sample application:For debugging,
-Ogmight be a better choice:You can set the KConfig option also in prf.conf of your app. For the blinky sample set
DCONFIG_DEBUG_OPTIMIZATIONS=yin zephyr/samples/basic/blinky/prj.conf.See also KConfig search documentation.