Page 1 of 1

Generate the preprocessor output of gcc

Posted: Tue Jul 02, 2024 4:25 pm
by spenderIng
Hello,
how can I see the output of preprocessor using idf.py? To be more precise, I would like to see the output of the command

Code: Select all

gcc -E hello.c
.

Thanks and regards

Re: Generate the preprocessor output of gcc

Posted: Tue Jul 02, 2024 7:19 pm
by MicroController
You can add

Code: Select all

set_target_properties(${COMPONENT_LIB} PROPERTIES COMPILE_FLAGS "-save-temps=obj")  
to your CMakeLists.txt after idf_component_register(...).
After a build, you should then be able to find a "hello.c.ii" file somewhere under <project>/build/esp-idf/ (e.g. under build/esp-idf/main/CMakeFiles/__idf_main.dir for the 'main' component.)

Re: Generate the preprocessor output of gcc

Posted: Thu Jul 04, 2024 9:54 am
by spenderIng
Hello MicroController,
thanks for the help. It works.
Regards