Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updating numbered headings

...

This application note explains how to build and run FreeRTOS run-time image for the Emcraft STM32H7 SOM and Starter Kit using STM32CubeIDE.

1. FreeRTOS Demo Project

Emcraft maintains the FreeRTOS sources for the STM32H7 SOM and Starter Kit in the following repository:

...

The standard ST tools support writing to the internal STM32H7 Flash memory, however to program the QSPI Flash an external loader program is required. This program is provided in a separate STM32CubeIDE project mt25ql512abb_stm32h7_som. This project is available at the same git repo on the emcraft-projects branch as the main demo project. The project mt25ql512abb_stm32h7_som must be built in the STM32CubeIDE and then the resultant binary MT25QL512A_STM32H7-SOM.stldr must be added to the STM32CubeIDE or STM32CubeProgrammer, in order to operate with the QSPI Flash of the STM32H7 SOM.

2. Software Set-Up

The STM32CubeIDE needs to be installed on the development host in order to build and debug FreeRTOS.

Go to https://www.st.com/en/development-tools/stm32cubeide.html and select the latest version of the IDE. The Emcraft configuration has been tested with STM32CubeIDE Version 1.15.1, using Ubuntu 22.04 as the development host.

3. Hardware Set-Up

The following hardware set-up is required for installation of the software to the STM32H7 SOM:

...

The following picture illustrates the above hardware set-up:

...

4. Adding the FreeRTOS Project to STM32CubeIDE

Run the following step-wise procedure to import the FreeRTOS project to the STM32CubeIDE:

  1. Create a separate directory and clone the FreeRTOS repository:

    Code Block
    $ mkdir stm32h7-som
    $ cd stm32h7-som
    $ git clone https://gitlab.com/emcraft/STM32H7/STM32CubeH7.git -b emcraft-projects
    
  2. Start the STM32CubeIDE and select a workspace directory. The workspace directory is an arbitrary directory, different from the directory where your source file is located.

  3. Click File->Open Projects from File System:

    image-20241002-131123.png

  4. Select <STM32CubeH7 path>/freertos_stm32h7_som path and click Finish.

5. Building the Project

  1. In Project Explorer double click to the freertos_stm32h750_som.ioc file to activate the Device Configuration Tool:

    image-20241002-131329.png
  2. Click Project->Generate Code or press Alt-K to generate C-files from the .ioc file.

  3. Click Project->Build Project or press Ctrl-B to start building.

  4. Select the Console tab and check the output:

    image-20241002-131427.png
  5. If needed, find the executable binaries in the Debug subfolder of the FreeRTOS project directory.

6. Running the Project

  1. In order to program the application part of the freertos_stm32h7_som project to the QSPI Flash, use the external loader. The following procedure builds the mt25ql512abb_stm32h7_som external loader from the STM32CubeIDE in the same workspace, where the main demo project resides:

    1. Click File->Open Projects from File System:

      image-20241002-131512.png

    2. Select <STM32CubeH7 path>/mt25ql512abb_stm32h7_som path and click Finish.

    3. In Project Explorer double click to the mt25ql512abb_stm32h7_som.ioc file to activate the Device Configuration Tool:

      image-20241002-131750.png

    4. Click Project->Generate Code or press Alt-K to generate C-files from the .ioc file.

    5. Click Project->Build Project or press Ctrl-B to start building.

  2. In Project Explorer select the freertos_stm32h7_som project. Then click Run->Run Configurations...:

    image-20241002-131903.png

  3. Select STM32 C/C++ Application -> freertos_stm32h7_som Debug. Select the Debugger tab, scroll down and click Add... in the External loaders group:

    image-20241002-131956.png
  4. Click Workspace... and select MT25QL512A_STM32H7-SOM.stldr file:

    image-20241002-132019.png

...

  1. Apply changes and clone the Run Configurations... window.

  2. Click the Run button at the top panel to install the application to the target board and run it:

    image-20241002-132106.png
  3. The following prompt shall appear on the serial console:

    Code Block
    STM32H7 SOM FreeRTOS CLI, www.emcraft.com
    Type help to view a list of available commands.
    CLI>
    

7. Debugging the Project

Its is assumed that the MT25QL512A_STM32H7-SOM.stldr external loader is already added to the project's Run Configurations as per items 7.1 .. 7.5.

...

  • Set a breakpoint after the MX_QUADSPI_Init() function is done:

    image-20241002-132421.png

  • Proceed to execute the program.

  • When the program stops at the breakpoint set in the 2 steps above, the QUADSPI interface is initialized and the application code is copied to SDRAM, so you can use breakpoints in the application code. Let's set a breakpoint at the prvHelpCommand() function in the CLI driver:

    image-20241002-132443.png

  • Proceed to execute the program.

  • Switch to the terminal with the serial console and type the help command:

    Code Block
    STM32H7 SOM FreeRTOS CLI, www.emcraft.com
    Type help to view a list of available commands.
    CLI> help
    
  • Switch back to the debug session in the STM32CubeIDE. Make sure the execution is stopped at the breakpoint in the prvHelpCommand() function. Use the Step Over button to proceed the execution in a step-wise fashion:

    image-20241002-132501.png

  • Proceed to execute the program in a step-wise fashion, set up breakpoints, examine variables and so on.

8. Known Problems and Limitations

This section lists known problems and limitations:

...