Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

5.0
5.0 | 5 ratings Rate this file 182 Downloads (last 30 days) File Size: 15.1 KB File ID: #43093 Version: 1.5
image thumbnail

Embedded Coder Support Package for STMicroelectronics STM32F4-Discovery Board

by

 

06 Sep 2013 (Updated )

Generate code optimized for STM32F4-Discovery board.

| Watch this File

File Information
Description

Installer file for Embedded Coder Support Package for STMicroelectronics STM32F4-Discovery Board. For more details on capabilities for this support package, please visit:
www.mathworks.com/hardware-support/st-discovery-board.html
Opening the .mlpkginstall file from your operating system or from within MATLAB will initiate the installation process for this Hardware Support Package and acquire the latest support package available for the release you have.
This .mlpkginstall file is functional for R2013b and beyond.
    
**Feature highlights for new releases are shown in 'Updates' section at bottom of this page**

Acknowledgements

This file inspired Stm32 F4 Discovery Board Programming With Embedded Coder.

Required Products Simulink Coder
Embedded Coder
Simulink
MATLAB Coder
MATLAB
MATLAB release MATLAB 8.2 (R2013b)
MATLAB Search Path
/
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (37)
01 Jul 2016 MathWorks Embedded Coder Team

The 3rd party tools related STM32F4-Discovery support package are changed and corresponding checksum is failing. So, the installation is failing.
We have updated the check for 3rd party tools and should soon get published which will enable installing of STM32F4-Discovery support package.

Comment only
29 Jun 2016 Hamed Hmd

i can't install please help

https://www.mathworks.com/matlabcentral/answers/292998-error-when-installing-stm32f4-discoverry-hardware-package

Comment only
20 Jun 2016 khelil

khelil (view profile)

Hello dear
I'm tiring to use simulink with STM32F4-Discovery Board.
So I started with some tutorials and examples and I build 'stm32f4discovery_led4' example project.
Out of my expectation, it occurs error and I couldn't find the solution
here are the build messages.
### Generating code into build folder: C:\Users\khelil\Documents\MATLAB\stm32f4discovery_led4_ert_rtw
### Invoking Target Language Compiler on stm32f4discovery_led4.rtw
### Using System Target File: C:\Program Files\MATLAB\R2014a\rtw\c\ert\ert.tlc
### Loading TLC function libraries
### Initial pass through model to cache user defined code
### Caching model source code ...........

TLC Compiler encountered an OUT_OF_MEMORY condition. Attempting to clean up... Error: File: C:\Program Files\MATLAB\R2014a\rtw\c\tlc\mw\formatwide.tlc Line: 37 Column: 2 The %function directive on this line has no matching %endfunction directive Main program: ==> [00] C:\Program Files\MATLAB\R2014a\rtw\c\tlc\mw\formatwide.tlc:<NONE>(230) Error: File: C:\Program Files\MATLAB\R2014a\rtw\c\tlc\mw\formatwide.tlc Line: 18 Column: 1 The %if directive on this line has no matching %endif directive Main program: ==> [00] C:\Program Files\MATLAB\R2014a\rtw\c\tlc\mw\formatwide.tlc:<NONE>(230)

### Build procedure for model: 'stm32f4discovery_led4' aborted due to an error.

Fatal error in slbuild
Component: Simulink | Category: Model error

thank you for your help
best regards

Comment only
17 Jun 2016 Raghavendra Kandur

Hi,
The Embedded Coder Support Package for STM32F4-Discovery Board support 'STM32F4-Discovery' board with STM32F407VG processors.
The STM32F429i-Disco board doesn't work with the support package.

Comment only
16 Apr 2016 Adriano  
15 Apr 2016 abdel ghany

Dear all,

in STlink mode or serial mode, I have a "timeout" problem:

### Preparing to start PIL block simulation: stm32f4discovery_pil_block/Controller1 ...
### Connectivity configuration for "C:\Users\dell\Downloads\Controller_ert_rtw": STM32F4-Discovery (ST-LINK) ###
### Starting application: Controller_ert_rtw\pil\Controller.elf
### Started new OpenOCD process with PID 8008.
### Terminated OpenOCD process with PID 8008.

