8.2.7. How to Build a Library and Link it in a foxBMS 2 Project
Sometimes source code can not be shared between parties. For these cases the foxBMS 2 project provides a mechanism to ship a minimal development project to the other party. This allows the partner to build a static library. This library and the accompanying headers can then be shared with the partner and be included in the application.
The following example describes the workflow. In this scenario Partner A develops on foxBMS 2 while Partner B should only provide a library to Partner A.
8.2.7.1. Bootstrapping a minimal development Project
Partner A bootstraps a minimal development project. This minimal project is named
library-project.tar.gz
..\fox.ps1 waf bootstrap-library-project
./fox.ps1 waf bootstrap-library-project
./fox.ps1 waf bootstrap-library-project
Partner A shares the archive
library-project.tar.gz
with Partner B.
8.2.7.2. Building a Library
Partner B installs a TI Code Composer Studio as described in Install TI Code Composer Studio.
Partner B installs a Python environment as described in Software Installation.
Partner B builds a library by adding sources etc. to the minimal project as needed and builds the library.
.\fox.ps1 waf build
./fox.ps1 waf build
./fox.ps1 waf build
Partner B shares the library and accompanying headers with Partner A.
8.2.7.3. Including the Library
Partner A saves the library and accompanying headers and adds the path to the library to the search path, the library name the list of used libraries and the path to the headers to the include path (in
cc-options.yaml
).- For including the library the library path has to be updated:
LIBRARY_PATHS: win32: - ..\..\src\app\driver\<library folder name> linux:
- In the section libraries the name of the library has to be added:
LIBRARIES: ST: # libraries following the pattern "lib<name>.a" TARGET: # libraries following the pattern "<name>.lib" - <name>
For the changes to take effect execute: ./fox.ps1 waf configure
Now the project should build with: ./fox.ps1 waf build_app_embedded