5.0 | 4 ratings Rate this file 240 Downloads (last 30 days) File Size: 15.1 KB File ID: #43093 Version: 1.4
image thumbnail

Embedded Coder Support Package for STMicroelectronics STM32F4-Discovery Board



06 Sep 2013 (Updated )

Generate code optimized for STM32F4-Discovery board

| Watch this File

File Information

Installer file for Embedded Coder Support Package for STMicroelectronics STM32F4-Discovery Board. For more details on capabilities for this support package, please visit:

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


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

Required Products Simulink Coder
Embedded Coder
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 (30)
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

'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

'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)


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

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

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:


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

Contact us