Error in 'stm32f4discovery_pil_block/Controller1/Controller_sfcn' while executing C MEX S-function 'Controller_pbs', (mdlStart), at time 0.0.

Timed out waiting for an event on the socket.

Is the STM32F429i compatible avec the proposed embbeded software or note?

thank you for your help.

Comment only
15 Apr 2016 abdel ghany

Dear all,

I have problem with PIL.

### Preparing to start PIL block simulation: stm32f4discovery_pil_block/Controller1 ...
### Connectivity configuration for "C:\Users\dell\Downloads\Controller_ert_rtw": STM32F4-Discovery (Serial) ###
### Starting application: Controller_ert_rtw\pil\Controller.elf
### Started new OpenOCD process with PID 11088.
### Terminated OpenOCD process with PID 11088.

The timeout of 10 seconds for receiving data from the rtiostream interface has been exceeded. There might be multiple reasons for this failure.
You should:

(a) Check that the target hardware configuration is correct, for example, check that the byte ordering is correct.
(b) Confirm that the target is running.
(c) Consider the possibility of application run-time failures (e.g. divide by zero exceptions, incorrect custom code integration, etc.).

If you cannot find a solution, consider using the method setTimeoutRecvSecs of rtw.connectivity.RtIOStreamHostCommunicator to increase the timeout value.
Component: Simulink | Category: Model error

I use STM32F429i with openOCD (0.9.0) renamed 0.6.1 to be used by the embbeded developed coder.

I on't know if the problem is just a programming time who exeeds 10s or if it's an uncompatibility between soft and board.

Comment only
29 Dec 2015 Raghavendra Kandur

Hi Shailesh, There is difference in folder architectures between CMSIS 4.5 and CMSIS 4.2 versions due to which the build is failing.
Please download unzip CMSIS 4.2 version from https://silver.arm.com/browse/CMSIS to a folder. The site requires login information.
Run the command 'targetupdater' in MATLAB command window and follow the steps specified in http://in.mathworks.com/help/supportpkg/armcortexm/ug/install-support-for-arm-cortex-m-processors.html

Comment only
26 Dec 2015 Shailesh Joshi

Hi, I am getting following error while building:
In file included from C:/MATLAB/SupportPackages/R2015a/armcortexm/toolbox/target/supportpackages/arm_cortex_m/cmsis_rtos_rtx/src/cmsis_rtos_init.c:8:0:
C:/MATLAB/SupportPackages/R2015a/armcortexm/toolbox/target/supportpackages/arm_cortex_m/cmsis_rtos_rtx/include/mw_cmsis_rtos.h:6:22: fatal error: cmsis_os.h: No such file or directory
#include "cmsis_os.h"
^
compilation terminated.
gmake: *** [cmsis_rtos_init.o] Error 1

C:\Users\Shail\Documents\MATLAB\stm32f4discovery_gettingstarted_ert_rtw>echo The make command returned an error of 2
The make command returned an error of 2

C:\Users\Shail\Documents\MATLAB\stm32f4discovery_gettingstarted_ert_rtw>An_error_occurred_during_the_call_to_make
'An_error_occurred_during_the_call_to_make' is not recognized as an internal or external command,
operable program or batch file.

Is because I am using the latest version of CMSIS(4.5) and the recommended version is CMSIS -4.2 ? How do I solve this?

Comment only
30 Sep 2015 Youssef EL ALAOUI

Hi Team,

I'm using the STM32F429IDiscovery board I followed all the step including Support package installation and everything, while trying to test the Push Button Led example into Simulink's library it show that the model has been compiled and successfully loaded into the Board but nothing happens, is there any specific Support Package for the STM32F429 ? if yes how to get it?
It's urgent! Thanks.

Comment only
17 Sep 2015 senthils2k

i run the example Pgm audio equaliser
i got the error below

