Manage Code for Multiple Boards
This is an embedXcode+ feature.
Managing code for multiples platforms is the raison d'être of embedXcode and a real issue, as it needs to take into account two dimensions:
Gone are the days of the single framework Wiring shared by all platforms! This can be done in two ways. Both are valid from an embedXcode point of view. |
First Approach: MCU-Based
The first approach is MCU-based and relies solely on the micro-controller (MCU) type.
This approach is compatible with all the respective IDEs, as no new environment variable is created or required. It requires updating the list of MCU everywhere and every-time a new one is released. |
|
Second Approach: IDE-Based
The second approach is IDE-based. Most of the IDEs defines a specific environment variable combine boards type and framework version.
For example, Arduino IDE defines ARDUINO=101 and passes it on to the tool-chain with -D, as -DARDUINO=101. As at today, this approach is compatible with all platforms. However, some platforms like Energia define two variables: ENERGIA and ARDUINO. This implies testing ENERGIA first and ARDUINO at the end. |
|
The second approach allows more compact and easier to read code, and doesn't require maintenance at code level when a new MCU appears.
|
|
Conclusion
Both approaches are valid from an embedXcode point of view.
|