It was as easy as selecting Basic at the Application Structure field. I'm posting this because it may help any other people with the same problem.
Simulink code generation for STM 32, STM32CubeMX tool doesn't merge code section in main.c
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi everyone,
I'm working on Embedded Coder for programming a STM32F303VCT MCU. In my toolchain I'm using the STM32Cube IDE.
After couple of days trying to build and debug a simple blinking LED program I found the following error.
The Simulink build function that generates the code and builds the model create several .c and .h files. After that the STM32CubeMX generates every necessary files for .project file used in the IDE.
In the main.c and the stm32f3xx_it.c files created by the Embedded Coder Toolbox appear the following comment: /* This section of code is going to be merged by the STM32CubeMX tool. */. Which means that automatically the STM32CubeMX tool should complete the generated the main.c and the stm32f3xx_it.c files of the IDE project located in the Core folder. This folder contains the files that are build into the MCU for the debugging process.
The problem is that this doesn't happen and I have to copy-paste manually those code section's into the Code folder of the IDE project. I guess that it's a problem of the folders pathing and Code Generator options of the STM32CubeMX tool, but I dont' know how to solve it.
Thanks,
Ruben
2 Kommentare
zhixuan zhang
am 9 Jan. 2021
Yes, I have the same problem too. The stm32cubemx will generate Core folder which include the Src and Inc foders, however the embedded coder will generate the Src folder which will include the main.c and the XXX conf files which should be merged in to the stm32cubemx's files. I believe this is a bug that stm32cubemx upgraded but simulink didn't change, so it can't be merged automatically.
Antworten (1)
zhixuan zhang
am 9 Jan. 2021
I have figured it out. This is the reason and solution.
this is the file structure generated by the stm32cubemx 6.1.1 version notice that inside the Core floder there are Inc and Src.
And this is the file structure generated by the stm32cubemx 5.4.0version, notice that Src and Inc floder are in the root floder
2 Kommentare
zhixuan zhang
am 9 Jan. 2021
when simulink generate the code it will put the main.c and the conf files in the Src folder if stm32cubemx and simulink don't put them in the same folder, they will NOT merge. That is the reason why they didn'd merge. The solution is sample: remove the newest version of cubemx and install the old one. I am not sure which is the best, yet I have tried 5.4.0 version which works perfectly in my computer.
Hope this can solve your problem.
zini giacomo
am 25 Feb. 2021
actyally you need just to select BASIC from application structure, even if you have teh latest version of cubeMX, at leas it worked for me.
then i got a problem of linking in the project, but i solved it going on the folder with the same name of the slx and from properties->C/C++ Build unceck exclude resource from build
Siehe auch
Kategorien
Mehr zu Get Started with Embedded Coder Support Package for STMicroelectronics STM32 Processors finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!