how can i solve that?
IC:/MATLAB/SupportPackages/R2015a/stmicroelectronicsstm32f4discovery/toolbox/target/supportpackages/stm32f4discovery/@slCustomizer/../include -IC:/MATLAB/SupportPackages/R2015a/armcortexm/toolbox/target/supportpackages/arm_cortex_m/cmsis_rtos_rtx/include -IC:/MATLAB/SupportPackages/R2015a/STM32F4-Discovery_FW_V1.1.0/Utilities/STM32F4-Discovery -IE:/WIN81/CMSIS-SP-00300-r4p3-00rel0/CMSIS_RTX/INC -IE:/WIN81/CMSIS-SP-00300-r4p3-00rel0/CMSIS_RTX/SRC -o "SysTickScheduler.o" "C:/MATLAB/SupportPackages/R2015a/armcortexm/toolbox/target/supportpackages/arm_cortex_m/scheduler/src/SysTickScheduler.c"
arm-none-eabi-gcc -std=c99 -MD -ffunction-sections -fdata-sections -Wall -c -O0 -mcpu=cortex-m4 -mthumb -mlittle-endian -mthumb-interwork -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -include stm32f4xx.h -DMW_MIC_SAMPLING_FREQ_IN_KHZ=44 -DMW_MIC_FRAME_LENGTH=882 -DMW_MIC_IN_BLOCK_AVAILABLE=1 -DMW_ENABLE_CLOCK_TO_I2S=1 -DMW_I2S_CLOCK_PLLN=271 -DMW_I2S_CLOCK_PLLR=2 -DMW_SPEAKER_FRAME_LENGTH=882 -DMW_AUDIO_OUT_BLOCK_AVAILABLE=1 -DMW_SPEAKER_NUMBER_OF_CHANNELS=1 -DMODEL=stm32f4discovery_parametric_equalizer -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DUSE_STDPERIPH_DRIVER -DUSE_STM32F4_DISCOVERY -DSTM32F4XX -DARM_MATH_CM4=1 -D__FPU_PRESENT=1 -D__FPU_USED=1 -DHSE_VALUE=8000000 -DNULL=0 -D__START=_start -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DOS_ROBIN=0 -DOS_TIMERS=1 -DOS_TIMERPRIO=6 -DOS_TIMERSTKSZ=200 -DRT -DSTACK_SIZE=64 -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DUSE_STDPERIPH_DRIVER -DUSE_STM32F4_DISCOVERY -DSTM32F4XX -DARM_MATH_CM4=1 -D__FPU_PRESENT=1 -D__FPU_USED=1 -DHSE_VALUE=8000000 -DNULL=0 -D__START=_start -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DOS_ROBIN=0 -DOS_TIMERS=1 -DOS_TIMERPRIO=6 -DOS_TIMERSTKSZ=200 -DRT -DSTACK_SIZE=64 -DMODEL=stm32f4discovery_parametric_equalizer -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -IC:/Users/senthil/stm32f4discovery_parametric_equalizer_ert_rtw -IC:/Users/senthil -IC:/MATLAB/SupportPackages/R2015a/stmicroelectronicsstm32f4discovery/toolbox/target/supportpackages/stm32f4discovery/stm32f4discoveryexamples -IE:/WIN81/PROGRA~2/MATLAB/MATLAB~1/R2015a/extern/include -IE:/WIN81/PROGRA~2/MATLAB/MATLAB~1/R2015a/simulink/include -IE:/WIN81/PROGRA~2/MATLAB/MATLAB~1/R2015a/rtw/c/src -IE:/WIN81/PROGRA~2/MATLAB/MATLAB~1/R2015a/rtw/c/src/ext_mode/common -IE:/WIN81/PROGRA~2/MATLAB/MATLAB~1/R2015a/rtw/c/ert -IE:/WIN81/PROGRA~2/MATLAB/MATLAB~1/R2015a/rtw/c/src/ext_mode/serial -IC:/MATLAB/SupportPackages/R2015a/armcortexm/toolbox/target/supportpackages/arm_cortex_m/scheduler/include -IC:/MATLAB/SupportPackages/R2015a/STM32F4-Discovery_FW_V1.1.0/Libraries/CMSIS/ST/STM32F4xx/Include -IE:/WIN81/CMSIS-SP-00300-r4p3-00rel0/CMSIS/Include -IC:/MATLAB/SupportPackages/R2015a/STM32F4-Discovery_FW_V1.1.0/Project/Peripheral_Examples/SysTick -IC:/MATLAB/SupportPackages/R2015a/STM32F4-Discovery_FW_V1.1.0/Libraries/STM32F4xx_StdPeriph_Driver/inc -IC:/MATLAB/SupportPackages/R2015a/stmicroelectronicsstm32f4discovery/toolbox/target/supportpackages/stm32f4discovery/@slCustomizer/../include -IC:/MATLAB/SupportPackages/R2015a/armcortexm/toolbox/target/supportpackages/arm_cortex_m/cmsis_rtos_rtx/include -IC:/MATLAB/SupportPackages/R2015a/STM32F4-Discovery_FW_V1.1.0/Utilities/STM32F4-Discovery -IE:/WIN81/CMSIS-SP-00300-r4p3-00rel0/CMSIS_RTX/INC -IE:/WIN81/CMSIS-SP-00300-r4p3-00rel0/CMSIS_RTX/SRC -o "arm_cortex_m_multitasking.o" "C:/Users/senthil/stm32f4discovery_parametric_equalizer_ert_rtw/arm_cortex_m_multitasking.c"
gmake: *** No rule to make target `E:/WIN81/CMSIS-SP-00300-r4p3-00rel0/CMSIS_RTX/LIB/GCC/libRTX_CM4.a', needed by `../stm32f4discovery_parametric_equalizer.elf'. Stop.

