Preprocessor flag for determining the CPU we are compiling for.

ShackShawn
Posts: 5
Joined: Wed Apr 26, 2023 9:00 am

Preprocessor flag for determining the CPU we are compiling for.

Postby ShackShawn » Wed Apr 26, 2023 9:13 am

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

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

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

Postby MicroController » Fri Apr 28, 2023 1:55 pm


Who is online

Users browsing this forum: Baidu [Spider] and 90 guests