2015-04-28 04:30 PM
Hello,
I am having troubles trying to get any simple project to work when I create it with the ''Target Support Package - STM32 Adapter'' toolbox provided by STM for Simulink. For example, I followed the steps described inhttps://www.youtube.com/watch?v=U8jT2lqU0bU
to program a discovery board using Simulink, STM32cubeMX and Keil toolchain. I just load my simulink blank model, configure the setup with my cubeMX .ioc file with the port configuration and link one input with an output, as simple as that. The problem comes when I compile the proyect from Keil. I got this log:Build target 'BLINK Configuration'
compiling system_stm32f4xx.c...
compiling main.c...
..\Src\main.c(126): warning: #111-D: statement is unreachable
untitled_initialize();
..\Src\main.c(136): error: #94-D: the size of an array must be greater than zero
OverrunFlags[0] = true;
..\Src\main.c(136): error: #77-D: this declaration has no storage class or type specifier
OverrunFlags[0] = true;
..\Src\main.c(136): error: #147: declaration is incompatible with ''boolean_T OverrunFlags[1]'' (declared at line 69)
OverrunFlags[0] = true;
..\Src\main.c(136): warning: #520-D: initialization with ''{...}'' expected for aggregate object
OverrunFlags[0] = true;
..\Src\main.c(139): warning: #1295-D: Deprecated declaration untitled_step - give arg types
untitled_step();
..\Src\main.c(139): error: #260-D: explicit type is missing (''int'' assumed)
untitled_step();
..\Src\main.c(139): error: #147: declaration is incompatible with ''void untitled_step(void)'' (declared at line 71 of ''..\untitled\Inc\untitled.h'')
untitled_step();
..\Src\main.c(144): error: #94-D: the size of an array must be greater than zero
OverrunFlags[0] = false;
..\Src\main.c(144): error: #77-D: this declaration has no storage class or type specifier
OverrunFlags[0] = false;
..\Src\main.c(144): error: #147: declaration is incompatible with ''boolean_T OverrunFlags[1]'' (declared at line 136)
OverrunFlags[0] = false;
..\Src\main.c(144): error: #148: variable ''OverrunFlags'' has already been initialized
OverrunFlags[0] = false;
..\Src\main.c(144): warning: #520-D: initialization with ''{...}'' expected for aggregate object
OverrunFlags[0] = false;
..\Src\main.c(145): error: #169: expected a declaration
}
..\Src\main.c(245): warning: At end of source: #12-D: parsing restarts here after previous syntax error
..\Src\main.c(50): error: #114: function ''MX_GPIO_Init'' was referenced but not defined
static void MX_GPIO_Init(void);
..\Src\main.c(69): warning: #550-D: variable ''OverrunFlags'' was set but never used
static boolean_T OverrunFlags[1];
..\Src\main.c(75): warning: #550-D: variable ''remainAutoReloadTimerLoopVal_S'' was set but never used
static uint32_t remainAutoReloadTimerLoopVal_S = 1;
..\Src\main.c: 7 warnings, 11 errors
compiling stm32f4xx_hal_msp.c...
compiling stm32f4xx_it.c...
assembling startup_stm32f407xx.s...
compiling stm32f4xx_hal_rcc.c...
compiling stm32f4xx_hal_dma.c...
compiling stm32f4xx_hal_rcc_ex.c...
compiling stm32f4xx_hal_cortex.c...
compiling stm32f4xx_hal_gpio.c...
compiling stm32f4xx_hal_pwr_ex.c...
compiling stm32f4xx_hal_flash_ex.c...
compiling stm32f4xx_hal_pwr.c...
compiling stm32f4xx_hal_flash_ramfunc.c...
compiling stm32f4xx_hal_flash.c...
compiling stm32f4xx_hal.c...
compiling untitled.c...
..\untitled\Src\untitled.c(50): warning: #188-D: enumerated type mixed with another type
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_13, untitled_B.GPIO_Read);
..\untitled\Src\untitled.c: 1 warning, 0 errors
''BLINK Configuration\BLINK Configuration.axf'' - 11 Error(s), 8 Warning(s).
Target not created.
Build Time Elapsed: 00:00:25
The kind of errors look like there is something wrong with the automatic generation of the code.
I have been able to load succesfully some examples that I downloaded from the Keil toolchain.
I am using the latest version of the toolchain, Keil V5 and the pack for my controller is updated. (In the video a previous version of Keil is used, but it should make no difference since my controller is still fully supported).
I even reinstalled all the programs but still got the same result.
In the video I attached before, the user only makes sure that the port is switched to SW and also that there is a flash loader set. I also tried following the steps for known problems wich appear at the bottom of the Readme file located, in my case, in C:/MATLAB/STM32-MAT/STM32/Readme.html. But neither erasing the '' Configuration'' string nor completing the Define statement worked for me. In fact I always got the same log.
Any idea about where can be the problem? I followed the video step by step and the rest of settings in my computer are as default.
#error #keil #- #stm32f4-discovery
2015-05-10 06:06 AM
Here I come with solutions for everyone (finally).
Okay, it seems that there is a bit of a mess by STM, in my opinion, since they do not provide a compiler tool nor a clear guide to configure it.
But it seems also that the problem was a Keil pack for STM32f4 update that makes the code generated by the latest version of STM32CubeMX not supported by the compiler.
Here is a note by keil where they explain it:
http://www.keil.com/appnotes/files/apnt_266.pdf
In the note you can find the correct packages and how to configure the compiler.At least Keil has uploaded an explanation, but it looks like if STM staff just don't care if things stop working.
I expect more synchronization in the future between both Keil and STM because automatically exporting designed models from design software as simulink is such an interesting tool.
Best regards.