Question
I am trying to use a compiler switch for defining preprocessor directives. The controller is STM32F072VC and IAR Workbench is used.
#define EXICOM_2KW 1
#define EXICOM_1KWH 0
#if EXICOM_2KW
#define EXICOM_RX_MAX_SIZE 60
#define EXICOM_TX_MAX_SIZE 18
#define EXICOM_RX_INDEX_MAX 60
#define EXI_ACTIVE 0
#elif EXICOM_1KWH
#define EXICOM_RX_MAX_SIZE 12
#define EXICOM_TX_MAX_SIZE 12
#define EXICOM_RX_INDEX_MAX 12
#endif
extern char EXICOM_Tx_Buffer[EXICOM_TX_MAX_SIZE];
extern uint8_t EXICOM_Rx_Buffer[EXICOM_RX_MAX_SIZE];When EXICOM_2KW is 1, "EXICOM_RX_MAX_SIZE", "EXICOM_TX_MAX_SIZE", "EXICOM_RX_INDEX_MAX" are not taking their respective values(60,10,60).
I am getting a warning like subscript out of range for EXICOM_Rx_Buffer.
I am not sure whether we can use compiler switch for an array declaration.
Kindly help!!
