Simulink To Stm32

Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

Simulink to STM32

Jean-Baptiste Lanfrey, Senior Application Engineer

© 2014 The MathWorks, Inc.1


Model-Based Design

RESEARCH REQUIREMENTS

DESIGN Design as Executable Specification

Environment Models

TEST AND VERIFICATION


Physical Components Requirements Traceability
Algorithms

Continuous and early Verification


IMPLEMENTATION

VHDL, Structured
C, C++
Verilog Text

MCU DSP FPGA ASIC PLC


Document and Report Generation

INTEGRATION

2
Model-Based Design

RESEARCH REQUIREMENTS

DESIGN Design as Executable Specification

Environment Models

TEST AND VERIFICATION


Physical Components Requirements Traceability
Algorithms

Continuous and early Verification


IMPLEMENTATION

VHDL, Structured
C, C++
Verilog Text

MCU DSP FPGA ASIC PLC


Document and Report Generation

INTEGRATION

3
DEMO

4
Coder Technology

Simulin C Code
k

C++ Code
Unified Code
Generation HDL Code
Stateflo
w
PLC Code

MATLAB

5
Hardware Support Packages are…

• Downloadable add-ons that provide hardware support


• Often updated independent of the product release cycle

• Used by Simulink and Embedded Coder to deliver targets

6
What does a TARGET do?

1. Optimizes generated code


/* S-Function (sdspsine2): '<Root>/Sine Wave' */
updateVal = rtb_SineWave[j] =
ex_fircmsis_tut_mab2013_P.SineWave_Amplitude *
2. Automates the build process arm_sin_f32(ex_fircmsis_tut_mab2013_DW.SineWave
_AccFreqNorm);
– Generated Makefile
– Compile > Link > Download >
Execute

3. Verifies algorithms on
hardware with real-time,
real-world data

4. Deploys full systems as


standalone applications
– RTOS, Multi-core threads,
Device drivers

7
Simulink Targets
- for Educational Purposes

as of June 2014

User Downloads
(R2012a – R2014a)

Arduino 11,281
LEGO MINDSTORM NXT 3,727
Raspberry Pi 2,909
BeagleBoard 753
LEGO MINDSTORM EV3 202
Samsung Galaxy (Android) 164
PandaBoard 135
Gumstix Overo 63
Total 19,234

Simulink Targets do not require Coder products

8
Embedded Coder Targets
- for Prototyping and Deployment

as of June 2014

User Downloads
(R2013a – R2014a)

Texas Instruments C2000 645


ARM Cortex-M 548
Xilinx Zynq-7000 350
ST Microelectronics F4 Discovery 243
ARM Cortex-A 141
Texas Instruments C6000 83
Analog Devices DSP 81
Green Hills MULTI 52
Wind River VxWorks 34
Total 2,177

Documented APIs available for building custom targets

9
STM32 Support Package

www.st.com/stm32-mat-target
10
DEMO

11
Benefit of using the STM32 Support Package

 quickly deploy your application models in MATLAB and


Simulink to STM32 MCUs

 Automate
– the process from "C" code generation to programming STM32
F4 or STM32F30x
– Code generation reporting
– Code execution profiling reporting for PIL execution

12
Summary for STM32 embedded target for
MATLAB and Simulink release 3.1:
 Supported MCUs: STM32 F4
and F30x series

 Automated Processor-in-the-
Loop (PIL) Testing using
USART communication link

 Support for
– IAR EWARM
– Atollic TrueSTUDIO
– Keil MDK-ARM

 Peripheral driver blockset


including ADCs, GPIOs,
USARTs, and Timers

13
DEMO

14
Processor-in-the-Loop (PIL)
Verify compiled object code matches simulation

Communication
Gateway

Non-real-time execution:
synchronized with simulation
• Verify numerical equivalence
• Assess execution time
• Collect code coverage
• Create certification artifacts

• Software-In-the-Loop (SIL) can be


leveraged as well

15
Benefit of using the STM32 Support Package

 quickly deploy your application models in MATLAB and


Simulink to STM32 MCUs

 Automate
– the process from "C" code generation to programming STM32
F4 or STM32F30x
– Code generation reporting
– Code execution profiling reporting for PIL execution

16

You might also like