I have two version of the boards , where a particular portion of the code gets executed based on the value of the #define BIAS_VOLTAGE
if(vol < BIAS_VOLTAGE)
{
//Execute this
}
else if (vola >= BIAS_VOLTAGE)
{
//Execute This
}
Now BIAS_VOLTAGE is #defined in a header file (#define BIAS_VOLTAGE 3) but for a different board it is 5(5V).
The only way to detect this is by polling one GPIO status (which remains High or low after GPIO initialization in main .This is done just once).
If it is high , BIAS_VOLTAGE 3 other wise 5 Since #BIAS_VOLTAGE is used at many places , how can i know the status of GPIO at the startup ( even before main) and fix the #define value.
I know #define gets fixed at the compile time , but I need to fix this constant value at the runtime.(and this will remain forever) Update : tool chain is IAR and microcontroller is STM32F4