Page 1 of 1

Preprocessor flag for determining the CPU we are compiling for.

Posted: Wed Apr 26, 2023 9:13 am
by ShackShawn
Hi,

I am implementing some unit tests with Unity. While I am perfectly happy to compile my functions defined for the (risc) ULP for testing on the Xtensa CPU; I would like to add some debug utilities that I do not wish in the release on the ULP binary.

I was hoping to find a flag behind which I can hide the debug commands.

Example:

Code: Select all

void my_ulp_function() {
#ifdef IS_ULP
    // use the i2c driver for the ULP
#else
    // use the 'normal' esp i2c driver
    // add some debug-specific code
#endif
} 
This would allow to point to the same function in my unit tests by adding the ulp/ folder in the SOURCE_DIRS of the CMakeLists.txt, as well as using that file and function in production on the ULP.

Thank you for you time

Re: Preprocessor flag for determining the CPU we are compiling for.

Posted: Fri Apr 28, 2023 1:55 pm
by MicroController