C:\Users\senthil\stm32f4discovery_parametric_equalizer_ert_rtw>echo The make command returned an error of 2
The make command returned an error of 2

C:\Users\senthil\stm32f4discovery_parametric_equalizer_ert_rtw>An_error_occurred_during_the_call_to_make
'An_error_occurred_during_the_call_to_make' is not recognized as an internal or external command,
operable program or batch file.

Comment only
22 Jul 2015 MathWorks Embedded Coder Team

Samir, The Embedded Coder Support Package for STMicroelectronics STM32F4-Discovery Board is available from 2013b. So you cannot get the installation in 2012b.

Comment only
22 Jul 2015 Samir

Samir (view profile)

Hello,

i can not open the installer. I´m using MATLAB 2012b in my computer. How should I install it?

Thanks for your help.

Comment only
26 Jun 2015 MathWorks Embedded Coder Team

Hi Cao,
Did you try to install the HW support package from the download button present on the top right corner of this page?

Comment only
25 Jun 2015 cao vu

cao vu (view profile)

i don't install support package Help me

Comment only
10 Jun 2015 Viacheslav Klimentyev

Thank you! I send e-mail with my model.

Comment only
10 Jun 2015 Raghavendra Kandur

We are not referring to any such libraries in the build process. I am not sure, how this is getting added to the build information of the model. Can you please send your model and the generated code to support@mathworks.in for further investigation.

Comment only
10 Jun 2015 Viacheslav Klimentyev

Yes, I ran this command and downloaded CMSIS 3.20 (like on screen-shot in help). The registration process is OK. But I see still:

