Skip to main content

Overview

General structure

Required software

  • Embedded Coder
  • Simulink Coder
  • Simulink Compiler
  • MATLAB Coder
  • MATLAB Compiler


Code generation

In general the code is generated from Simulink blocks, where all the control has to do is done inside this one block:

image.png

To be able to generate C code for the STM32's you will first need to activate the embedded C coder, which can be done by clicking on the apps tab in the top bar, and then searching for C embedded coder in the apps bar.

image.png

After the embedded C coder is active, a new tab called C CODE appears, where you now have to press the quick start button to start the code generation process:

image.png

When in the quick start menu, the only critical options for this project are to set the system which gets generated to the main control block of this project, and to set the word size to be the same as the ones from the STM32.

image.png

image.png

The rest of the settings work best on the default option, but can be changed if deemed necessary.