Code generation for stm32f4 discovery results in an empty main.c
3 views (last 30 days)
Show older comments
Hello to everyone,
I am trying to connect my stm32f4 discovery board to simulink to generate code and run in on the board via IAR EWARM.
The model is built without any errors, but when the project is opened in IAR, it shows the main.c function, where there is nothing but initialization of this and that. I will now show the steps that i make:
1) create a project in stm32mx cube for the given MCU, lets say i want a LED on pin PD15 to turn on when the button on pin A0 is pressed, so i configure the corresponding pins and create an .ioc file config.ioc. Then i create a project in some folder and close the stm32mx cube.
2) in matlab i create a folder, where i create a simulink model leds.slx
3) in the model parameters i configure Code Generation for the target file stm32.tlc, solver for fixed-point solver with 0.001 step, stm32 project options - i refresh cube path, click apply
4) this is the model i build:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/421713/image.png)
very simple
5) in the mcu config i choose the config.ioc
6) build the model
7) open the project folder, in the EWARM folder there is the project file, open it with IAR:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/421718/image.png)
8) make the project, no errors, no warnings
9) press download and debug:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/421723/image.png)
the main.c file contains no info on system operation, some initiation and empty infinite loop.
If anyone has any ideas on how to resolve this issue, please, do share!
Best regads, Alex
1 Comment
Peeyush Kumar
on 2 Dec 2020
Hi Alexander,
The above workflow is officially supported by ST Microelectronics, please refer to the follwoing link for more information:
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!