gmake: *** No rule to make target `F:/MATLAB/SupportPackages/R2014a/STM32F4-Discovery_FW_V1.1.0/Libraries/CMSIS/Lib/GCC.lib'

What is the library file (GCC.lib) in make? CMSIS doens't content it.

Comment only
08 Jun 2015 Raghavendra Kandur

Please run the following command to open help for CMSIS registration process:

helpview(fullfile(matlabroot, 'help\ecoder\ug\install-support-for-arm-cortex-m-processors_btx8_db-2.html'))

Kindly let me know your feedback.

Comment only
04 Jun 2015 Viacheslav Klimentyev

Raghavendra Kandur, I have got MATLAB 2014a and don't find 'Examples and How to' section and link 'Install Support for ARM Cortex-M Processors'. In late June I will install MATLAB 2015a with all latest support packages. I hope everything will be well.

Thank you!

Comment only
04 Jun 2015 Raghavendra Kandur

Viacheslav Klimentyev, Sorry for the delayed response. The CMSIS package available in STM32F4-Discovery firmware doesn't contain the required library for STM32F4-Discovery support package. Please follow the steps following steps to download and register CMSIS.

1. Run the command 'arm_cortex_m_examples' in MATLAB command window. This opens help for ARM Cortex-M support package.
2. Click on the link 'Install Support for ARM Cortex-M Processors' under 'Examples and How to' section of the page.
3. Follow the steps to download and register CMSIS.
Please let me if you are having any problems.

Comment only
28 May 2015 Viacheslav Klimentyev

Raghavendra Kandur, thanks for your answer.
I updated CMSIS to v. 3.01 and registered it. But now I have next errors and warnings:

1. gmake: *** No rule to make target `F:/MATLAB/SupportPackages/R2014a/STM32F4-Discovery_FW_V1.1.0/Libraries/CMSIS/Lib/GCC.lib', needed by `buildobj'. Stop.
The make command returned an error of 2
"An_error_occurred_during_the_call_to_make"

I think, should be: LIBS = F:/MATLAB/SupportPackages/R2014a/STM32F4-Discovery_FW_V1.1.0/Libraries/CMSIS/Lib/GCC/libarm_cortexM4lf_math.a
as in make for LED example. When I changed this string (choose read-only file property to eleminate overwrite string), I had error:
File I/O error on file 'C:\Users\Slava\Documents\MATLAB\Controller_ert_rtw\Controller.mk'
Operation that caused an error: open

2. Also I have this warning:
[Warning: The following error was caught while executing 'onCleanup' class destructor:
Invalid or deleted object.]
### Build procedure for model: 'Controller' aborted due to an error.

Comment only
28 May 2015 Raghavendra Kandur

Viacheslav Klimentyev, it seems you have not completed the support package installation completely. If you have already installed STM32F4-Discovery support package then follow below steps to complete the installation:
1. In MATLAB command window, run 'targetupdater' command
2. Select 'STMicroelectronics STM32F4-Discovery' in drop-down in popped up GUI
3. Follow the instructions in GUI to download and install CMSIS
4. After successful registration of CMSIS, the error you are reporting should resolve.

Comment only
25 May 2015 Viacheslav Klimentyev

Now I am trying to start PIL simulation, but i have this error:

Error evaluating 'InitFcn' callback of S-Function block (mask) 'stm32f4discovery_pil_block/Controller1/Controller_sfcn'.

An error occurred while calling into the SIL or PIL target connectivity implementation.

Path "$(CMSIS)\CMSIS\Lib\GCC\libarm_cortexM4lf_math.a" specified in the application framework BuildInfo is not an absolute path. To avoid this error, specify only absolute paths when adding files and paths to the application framework BuildInfo.

How can I solve this problem?

Comment only
25 May 2015 Viacheslav Klimentyev

Raghavendra Kandur, thanks! It works!
Yes, after writing a message, I looked the log file and saw that board is not supported (error device ID). I downloaded openocd-0.9.0 and renamed folder and cfg. files, but I did not think to rename .exe.
Thanks again!

Comment only
25 May 2015 Raghavendra Kandur

The openocd-0.6.1 doesn't support stm32f429I-Disco board. For reference, you can open 'mw_openocd_log.txt' file inside <model_name>_ert_rtw folder where openOCD logged a warning saying the stm32f4 board is not detected.

To overcome this issue, you can download newer version of openOCD and follow the below stesps:

