Importing an IoT Studio SensorTile Project into STM32CubeIDE


ST’s SensorTile is a unique little evaluation board. With an outline of only 13.5 x 13.5 mm, it includes an ultra-low-power Cortex M4F MCU, IMU, MEMS barometer, MEMS microphone, BLE network processor, 50 Ω balun, and 1.8V LDO. Digi-Key’s IoT Studio allows developers to quickly create simple IoT solutions based on the SensorTile without the need to write any code. However, not every feature of the SensorTile is currently available for utilization in IoT Studio (the UART and SPI external interfaces for example). For those who would like to utilize the IoT Studio platform but at the same time take advantage of all the SensorTile’s capabilities, the project source code can be downloaded for further low-level development. While several IDEs are available for STMicroelectronics’ MCUs, this post will focus on the new STM32CubeIDE, which combines their recently acquired TrueSTUDIO IDE with their well-known STM32CubeMX code configurator and generator. Consequently, the steps in this tutorial can also be followed to import your project into TrueSTUDIO, if you prefer.

  1. Open your SensorTile project in DK IoT Studio. For this tutorial, I used the SensorTile Onboard Sensor Demo project located in the Demo Projects tab. You can also create a new SensorTile project if you prefer. Because we will be importing the project into an Eclipse-based IDE, there should be no spaces in the project name to make the process as straightforward as possible. To modify the project name; simply click Info in the top right-hand corner to open the Project Info dialog, make your modifications, and click Close. In the figure below, I did this to shorten the project name and replace the space with an underscore. You can now save and compile the project by clicking Compile.

  2. Once the project is finished compiling, you can download the source code by clicking the download button (circled in red below). A .zip file containing the code will then be downloaded to your computer.

  3. Extract the contents of the .zip file to a location without spaces in the path name. This includes not only the destination directory, but every parent directory as well. For example, I extracted my source code to C:\Users\Matt\Documents\DKIoTStudio\SensorTile_Demo_source. There are no spaces anywhere in this path.

  4. Launch STM32CubeIDE. When it asks you to select a directory as a workspace, the default directory will be fine. Again, no spaces should be present in whatever directory path you choose. Once in the workbench, navigate to File > Open Projects from File System…. In the resulting window, click Directory… and select the directory in which you extracted the source code. You should then see two folders listed in the import wizard. The one that says Convert 'System Workbench for STM32' project to STM32CubeIDE project under Import as should be checked. Uncheck the other one as shown below. Click Finish.

  5. The dialog box below should pop up telling you that the project needs to be converted. Click OK.


    If all goes well, you should receive the notification below. Again, click OK.


  6. In the Project Explorer, right-click on the project you just imported and choose Properties. Under C/C++ Build choose Settings. In the Tool Settings tab, choose Include paths under MCU GCC Compiler. There are five paths in this list that need to be modified to allow the project to compile successfully. They are as follows:

  • ${workspace_loc:/${ProjName}/sensortile_base/Drivers/CMSIS/Device/ST/STM32L4xx/Include}

  • ${workspace_loc:/${ProjName}/sensortile_base/Drivers/STM32L4xx_HAL_Driver/Inc}

  • ${workspace_loc:/${ProjName}/sensortile_base/Drivers/CMSIS/Include}

  • ${workspace_loc:/${ProjName}/sensortile_base/Middlewares/ST/EEPROM_Emul/Porting/STM32L4}

  • ${workspace_loc:/${ProjName}/sensortile_base/Middlewares/ST/EEPROM_Emul/Core}

    These paths are highlighted in yellow in the figure below. In each case, select the path, click the Edit… button (circled in red below) and remove the sensortile_base/ directory from the path. The resulting paths will be:

  • ${workspace_loc:/${ProjName}/Drivers/CMSIS/Device/ST/STM32L4xx/Include}

  • ${workspace_loc:/${ProjName}/Drivers/STM32L4xx_HAL_Driver/Inc}

  • ${workspace_loc:/${ProjName}/Drivers/CMSIS/Include}

  • ${workspace_loc:/${ProjName}/Middlewares/ST/EEPROM_Emul/Porting/STM32L4}

  • ${workspace_loc:/${ProjName}/Middlewares/ST/EEPROM_Emul/Core}

    After making these changes, click Apply and Close. Click Yes when if it asks you to rebuild the index.

  1. You should now be able to successfully build the project. As you can see below, it took almost three minutes to build on my computer.

1 Like