2020-06-16 06:07 PM
run on Matlab 2018b, STM32CubeIDE v1.3.1, STM32CubeMX v5.6.1, STM32-MATE/Target v5.6.0
Simulink mode:C:\MATLAB\STM32-MAT\STM32\STM32demos\Test\GPIO\F407VGTx-Discovery\SimpleGPIO.
model build and code gerneration on simulink is ok.
"
*********
*** stm32_make_rtw_hook(): writeScript()<
### Open STM32CubeMX for project code generation.
*** stm32_make_rtw_hook(): startStm32CubeMx(): java -jar "C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeMX\STM32CubeMX.exe" -q "C:\MATLAB\STM32-MAT\STM32\STM32demos\CodeGeneration\.script"
### Code generation completed.
Build process completed successfully
"
then i open the CubeIDE project and build it, the error reported. as the attached image
would you offer some suggestion about it?
2020-06-21 12:18 PM
Your installation of MATLAB is probably in a path that contains spaces, i.e. C:\Program Files\MATLAB\R2018b\simulink\include. The workaround for that is to go to Project Properties, in C/C++ Build-> Settings -> (Your active configuration) -> Tool Settings -> MCU GCC Compiler -> Include paths, select the path to the Matlab/Simulink include folder, edit it to add double quotes before and after the path: "C:\Program Files\MATLAB\R2018b\simulink\include". Then 'Apply and Close'.
The build will then proceed until it crashes with an error in not being able to compile 'main.c', because it cannot find references to the files that Simulink generated, and which are called from main(). To fix it, navigate in the Project Explorer to SimpleGPIO -> Src -> SimpleGPIO.c, right-click for Properties, and in there, in the section opened at C/C++ Build -> Setting -> (Your active configuration), untick the box with "Exclude resource from build". "Apply and Close" and it should now build.
This is a peculiarity of the generated project for STM32CubeIDE, which does not add double quotes around paths containing spaces, which Matlab installations tend to by default. This does not inspire confidence in using STM32CubeIDE, as the same project generated for Keil MDK builds the first time without any issues. It may be fixed in future releases, so who knows?
2020-06-21 06:21 PM
Hi, Amigo
Thank you for your kindly reply.
i follow your instruction and the build is success!