2020-03-13 04:15 AM
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:
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.
2020-03-13 04:22 AM
Another option to avoid the STM32CubeIDE, could be to generate directly from Matlab-simulink a .bin file and load it to the board with the ST-Link Utility. But the Build (Ctrl+B) process in Simulink does not generate this .bin file. Is there a certain tab/option that needs to be enabled? Thanks
2020-03-17 06:59 AM
Hi @DCagi.1 ,
What you did seems right.
The problem you encountered is that it is a link error, which means that some files are not compiled properly in your STM32CubeIDE project.
Can you check that files that are missing are not excluded from build in the STM32CubeIDE project(have a look at the properties of BlinkLED items).
Regards.
Cyril
PS: These kinds of issue are already reported on STM32-MAT/TARGET forum also.
2020-03-17 07:58 AM
Hi @Cyril FENARD
These are the files before compiling the SIMULINK model:
These are the files after:
As you can see, a ".project" is generated, which is the one I open within STM32CubeIDE.
Not sure what you mean by "check the properties of BlinkLED items".
Is this something to modify within the BUILD configuration in SIMULINK? If so, how?
Thanks a lot
2020-03-17 08:16 AM
Hi @DCagi.1 ,
I share an example of build properties under the STM32CubeIDE view:
Regards,
Cyril
2020-03-23 04:52 AM
Thanks a lot @Cyril FENARD
I get no more errors in STM32CubeIDE.
However, the LED does NOT light on.
I tried to load the .bin generated making use of the STM32-Link Utility, but does NOT work either.
Which part of the code should I check? Which file actually contains "the logic" modelled in Simulink?
This is the Simulink model, and I have attached the Simulink build log file (.txt):
Thanks everyone.
2020-03-23 05:29 AM
Hi @DCagi.1 ,
You have built the final application with the IDE you choose, that is to say the STM32CubeIDE in your case.
You can debug directly using the STM32CubeIDE tool.
BlinkLED.h/c are files generated by the Simulink coder.
You can add a breakpoint in the BlinkLED_step () function. This function should call the HAL GPIO functions.
Regards,
Cyril
2020-03-30 04:40 AM
Hi @Cyril FENARD
It seems, it never gets to the "BlinkLED_step ()" function, since this variable is always 1: remainAutoReloadTimerLoopVal_S == 1
Could it be related to any configuration of the clock within Stm32CubeMx (.ioc file)?
With the "System Core", selecting the "SYS", the timebase source is set to "SysTick":
Any ideas?
Regards
2020-03-30 04:44 AM
2020-03-30 04:53 AM
Hi @DCagi.1 ,
May you also share the stm32xxxx_it.c file?
SysTick_Handler() should be called periodically in you use-case.
Regards.
Cyril