2014-05-05 11:13 PM
Hi,
I am trying to get my stm32f4 discovery working with the Matlab/Simulink package provided by ST.
I am using Matlab R2014a V8.3on Windows 7. I am using Keil µVision 4.72 as toolchain. When I am trying theBlinkBlueLed
demo and building it , itcame as:Build
1
1:20:55 PM 5/6/2014
Elapsed: 6 sec
Real-Time Workshop build procedure for method: 'entry Starting build procedure for model: BlinkBlueLed Starting Real-Time Workshop build procedure for model: BlinkBlueLed Model connectivity is: normal Create verification block: None Check Current Directory for building application. [&8;警告: Please change to STM32F4xx\STM32F4xxdemos\CodeGeneration build directory. In any other case there might be confilicts during the build-process towards finding desired files for creating the application.]&8;
Code Generation
Elapsed: 5 sec
Generating code into build folder: D:\Program Files\STMicroelectronics\STM32F4xx-MAT\STM32F4xx\STM32F4xxdemos\Test\BlinkBlueLed_stm32F4xx Real-Time Workshop build procedure for method: 'before_tlc before_tlc Top model: 'BlinkBlueLed Model: 'BlinkBlueLed Invoking Target Language Compiler on BlinkBlueLed.rtw Using System Target File: D:\Program Files\STMicroelectronics\STM32F4xx-MAT\STM32F4xx\rtw\stm32F4xx.tlc Loading TLC function libraries Initial pass through model to cache user defined code Caching model source code Warning: simMode value is 0.0 Warning: Create real-time application main.c Writing header file BlinkBlueLed.h Writing source file BlinkBlueLed.c Writing header file BlinkBlueLed_TimerPortAndPin.h Writing header file BlinkBlueLed_types.h Writing header file rtwtypes.h Writing header file BlinkBlueLed_private.h Writing source file main.c TLC code generation complete. Real-Time Workshop build procedure for method: 'after_tlc after_tlc Creating HTML report file Real-Time Workshop build procedure for method: 'before_make Code Format : Embedded-C Adding source and include directories to make process. STM32F4xx package install path: D:\PROGRA~1\STMICR~1\STM32F~1\STM32F~1 - additional source directories: D:\PROGRA~1\STMICR~1\STM32F~1\STM32F~1\lib\CMSIS\Device\ST\STM32F4xx\Source\Templates D:\PROGRA~1\STMICR~1\STM32F~1\STM32F~1\lib\STM32F4xx_StdPeriph_Driver\src D:\PROGRA~1\STMICR~1\STM32F~1\STM32F~1\src D:\PROGRA~1\STMICR~1\STM32F~1\STM32F~1\lib\CMSIS\Device\ST\STM32F4xx\Source\Templates\arm - additional include directories: D:\PROGRA~1\STMICR~1\STM32F~1\STM32F~1\lib\CMSIS\Device\ST\STM32F4xx\Include D:\PROGRA~1\STMICR~1\STM32F~1\STM32F~1\lib\CMSIS\Include D:\PROGRA~1\STMICR~1\STM32F~1\STM32F~1\lib\STM32F4xx_StdPeriph_Driver\inc D:\PROGRA~1\STMICR~1\STM32F~1\STM32F~1\src Processing Template Makefile: D:\Program Files\STMicroelectronics\STM32F4xx-MAT\STM32F4xx\rtw\stm32F4xx.tmf Wrapping unrecognized make command (angle brackets added) <''%MATLAB%\bin\%MATLAB_WIN_VER%\gmake''> in default batch file Creating BlinkBlueLed.mk from D:\Program Files\STMicroelectronics\STM32F4xx-MAT\STM32F4xx\rtw\stm32F4xx.tmf Building BlinkBlueLed: .\BlinkBlueLed.bat D:\Program Files\STMicroelectronics\STM32F4xx-MAT\STM32F4xx\STM32F4xxdemos\Test\BlinkBlueLed_stm32F4xx>set MATLAB=D:\Program Files\MATLAB\R2014a D:\Program Files\STMicroelectronics\STM32F4xx-MAT\STM32F4xx\STM32F4xxdemos\Test\BlinkBlueLed_stm32F4xx>''D:\Program Files\MATLAB\R2014a\bin\win32\gmake'' -f BlinkBlueLed.mk GENERATE_ASAP2=0 STM32TARGET=''STM32F4xxx'' TOOLPATHFROMREGISTRY=1 DONGLE=''STLinkV2'' COMPILERSETTINGS=''-c --cpu Cortex-M4.fp -g -O3 --apcs=interwork --split_sections $(INCLUDES)'' LINKERSETTINGS=''--cpu Cortex-M4.fp --map --list=$(MODEL)_KEIL_$(BOOT_MODE).map --scatter $(LDDIR)\$(STM32TARGET).sct --scanlib '' ASSEMBLERSETTINGS=''--via $(LDDIR)\asm.cmd'' DOWNLOADAPPLICATION=1 SIMULATION_MODE_RP=''NO_PIL'' TARGET_SRCS=''system_stm32f4xx.c stm32f4xx_gpio.c stm32f4xx_rcc.c stm32f4xx_flash.c stm32f4xx_pwr.c '' SYSTEM_SRCS=''stm32f4xx_it.c '' STARTUP_SRCS=''startup_stm32f4xx.s'' Makefile for KEIL BuildMode : real_time MODELREF_TARGET_TYPE=NONE SIMULATION_MODE_RP=NO_PIL MAKEFILEBUILDER_TGT=0 STANDALONE_SUPPRESS_EXE=0 Startup file: startup_stm32f4xx.o Startup path: ''D:\PROGRA~1\STMICR~1\STM32F~1\STM32F~1''\lib\CMSIS\Device\ST\STM32F4xx\Source\Templates\arm
Start compile .c source main.c
''main.c'', line 76: Error: 20: identifier ''TRUE'' is undefined OverrunFlags[0] = TRUE; ^ ''main.c'', line 84: Error: 20: identifier ''FALSE'' is undefined OverrunFlags[0] = FALSE; ^ main.c: 0 warnings, 2 errors gmake: *** [main.o] Error 1
I think the problem is caused by
/* Logical type definitions */
if
(!defined
(__cplusplus))ifndef
falsedefine
false (0U)endif
ifndef
truedefine
true (1U)endif
endif
in file
rtwtypes.h , but I can't figure it out.
So is thereany configuration I have missing ?
At the same time ,I've tried a thrid-party demo provided by Waijung14_03a and it works well.
Please help me . Thanks. stm32-mat/target-matlab-stm32f42014-05-06 01:16 AM
Hey zhao,
i haven't had any luck with the STM32-Mat/Target and Matlab R2014a (same error message as yours). My solution was to simply use R2013b instead. Don't forget to change the system target file to something else and then back to stm32fxxx.tlc in the Code Generation options, then set up the toolchain and check the ''download application'' button. CTRL+B should then produce the code, compile it and automatically download it. Good luck2014-05-06 08:18 PM
Great thanks, I've changed to Matlab2013b and the problem fixed itself .
thank you again, leuser!2014-05-13 06:41 AM
Is it now possible to use the blockset in Matlab2014a or not?
It would be greatful if you could answer me that question!!Thanks, Markus2014-05-13 11:52 PM
hello markus,
so far i haven't seen any statement from st regarding the r2014 problems a lot of people seem to have. although in my [DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Discovery/STM32F4%20Discovery%20PIL%20Fails&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F&TopicsView=https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/AllItems.aspx¤tviews=0]other topic i was told that there will be a new release with bugfixes. hopefully that one will work in 2014a. from experience i would say it is not possible to work with the ST blocksets in R2014a right now. you might contact ST support and have someone take a closer look and maybe find some hacks to make it work. if you need to work productively with it right now, use R2013b or earlier. regards marc2014-05-14 09:28 AM
Hallo Marc,
thanks for answering my question. I would like to ask you guys on further question:I hthink an implementation of a DAC is missing! Is that right?So is there any other possibility to log the internal data of the controller?Otherwise, how can I verify e.g. my encoder is working in a right manner?Thanks for your answers....Markus2014-06-04 05:07 AM
Hi
This problem is being caused by an error in one of the headers that MATLAB generates, it declares TRUE and FALSE but not in all caps ( see ''rtwtypes.h''). To fix this add a header file in the Configuration Parameters (Code Generation > Custom Code > Header file) that declares TRUE and FALSE correctly as follows:#ifndef __RTWTYPES_H__P
#define __RTWTYPES_H__P/* Logical type definitions *///#if (!defined(__cplusplus))# ifndef FALSE# define FALSE (0U)# endif# ifndef TRUE# define TRUE (1U)# endif//#endif#endif __RTWTYPES_H__PMake sure you don't store this file in the same folder as the code gets generated since it will get deleted when compiling. I created another folder and included it like so:#include <E:\MATLAB\STM32-MAT\STM32F4xx\STM32F4xxdemos\CodeGeneration\CustomHeaders\rtwtypescaps.h>
It is not the most elegant method, but it should do until it gets fixed.RegardsPieter2014-06-06 03:04 PM
wow.. Its working.. MATLAB should fix this bug. Thank You so much.