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