cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with stm32f4 discovery & stm32-mat/target

zhjize
Associate
Posted on May 06, 2014 at 08:13

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 the

BlinkBlueLed

demo and building it , itcame as:

Build

http://localhost:31415/toolbox/simulink/simulink/slmsgviewer/release/slmsgviewer/dojo/resources/blank.gif

1

1:20:55 PM 5/6/2014

Elapsed: 6 sec

http://localhost:31415/toolbox/simulink/simulink/slmsgviewer/release/slmsgviewer/dojo/resources/blank.gif

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;

http://localhost:31415/toolbox/simulink/simulink/slmsgviewer/release/slmsgviewer/dojo/resources/blank.gif

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

false

define

false (0U)

endif

ifndef

true

define

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-stm32f4

7 REPLIES 7
marc2
Associate II
Posted on May 06, 2014 at 10:16

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 luck

zhjize
Associate
Posted on May 07, 2014 at 05:18

Great thanks, I've changed to Matlab2013b and the problem fixed itself .

thank you again, leuser!

markus239955_st
Associate
Posted on May 13, 2014 at 15:41

Is it now possible to use the blockset in Matlab2014a or not?

It would be greatful if you could answer me that question!!

Thanks, Markus

marc2
Associate II
Posted on May 14, 2014 at 08:52

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&currentviews=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

marc

markus239955_st
Associate
Posted on May 14, 2014 at 18:28

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....

Markus

pieterblurt
Associate
Posted on June 04, 2014 at 14:07

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__P

Make 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.

Regards

Pieter
laxmimerit
Associate II
Posted on June 07, 2014 at 00:04

wow.. Its working.. MATLAB should fix this bug. Thank You so much.