I am trying to convert our code from one IDE to be used in a different one. The current one uses gcc which allows for this structure to be initialized from a variable array. The new tool does not use gcc gives me an error "Initializer cannot be specified for a flexible array member". So can someone help me understand how to set this up? Should I set up a blank array of variable size and then somewhere assign the #define array as seen below?
Here would be an example of the code…(this is current implementation current IDE)
In one header file that is Build switchable so we can build this on different hardware platforms we have the following #define
#define GPIOS \
/* BANK, PIN, SPD, MODE,… */
GPIOINIT( A, 0, 2, AIN, …) \
GPIOINIT( A, 1, 2, AIN, …) \
GPIOINTINIT(A, 2, 2, AIN, …) \
.
.
.
Then in a different header file that is used in all builds we have
PLATFORM_CONFIG_T g_platformConfig = {
.name = {PLATFORM_NAME},
(bunch of other stuff),
.allGpios = {
GPIOS /* here I get the error */
},
};
So I am thinking I can make the error line a variable array and assign to it later in some other way? The problem is the actual array "GPIO" is of different types and pin orders on different designs are different.