Generate the preprocessor output of gcc

spenderIng
Posts: 7
Joined: Fri Mar 08, 2024 1:57 pm

Generate the preprocessor output of gcc

Postby spenderIng » Tue Jul 02, 2024 4:25 pm

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

MicroController
Posts: 1702
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Generate the preprocessor output of gcc

Postby MicroController » Tue Jul 02, 2024 7:19 pm

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

spenderIng
Posts: 7
Joined: Fri Mar 08, 2024 1:57 pm

Re: Generate the preprocessor output of gcc

Postby spenderIng » Thu Jul 04, 2024 9:54 am

Hello MicroController,
thanks for the help. It works.
Regards

Who is online

Users browsing this forum: Google [Bot] and 103 guests