I'm trying to debug a kernel module and as such, need to compile it without optimizations. I'm using the Yocto Project and can't get the module to compile with a -O0 flag despite trying several things. So far I've tried adding the following to my local.conf.
EXTRA_IMAGE_FEATURES = "debug-tweaks tools-profile dbg-pkgs"
INHIBIT_PACKAGE_STRIP = "1"
DEBUG_BUILD = "1"
PACKAGE_DEBUG_SPLIT_STYLE = 'debug-file-directory'
I've also added the following to my kernel recipe in addition to the changes above.
DEBUG_FLAGS += "-O0"
None of this has worked. If I run objdump -g on the .ko file in question I still find -O2 is being used. This leads to the debugger jumping all around when I'm trying to step through source.
Is there a way to override the kernel compile optimization level in the Yocto Project?
For kernel module debugging I'm following this guide from DS-MDK and the imx_rpmsg_tty module.
http://www2.keil.com/docs/default-source/default-document-library/gs_ds-mdk_5_27_r1.pdf?sfvrsn=2
I'm working with this SOM.
CL-SOM-iMX7 | NXP (Freescale) i.MX 7 | System-on-Module | Computer-on-Module | CompuLab
I've attached my local.conf, my kernel recipe, and my kernel .config. Let me know if you need any more information.
Thanks for the help,
James