34
1 © 2014 The MathWorks, Inc. As the crow flies Model to Implementation via Automatic Production Code Generation aka SLX2C State-of-the-Art from Model to Embedded Code http://www.mathworks.de/embedded-code-generation/ Michael Fröstl Pilot Engineering, Production Code Generation MathWorks

As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

1 © 2014 The MathWorks, Inc.

As the crow flies – Model to Implementation via

Automatic Production Code Generation

aka SLX2C – State-of-the-Art from Model to Embedded Code

http://www.mathworks.de/embedded-code-generation/

Michael Fröstl

Pilot Engineering, Production Code Generation

MathWorks

Page 2: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

2

switch(braindump)

{

Page 3: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

3

case ‘Applications’:

Page 4: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

4

Sonova’s hearing aid and cochlear

implant solutions.

Van Helvoort (left) and van Bakel with

a Philips Healthcare MRI scanner.

The USS Makin Island.

A Toyota engine.

The IRIS observatory. Alstom Grid’s HVDC demonstrator

system with power converter

modules.

http://www.mathworks.com/company/user_stories

The HB-SIA aircraft on a test

flight over San Francisco Bay.

Photo © Solar Impulse | Revillard | Rezo.ch

The AirSonea device, which

connects to an asthma patient’s

smartphone …

Page 5: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

5

case ‘Programming’:

Page 6: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

6

ASCII MATLAB

C

C++

ASM

IEC 61131-3

Page 7: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

7

case ‘Hardware’:

Page 8: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

8

MCU /

DSP

ARM®

Analog Devices®

Atmel®

Freescale™

Infineon®

Intel®

Microchip®

NXP™ Renesas®

STMicroelectronics®

Texas Instruments™

Xilinx®

Page 9: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

9

case ‘Operating Systems’:

Page 10: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

10

OS

Green Hills® Integrity RTOS

Embedded Linux®

Texas Instruments™ DSP/BIOS™

Wind River® VxWorks®

OSEK-OS

Microsoft® Windows Embedded

QNX® Neutrino® RTOS

Android™

Page 11: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

11

case ‘Standards’:

Page 12: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

12

NORM

AUTOSAR MISRA AC AGC

ISO 26262

IEC 61508

EN 50128

DO-178B/C

Page 13: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

13

default :

printf(“Wrong session?”);

}

Page 14: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

14

MBD_Overview();

Page 15: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

15

TE

ST

& V

ER

IFIC

AT

ION

INTEGRATION

IMPLEMENTATION

ANALYSIS • SPECIFICATION • DESIGN

REQUIREMENT

DOCUMENTS

RESEARCH

ACTIVITIES

Model

Environment

Physical

Components

Algorithms

Architecture

Constraints

FPGA ASIC

Structured

Text VHDL, Verilog C, C++

PLC PAC MCU DSP

Test Cases

Test Cases

Page 16: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

16

TE

ST

& V

ER

IFIC

AT

ION

INTEGRATION

IMPLEMENTATION

ANALYSIS • SPECIFICATION • DESIGN

REQUIREMENT

DOCUMENTS

RESEARCH

ACTIVITIES

Model

Environment

Physical

Components

Algorithms

Architecture

Constraints

FPGA ASIC

Structured

Text VHDL, Verilog C, C++

PLC PAC MCU DSP

Test Cases

Test Cases

Standardkonforme Absicherung mit

Model-Based Design

MATLAB für FPGA Design und ASIC

Prototyping

Rapid Prototyping und HiL-Simulation mit

Simulink Real-Time

Physical Modelling mit Simscape

Mit Polyspace die Qualität des generierten

und handgeschriebenen Codes effektiv

verbessern

Page 17: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

18

switch(topics)

{

Page 18: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

19

case ‘Code Generation – Top 5’:

V with slope and bias encoding scheme: V = 1*Q + 1

V

Page 19: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

22

IP Protection

Page 20: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

23

Password Protected Models

Support options

– Simulation: Allow

Accelerator mode simulation

– Code generation: Include

obfuscated code to support

code generation

– (New in R2013b) Read-only

view: Web view of model

– (New in R2013b) Password

protection: Access protected

by password

Protect design IP for models and

generated code

Page 21: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

24

AUTOSAR Roundtrip

Page 22: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

25

AUTOSAR Roundtrip with Simulink Merge

updateModel method automates

ARXML import and merge

– Simulink model

– Workspace variables

– AUTOSAR configuration

Generates report of changes with

hyperlinks to model

Identifies changes left for user

Update and merge AUTOSAR authoring

tool changes into Simulink models for iterative round-trip workflows

Modellbasierte Entwicklung Eingebetteter

Systeme für AUTOSAR mit der MathWorks-

Toolkette

Page 23: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

26

RAM Optimization

Page 24: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

27

Average Global RAM & Unnecessary Data Copy Reduction

Since R2008b (Using 70+ Industry Models)

Rela

tive to

R2008b

Global RAM Usage

86%

88%

90%

92%

94%

96%

98%

100%

102%

8b 9a 9b 10a 10b 11a 11b 12a 12b 13a 13b

Data Copy Measurement

70.00%

75.00%

80.00%

85.00%

90.00%

95.00%

100.00%

105.00%

8b 9a 9b 10a 10b 11a 11b 12a 12b 13a 13b

Page 25: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

28

Simulink Data Dictionary

Page 26: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

29

Code Generation for Simulink Data

Dictionary

Componentization

Scalability and

performance

Change tracking

and differencing

Integration with

Simulink Projects

Code generation

Manage data outside

of base workspace

Simulink

SLX

File SLX

File

Model 1

Model 2

Model 3

SLX

File

SLDD

File SLDD

File SLDD

File Global Data

Page 27: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

30

case ‘Targets’:

Page 28: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

31 http://www.mathworks.de/hardware-support/home.html

Page 29: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

32 http://www.mathworks.de/services/consulting/areas/developing-embedded-targets.html

Page 30: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

33

case ‘Getting FREEd’:

Page 31: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

34

Embedded Coder Support Package

for Freescale FRDM-KL25Z Board

Integration of the GNU-ARM Toolchain

Automatically:

1. Generates C code

2. Compiles code

3. Loads binary to hardware

Now available via Support Package Installer

Page 32: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

35

“Go Green” – Getting Started

Blink a LED

Create a new Model

Set it up for the Freescale Target

Add Blocks (incl. I/O)

Generate code

Deploy to the hardware

Page 33: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

36

default :

printf(“Brain up-to-date!”);

}

Page 34: As the crow flies Model to Implementation via Automatic ... · As the crow flies – Model to Implementation via Automatic Production Code Generation ... AUTOSAR MISRA AC AGC ISO

37

TE

ST

& V

ER

IFIC

AT

ION

INTEGRATION

IMPLEMENTATION

ANALYSIS • SPECIFICATION • DESIGN

REQUIREMENT

DOCUMENTS

RESEARCH

ACTIVITIES

Model

Environment

Physical

Components

Algorithms

Architecture

Constraints

FPGA ASIC

Structured

Text VHDL, Verilog C, C++

PLC PAC MCU DSP

Test Cases

Test Cases