Main Content

Debug Simulink Generated Code in STM32CubeIDE

This section describes how to integrate Simulink® generated code with STM32CubeIDE for debugging and deployment on STM32 hardware. Ensure you have a Simulink model capable of generating code for the STM32 hardware. STM32CubeIDE, a development environment for STM32 microcontrollers, is utilized to facilitate this integration.

The following steps enables you to effectively debug and deploy the Simulink generated code on STM32 hardware.

  1. Open the Modeling tab and press CTRL+E to open the Configuration Parameters dialog box. Go to Hardware Implementation > Hardware board.

  2. Select STM32 Processor Based board.

  3. Navigate to Code Generation > Build process > Build configuration and select Debug.

    Debug

  4. Build the project from Simulink.

  5. Create a new STM32 Project in STM32CubeIDE. Select the required board on which you are going to debug the Simulink generated code.

  6. Click Debug > Debug Configuration.

  7. Right click on STM32 Cortex-M C/C++ Application and select New Configuration.

  8. Browse to the STM32 project created earlier in step 5.

  9. Browse the elf generated from Simulink in C/C++ Application and Click Debug.