Software Platform Wrapper
Use of the Software Platform to develop your Embedded software is a breeze in Altium Designer, with the Software Platform Wrapper. When you compile your Embedded project, a new header file and C file are automatically generated by the Software Platform Builder, completely encapsulating your platform. These files make it very easy to use the Software Platform, with all required handles being defined for you, all header files you need to access being included, and the optional ability to automatically initialize the complete platform!
Accessing and Using Generated Files
Upon compilation of an Embedded project, the files generated by (and from) the Software Platform – swplatform.c
and swplatform.h
– can be found in the Generated»C Source Documents
and Generated»Header Documents
sub-folders respectively, in the Projects panel.
The swplatform.c
file is generated only when the option to Generate Initialization Code is enabled, as part of the Software Platform Configuration service. This option is enabled by default for all new Software Platform documents.
To use the generated files, you must ensure to add a #include
statement into your top-level code source file (typically main.c
), to 'bring in' the generated swplatform.h
file:
#include "swplatform.h"
All other required header files needed to access the devices in the stack are brought in (made available) as a result of adding (pointing to) this file.
Generating and Using Initialization Code
As part of the Software Platform Configuration service, there are three options relating to the creation and use of initialization code.
- Generate Initialization Code – enable this option to create initialization code, by which to open all device stacks and to provide handles for subsequent use of the API. This option is enabled by default for all new Software Platform documents. If this option is disabled, the two options below will become unavailable, and no
swplatform.c
file will be generated.
- Top Level Only – enable this option to explicitly open top-level stack items only (all other items will be opened implicitly). If disabled, all stack items will be explicitly opened and handles provided. This option is enabled by default for all new Software Platform documents.
- Call Initialization Code – enable this option to automatically call generated initialization code before
main()
.