1. download openocd from http://www.freddiechopin.info/en/download/category/4-openocd?download=109%3Aopenocd-0.8.0/openocd-0.8.0.7z
2. Unzip the download openocd using 7-zip.
3. Rename the folder unzipped folder to openocd-0.6.1
4. Search for openocd-0.8.0.exe in above folder and rename it to openocd-0.6.1.exe
5. Take a copy of the 'F:\MATLAB\SupportPackages\R2014a\openocd-0.6.1'
5. Replace 'F:\MATLAB\SupportPackages\R2014a\openocd-0.6.1' folder with the newly renamed folder and should work.

Please note, The Embedded Coder Support Package for STM32F4-Discovery Board supports only STM32F4-Discovery (STM32F407VG processor) board. There could be incompatibilities with peripheral blocks with STM32F429I-DISCO (STM32F429ZI processor) board. Please use the support package at your own risk.

Comment only
19 May 2015 Viacheslav Klimentyev

MathWorks Embedded Coder Team, thanks for your answer! I installed these products and work with them.
Addition: STM32F429-Discovery can work with Embedded Coder without STM32-MAT/TARGET. I generate .hex from Simulink and Embedded Coder and load it into my device by STM32 ST-LINK. But now I want to work with PIL. I'm trying to load the program using Simulink (call openOCD).

Log from Simulink (after compiling and generating .hex):
### Launching openOCD server F:\MATLAB\SupportPackages\R2014a\openocd-0.6.1/bin/openocd-0.6.1.exe -f board/stm32f4discovery.cfg: Success
### Open telnet port for communction with openOCD server.
### Reset and halt the processor.
### Erase flash sectors.
### Download the executable ../stm32f4discovery_led.hex: Success
### Reset and run the board.
### Close the server.
"### Done invoking postbuild tool."
### Successful completion of build procedure for model: stm32f4discovery_led

Program on microcontoller doesn't work. I am connecting to STM by ST-LINK, reading memory and seeing empty memory.
Win7 64bit, Matlab 2014a 64 bit.

Comment only
01 May 2015 Tomas Tourikis

Very easy way to get set up and running on hardware. I was able to install the TSP quickly and get the demos up and running in no time.

01 May 2015 MathWorks Embedded Coder Team

Currently, only STM32F4-Discovery board is supported by MathWorks. MathWorks consulting services can be employed for customizations.

However, additional STM32 device support from Simulink and Embedded Coder is available with the STM32-MAT/TARGET by STMicroelectronics.

STM32-MAT/Target uses a flexible approach for supporting devices using an abstraction layer (HAL) output from their STM32CubeMX software.

For more information please see here:
http://www.st.com/web/en/catalog/tools/PF258513

Comment only
22 Apr 2015 Viacheslav Klimentyev

I have STM32F429-Discovery with CPU Clock = 180 MHz. Do I understand correctly that I can't choose CPU Clock = 168 MHz in Coder Target? Can my board work with Matlab?

Comment only
20 Apr 2015 Antonin

Antonin (view profile)

New video on how to program the STM32F4-Discovery board:

http://www.mathworks.com/matlabcentral/fileexchange/50373-stm32f4-discovery-board-programming-with-embedded-coder

Comment only
20 Apr 2015 Antonin

Antonin (view profile)

R2015a is out, check out the CMSIS-RTOS RTX support for the STM32F4-Discovery board.

Comment only
12 Jun 2014 Nkosingiphile  
14 May 2014 Attila  
12 Dec 2013 Yuhang

Yuhang (view profile)

 
28 Oct 2013 Murat Belge

Evgeniy: The STM32F4-Discovery board is only supported for R2013b or later.

Comment only
06 Oct 2013 Evgeniy Gurylev

Do you have target for R2013b release only?

Comment only
Updates
07 Oct 2013 1.2

-replaced .mlpkginstall file, was incorrect one
- minor text changes in description

17 Jan 2014 1.3

no change - upgrading hardware support package download action

01 May 2015 1.4

R2015a New Features: Support for CMSIS-RTOS RTX

22 Mar 2016 1.5

In R2016a, the hardware implementation parameters are enabled by default

08 Jul 2016 1.5

Hi Hamed, the 3rd party tools are now updated and you should be able to install the support package with no issues.

Contact us