This repository is no longer maintained; this project has been moved here.
This repository contains instructions for creating a library object from an SensiML Analytics Studio project for any xc32 supported platform.
Notes:
- This script has only been tested under linux (ubuntu), Git Bash, and macOS.
*.options.ini
can be modified to set additional project options; for help call the mplab scriptprjMakefilesGenerator -setoptions=@ -help
- NB: all relative paths are considered relative to the project root folder (.X folder)
*.project.ini
is just a placeholder - the languageToolchain and device variables are replaced when building the project - others will take default values if unspecified.
- MPLAB® X IDE >=6.00 (https://microchip.com/mplab/mplab-x-ide)
To deploy a knowledge pack for the SAMD21 ML Eval Kit:
- Open up your SensiML project in the Analytics Studio and navigate to the Download Model tab.
- Select
Microchip SAMD21 ML Eval Kit
from the HW Platform options. - Select one of Binary, Library or Source from the Format options. Note: source format is only available for upper tier customers.
- Select the appropriate sensor configuration for your project from the Data Source options. Note that this configuration should match the one you used to capture the data your model was trained with.
- Click the Download button to download the model.
Deployment from the Analytics Studio |
The following steps cover compiling the SensiML library into a static library object.
-
Extract the library from the step above directly into this folder.
-
(Optional) Open
options.ini
and modify C as needed. -
Set the environment variables
MPLABX_VERSION XC_NUMBER_BITS XC_VERSION
as desired, then runbuild.sh
to generate the library object. For example:MPLABX_VERSION=6.00 XC_VERSION=4.00 XC_NUMBER_BITS=32 ./build.sh ATSAME54P20A libsensiml .
If MPLAB X or the XC compiler are in non-default install locations, set the corresponding path directly through the
MPLABX_PATH
andXC_PATH
environment variables.
To launch a Docker build for a specific target build arguments must be set as
shown in the included example .args
files. See docker_build.sh
for a full
example for building the docker image and generating the SensiML
library/project. This script can be run by passing the target name and .args
file e.g.:
./docker_build.sh ATSAME54P20A args/SAME54.args
This will output the result of the build into a folder dist/
under your
current working directory.
See packs.download.microchip.com for device family pack listings.
Below are instructions for integrating the library object, compiled with the steps above, into an MPLAB X project.
-
Add the library object from the step above into an existing MPLAB project as shown below.
-
Use
src/main.c
as a template for integrating the SensiML library into your project. -
Add the path to the directory where the SDK is extracted in your include path under Project Properties -> xc32/16/8-gcc -> Preprocessing and messages -> Common include dirs
-
Ensure that the
Remove unused sections
option under Project Properties -> xc32-ld is enabled (see (2) in the image below); this will eliminate any unused data or functions from the SDK to reclaim device memory.
You should now have your SensiML model fully integrated with an MPLAB X project. In order to update the deployed model, simply repeat the steps from the build instructions section above.