Getting started

This section describes how to install the SPARK Software Development Kit (SDK) virtual environment on a user’s personal computer. Virtual environments are isolated environments that use specific versions of software packages without affecting the rest of the system. They work by creating a separate directory where all the necessary files for the environment are installed. A specific virtual environment is activated by modifying the system’s PATH variable to point to that directory so that commands are executed using the packages installed there rather than the system’s default packages.

The SPARK SDK development environment dependencies are all contained within this virtual environment and can be easily bootstrapped by running a single script.

After following the steps outlined below to install and set up the virtual environment, the user will be ready to start building their own applications. Let’s get started!

Prerequisites

Code editor

SPARK’s SDK is designed to work with Visual Studio Code (VSCode). This Integrated Development Environment (IDE) is used internally and can be considered as tested and supported. Other IDEs or source code editors can be utilized provided that they support CMake and micromamba virtual environments.

The use of CMake files and the micromamba virtual environment allows for a more flexible and scalable development process and enables users to access a variety of tools and platforms to build and develop applications using the SPARK SDK.

Warning

Users of a different source code editor or IDE assume the responsibilities of ensuring that it supports CMake and that the necessary plugins or extensions are installed. They will also need to set up a virtual environment using micromamba which is required for building and running applications with the SDK.

Hardware

It’s important to note that the example applications provided with the SPARK SDK are written specifically for the SPARK Evaluation Kit (EVK) board. This means that to run these applications, the user will need at least two EVKs and one ST-Link debug probe.

If access to two evaluation kits is not possible, the user may still use the example applications as a reference for building their own applications. The code will need to be modified for specific hardware configurations, but the overall structure and functionality of the applications are still useful starting points.

In any case, it is recommended to carefully review the documentation and code provided with the SPARK SDK to ensure a clear understanding of how the example applications work and how to adapt them for specific needs.

Setup Steps

The user must bootstrap the SDK once to download all dependencies and initialize the system. A script named bootstrap.sh or bootstrap.bat is provided for this purpose depending on the operating system.

Getting started with the development environment.

  1. Install Visual Studio Code (VSCode) if not done already. It can be downloaded from the official website: https://code.visualstudio.com/

  2. Download the SPARK SDK package and unzip its content into the working directory.

  3. Navigate to the SDK root directory and open a Command Prompt.

  4. Run the bootstrap script by typing :

    $ .\script\bootstrap.bat
    
    Bootstrapping the SDK

This will download every SDK virtual environment dependencies and activate the micromamba environment.

  1. If VSCode was already open, restart it.

  2. VSCode will prompt the user to install the recommended extensions. Click the “Install” button.

  3. Open VSCode’s Command Palette (Press CTRL+SHIFT+P) and type “Cmake: Select a Kit”.

  4. Select “windows-spark-sdk”.

At this stage, the user should be able to choose an application to be compiled. To build an example application, select the desired build variant to compile in the status bar at the bottom of the VSCode window. Afterwards, click on the “Build” button.

VSCode status bar

Figure 1: Visual Studio Code status bar annotated.

Note

If any errors occur during the build process, ensure that previous VSCode user settings are not interfering with the project. To do so, perform the following:

  1. Press CTRL+SHIFT+P.

  2. Type “Preferences : Open User Settings (JSON)” and hit Enter to display the User Settings file.

  3. Make sure the settings.json file looks like this :

    {}

  4. Save the file and close it.

Enabling flashing and debugging features

Set launch parameters to enable flashing and debugging. A template is available to configure launch parameters to specific requirements.

  1. Download and install the ST-Link debug probe drivers and the STM32CubeProgrammer tool. These can be downloaded from the official website: https://www.st.com/en/development-tools/stsw-link009.html and https://www.st.com/en/development-tools/stm32cubeprog.html respectively.

  2. Connect a ST-Link debug probe to the computer and identify the probe’s serial ID using the STM32CubeProgrammer tool. Note the ID for later use.

  3. Open .vscode\.launch.cfg file and set key values with the ID from step 2. Repeat steps 2-3 for each debug probe.

    Example: ST_LINK_NO1_SN=34FF6F065250343836270143
             ST_LINK_NO2_SN=67FF6F065250343836270143
    
  4. Select the desired debug configuration and click Debug to flash the board and start debugging. Make sure the ST-Link debug probe is connected to the board and that the board is switched on before trying to flash.

At this stage, it is possible to build, flash and debug any of the example applications present in the SDK.

Getting started with the development environment.

  1. Install Visual Studio Code (VSCode) if not done already. It can be downloaded from the official website: https://code.visualstudio.com/

  2. Download the SPARK SDK package and unzip its content into the working directory.

  3. Navigate to the SDK root directory and open a terminal or command prompt.

  4. Install the “curl” command-line tool through your Linux distribution’s package manager if not already installed.

  5. Run the bootstrap script by typing the following command into the terminal.

    $ source ./script/bootstrap.sh
    
    Bootstrapping the SDK

    This will download every SDK virtual environment dependencies and activate the micromamba environment.

  6. If VSCode was already open, restart it.

  7. In VSCode, open the SDK folder by going to the menu bar at the top and clicking “File > Open Folder…”.

  8. VSCode will prompt the user to install the recommended extensions. Click the “Install” button.

  9. Open VSCode’s Command Palette (Press CTRL+SHIFT+P) and type “Cmake: Select a Kit”.

  10. Select “linux-spark-sdk”.

At this stage, the user should be able to choose an application to be compiled. To build an example application, select the desired build variant to compile in the status bar at the bottom of the VSCode window. Afterwards, click on the “Build” button.

VSCode status bar

Figure 2: Visual Studio Code status bar annotated.

Note

If any errors occur during the build process, ensure that previous VSCode user settings are not interfering with the project. To do so, perform the following:

  1. Press CTRL+SHIFT+P.

  2. Type “Preferences : Open User Settings (JSON)” and hit Enter to display the User Settings file.

  3. Make sure the settings.json file looks like this :

    {}

  4. Save the file and close it.

Enabling flashing and debugging features

Set launch parameters to enable flashing and debugging. A template is available to configure launch parameters to specific requirements.

  1. Update the system udev rules to use the ST-Link debug probes by performing the following instructions : https://github.com/pyocd/pyOCD/tree/main/udev

  2. Connect a ST-Link debug probe to the computer and identify the probe’s serial ID. Using a terminal or command prompt, type this command to print ST-Link serial IDs.

    $ udevadm info /dev/ttyACM* | grep ID_SERIAL_SHORT
    
  3. Open .vscode/.launch.cfg file and set key values with the ID from step 2. Repeat steps 2-3 for each debug probe.

    Example: ST_LINK_NO1_SN=34FF6F065250343836270143
             ST_LINK_NO2_SN=67FF6F065250343836270143
    
  4. Select the desired debug configuration and click Debug to flash the board and start debugging. Make sure the ST-Link debug probe is connected to the board and that the board is switched on before trying to flash.

At this stage, it is possible to build, flash and debug any of the example applications present in the SDK.

Time to explore

Once these steps have been completed, the user is ready to explore and build new applications or port the example applications onto new hardware. It is recommended to start by reviewing the documentation and code provided with the SPARK SDK as well as by experimenting with the example applications to gain a better understanding of how the platform works.

From there, the user can begin building their own applications using the SPARK SDK or modify the example applications to meet their specific needs.

The possibilities are endless, and we’re excited to see the creations that will emerge from our platform!