Getting started with Start From Board

This article explains what is the Start From Board feature and how to use it through a detailed example.

1 What is Start From Board?


Start From Board is a functionality of STM32CubeMX that simplifies the creation of a project on a board.
A project can quickly be generated and uploaded to a board.
The working generated skeleton allows a faster understanding of the ins and outs of the board workings.

Main features:

  • A fully functional application can be generated in a few clicks.
  • All the required board support packages (BSPs) of drivers and configuration settings, which allow a kernel image to boot up the board, are included in a few clicks.

This article uses the STM32C031C6Tx-based NUCLEO-C031C6 device as an example.
See the list of supported boards below.

1.1 Objectives

  • Learning how to generate easily a project to execute on a board.
  • Creating a simple project illustrating the Start From Board functionality.

2 Creating the project in STM32CubeMX

The example below uses the NUCLEO-C031C6 board to create a project with the following functionalities:

  • A green LED goes on and off when the user presses the User button on the board.
  • A message is sent to the UART associated to the ST-LINK.

Select the NUCLEO-C031C6 board using the Board Selector, as shown in the figure below:
Start from board boardselector.png

  • Double-click on the picture of the board or press the Start Project button.
  • By default, the checkbox Generate demonstration code is not checked.
  • It must be checked to generate the code allowing the user to interact with the board via the User button located on the board.

Start from board options.png

  • Check the Generate demonstration code checkbox.
  • Each of the checkboxes under the Human Machine Interface allows the inclusion of the corresponding BSP drivers.
  • The list of the available BSPs is presented and some are checked.
  • This indicates that STM32CubeMX is about to generate the code using the corresponding BSP drivers.
  • Press the OK button.

3 On the Pinout & Configuration view

  • Locate the Bsp section on the left hand side of the Pinout & Configuration view.
  • Expand the Bsp section to show the list of boards being configured.
  • Click on the NUCLEO-C031C6 board.

The Mode and Configuration panels are opened with the data previously configured in the wizard.

Start from board pinout and configuration.png

Note that:

  • You can adjust the settings in the Mode and Configuration panels.
  • You cannot enable or disable the Generate demonstration code option.

Limitation:
If you press the Reset Configuration button on the screen, you will not be able to interact with the Generate demonstration code option any longer; The option is set to do not generate.

3.1 Generating the project

Go to the Project Manager tab:

  • Give a name to your project.
  • Select your preferred toolchain / IDE.
  • Press the GENERATE CODE button.

Start from board generate code.png

3.2 Moving the code to the board

You can now locate the generated code in your file system. Compile it using the appropriate toolchain and transfer the firmware to the board.

  • Using the User button on the board, you can start and stop the LED blinking process.
  • Using a debugger, you can see the data being sent to the UART associated to the ST-LINK.

Start from board6.png

4 Limitations

The functionality is not compatible with the software packs implementing BSP drivers.

5 Supported boards

Board name
NUCLEO-C031C6
NUCLEO-U031R8
NUCLEO-U083RC
NUCLEO-U5A5ZJ-Q
NUCLEO-H563ZI
NUCLEO-H533RE
NUCLEO-H7S3L8