cancel
Showing results for 
Search instead for 
Did you mean: 

Is there macro can be used as compilation switch to differentiate between build for simulator vs for HW target?

BParh.1
Senior III

Sample usage:

I want to have different settings when working in hardware vs working on simulator

1 ACCEPTED SOLUTION

Accepted Solutions
Romain DIELEMAN
ST Employee

Hi,

If you wish to add code only for when running with the simulator you can wrap the particular code (UI components and logic) in something like this:

#ifdef SIMULATOR
 
//...
 
#endif

Don't know if there is the equivalent for just running on hardware.

/Romain

View solution in original post

3 REPLIES 3
Romain DIELEMAN
ST Employee

Hi,

If you wish to add code only for when running with the simulator you can wrap the particular code (UI components and logic) in something like this:

#ifdef SIMULATOR
 
//...
 
#endif

Don't know if there is the equivalent for just running on hardware.

/Romain

BParh.1
Senior III

Thank you @Romain DIELEMAN

Anyway for my knowledge, while the macro seems to work, but I could not see in the simulator .sln project code it is defined. So where is this macro 'SIMULATOR' defined?

I don't know to be honest, I'll try to check

/Romain