cancel
Showing results for 
Search instead for 
Did you mean: 

[SOLVED] SIMULINK compilation successful but how to continue within STM32CubeIDE and deploy to the board? Some files appear to be missing

DCagi.1
Associate II

Hi everyone,

I have bought a STM32F4-Discovery Board DTM32F429I-Disc1, and my intention is to work in Matlab-Simulink.

This is the process I have followed:

  1. INSTALLATION:
    1. Matlab/Simulink R2018b 64bit with toolboxes like Embedded Coder
    2. Matlab/Simulink HW support package "Embedded Coder Support Package for STMicroelectronics Discovery Boards"
    3. STM32-MAT/TARGET from ST
    4. STM32CubeMX from ST
    5. STM32CubeIDE_1.3.0 from ST
  2. STM32CubeMX: generate the .ioc file for the right board/MCU in order to blink the green LED:
    1. Give it the name "BlinkLED"
    2. PG13 as GPIO_Output and with a name "GreenLED"
    3. Select: ProjectManager\Project\Toolchain\IDE = STM32CubeIDE
    4. Select: Pinout&Configuration\SystemCore\NVIC\CodeGeneration\TimeBase:SystemTickTimer -> TICK ON "Generate IRQ handler"
  3. Matlab-Simulink:
    1. Add the STM32-MAT/TARGET path to Matlab's path (pathtool)
    2. Create a new simulink model
    3. Within the configuration parameters:
      1. Solver: Fixed-step, stop time = inf, step time = 0.001
      2. Code generation: Select the target file as "stm32.tlc" (This takes a while...)
      3. Code generation: Within the STM32 options, update the STM32CubeMx path
    4. Open the Simulink library and at the bottom should be the library for "Target support package - STM32 adapter"
    5. Select block "STM32_Config" and link to the .ioc file generated within STM32CubeMx
    6. Select block GPIO_Write and configure the pin 13
    7. Build:
      1. Create a separate empty folder
      2. Make it your working folder -> In here, all the files generated by the Simulink build will be generated, and not mixed up
      3. Simulink model: Ctrl+B (Build)
      4. SUCCESSFUL!
      5. A .project is generated
  4. STM32CubeIDE:
    1. Open the .project generated (double-click on it)
    2. Within the project tree, right-click on the sub-folder "BlinkLED", select "Properties"
    3. Within the properties tree, select C/C++ build, configuration "DEBUG"
    4. Remove the TICK from the box "Exclude resource from build"
    5. Do the same for the configuration "RELEASE"
    6. Apply and close
    7. Within the project tree, right-click on the top-folder -> Debug as: STM32 Cortex M C/C++ Application
  5. BUILD FAILED, 4x ERRORs! -> These errors should not appear anymore

C:/Users/isc2tr/Documents/MATLAB/Examples/BlinkLED/Debug/../Src/main.c:124: undefined reference to `BlinkLED_initialize'

C:/Users/isc2tr/Documents/MATLAB/Examples/BlinkLED/Debug/../Src/main.c:145: undefined reference to `BlinkLED_step'

C:/Users/isc2tr/Documents/MATLAB/Examples/BlinkLED/Debug/../Src/main.c:134: undefined reference to `BlinkLED_M'

collect2.exe: error: ld returned 1 exit status

make: *** [makefile:44: BlinkLED.elf] Error 1

What am I missing?

How can I deploy the code generated in Simulink to the board, by using the STM32CubeIDE?

Thanks

SOLVED: Follow the updated step-by-step process above.

14 REPLIES 14
DCagi.1
Associate II

Hi @Cyril FENARD​ 

I can not find such a file.

I have packed everything into a .zip

Doing a search in all files (Using Notepad++), the function SysTick_Handler() does not appear anywhere...

Thanks a lot

Cyril FENARD
ST Employee

Hi @DCagi.1​ ,

I quickly looked at your zip; everything is mixed in all this.

The following link may help you:

https://community.st.com/s/question/0D50X0000ByvL4zSQE/what-is-the-problem-with-my-program-using-mattarget

Regards.

Cyril

DCagi.1
Associate II

Hi again @Cyril FENARD​,

I have build "Ctrl+B" within Simulink in a different folder, to avoid files getting mixed. Please find the files you are asking attached as a .zip file (now the "stm32f4xx_it.c" file is within the "Src" folder).

Regards

Hi @DCagi.1​ ,

"Generate IRQ handler" is not set for "Time base Sys tick timer" in your STM32CubeMX project (BlinkLED.ioc).

Regards.

Cyril

DCagi.1
Associate II

Hi @Cyril FENARD​ 

Eureka! Now it is up a running, thanks a lot for your valuable help. I will try to make some comments in the 1st post, for others to benefit from it.

0693W000000V3CCQA0.jpg

Have a nice day