Hi again, I have built a working system based on a Spider mainboard. I have now ported the code the Cobra II and it seems to be a good fit. But I would like to keep it all in one codebase. 20 years ago I rememer having some conditional compilations (it was the time of makefile bonanza).
I’m using configuration files on SD.
By this I initialize Network and IO’s.
To do so I made a HW-Library which loads it’s GPIO’s and other IO related channels from an XML file.
The file contains the Pin, glitchfilter, … for GPIO’s.
I can also define a channel type, by which I can add special implementations for an SPI Analog in chip, …
Each board gets a different file and I can access the IO channels by name.
This should work at least over most/all premium or OSHW boards, but mixing this would be more complicated.
Alternatively you can use classic #if#else#endif
unfortunately there is no way to add multiple release configurations anymore as in VS6 (at least not that I know. But you can have multiple VS projects using the same code files, if the project files are in the same folder. You can define the defines in the project settings then. I use this if I need a library for NETMF and Windows.
This solution supports two versions of the same application: full NET and a NETMF. I use file linking to share common “library” files between the two applications.