Sei sulla pagina 1di 45

Comprehensive workflow for

AUTOSAR Classic & Adaptive


using Model-based Design

Durvesh Kulkarni
Senior Application Engineer
MathWorks India

© 2019 The MathWorks, Inc.


1
Agenda

▪ Introduction to AUTOSAR
▪ Simulink for Classic Platform
– Automatic modeling and code generation
– Simulation of AUTOSAR ECU software
– Blocks for AUTOSAR Library routines
– Importing and exporting AUTOSAR descriptions artifacts (ARXML files)
▪ Simulink for Adaptive Platform
– A closer look at the Adaptive layers
– Motivation for Simulink to support Adaptive
– Mapping Adaptive platform to Simulink
– Code Generation for Adaptive components
▪ Polyspace for AUTOSAR
▪ Additional Resources
2
Agenda

▪ Introduction to AUTOSAR
▪ Simulink for Classic Platform
– Automatic modeling and code generation
– Simulation of AUTOSAR ECU software
– Blocks for AUTOSAR Library routines
– Importing and exporting AUTOSAR descriptions artifacts (ARXML files)
▪ Simulink for Adaptive Platform
– A closer look at the Adaptive layers
– Motivation for Simulink to support Adaptive
– Mapping Adaptive platform to Simulink
– Code Generation for Adaptive components
▪ Polyspace for AUTOSAR
▪ Additional Resources
3
Introduction to AUTOSAR

▪ AUTOSAR – AUTomotive Open Systems Architecture


– Middleware standard, jointly developed by automobile manufacturers, electronics and
software suppliers and tool vendors.
– Motto: “cooperate on standards, compete on implementations”

Attendees

Associate Partners

Development
Partners

Premium
Partners

Core Partners

4
AUTOSAR Platforms
N Non - AUTOSAR
C Classic - AUTOSAR

A Adaptive - AUTOSAR

N
A
N
C
N
A N
C
N
C N
N

Non- AUTOSAR Classic AUTOSAR Adaptive AUTOSAR


Software Application Software Adaptive Application Software

ARA
RTE
Basic Software Services
Basis

Hardware High Performance


Hardware Hardware/Virtual Machine 5
A new platform for compute intensive applications

Infotainment Platform
GENIVI members
Audiobuild and integrate compliant products, and
their differentiating features, tools, services

Audio Graphics Multimedia Speech

CE- device External Connectivity Positioning


Access
Package Personal
Management Networking Security
Information
Management

System Architecture
Linux operating system, drivers and libraries
x86 or ARM-based processor

Real time High, Mid, Low,


Requirements in the range of micro-sec in the range of milli-sec in the range of sec

Computing Low, High, High,


power ~ 1000 MIPs > 20,000 MIPs ~ 10,000 MIPs

MIPs: Million Instructions per Second Source: AUTOSAR Adaptive Platform Joint Meeting May 2017 6
AUTOSAR Support Transition AUTOSAR Blockset

▪ R2018b and earlier ▪ R2019a and later

AUTOSAR Support AUTOSAR


Package Blockset
Embedded Coder** Embedded
Embedded Coder**
Coder**
Simulink* Simulink*

Required Required for sim Required for code

*Requires MATLAB
**Requires MATLAB Coder and Simulink Coder
7
Agenda

▪ Introduction to AUTOSAR
▪ Simulink for Classic Platform
– Automatic modeling and code generation
– Simulation of AUTOSAR ECU software
– Blocks for AUTOSAR Library routines
– Importing and exporting AUTOSAR descriptions artifacts (ARXML files)
▪ Simulink for Adaptive Platform
– A closer look at the Adaptive layers
– Motivation for Simulink to support Adaptive
– Mapping Adaptive platform to Simulink
– Code Generation for Adaptive components
▪ Additional Resources

8
AUTOSAR Support from Embedded Coder and Simulink
Authoring Tools Software Architecture Definition

Application Layer Behavior


AUTOSAR Software AUTOSAR Software ………. AUTOSAR Software Modeling
Component 1 Component 2 Component n & Code
Generation

Run Time Environment (RTE)


BSW Configuration
Modeling and & RTE Generation
Simulation
Basic Software
Basic SW Providers
ECU Abstraction Layer
Complex Device
Services Layer
Basic Software Drivers

Microcontroller Abstraction Layer

ECU Hardware

9
Automatic modeling and code generation

▪ Show quick start demo, edit in code perspective UI and AUTOSAR dict,
code gen

10
Functional simulation of AUTOSAR basic software is critical
for AUTOSAR ECU development

AUTOSAR ECU
layered architecture Many calls between application software and basic
software
Application Software

RTE Basic software functionality is highly dynamic

Basic Software

Simulation of basic software reduces development


time and improves software quality

11
Basic software library makes functional simulation of
AUTOSAR basic software as easy as pressing the play
button

Encapsulated in

Basic Software Library


Detailed Specifications
12
Simulation of AUTOSAR ECU software

▪ Seat Belt Reminder demo

13
AUTOSAR Library Routines

14
Importing and exporting AUTOSAR descriptions (ARXML files)
SW-C
Description

Export ARXML Import/Update

AUTOSAR
SIL/PIL Test

SW-C
Embedded
Coder
Simulink and AUTOSAR Blockset

Round Tripping

SW-C
Embedded
Description
Coder

AUTOSAR
SW-C

Import/Update Export ARXML

15
Import AUTOSAR XML to Simulink

Import AUTOSAR Component to Simulink

ThrottlePositionControlComposition.arxml
16
AUTOSAR Software Components

ApplicationSW SensorActuatorSW ParameterSW ServiceProxySW


Component Type
Application Software
Component Type Component Type Component Type

NvBlockSW
Component Type RTE

ECUAbstractionSW ComplexDeviceDrive
ServicesSW
Component Type rSW Component
Component Type
Type

Basic Software

17
AUTOSAR Composition-Software-Component

▪ Compositions purely
architectural element
Composition Component
– Do not impact how
components interact with
Composition Component
RTE, and code

ComplexDevice
DriverSwComponent
Type

ApplicationSw SensorActuatorSw ApplicationSw


ComponentType ComponentType ComponentType

Composition component ➔ Hierarchical aggregation of software components


18
19
Agenda

▪ Introduction to AUTOSAR
▪ Simulink for Classic Platform
– Automatic modeling and code generation
– Simulation of AUTOSAR ECU software
– Blocks for AUTOSAR Library routines
– Importing and exporting AUTOSAR descriptions artifacts (ARXML files)
▪ Simulink for Adaptive Platform
– A closer look at the Adaptive layers
– Motivation for Simulink to support Adaptive
– Mapping Adaptive platform to Simulink
– Code Generation for Adaptive components
▪ Polyspace for AUTOSAR
▪ Additional Resources
20
AUTOSAR Layered software architecture

Adaptive Adaptive Adaptive Adaptive


Application Application Application Application Components
(SW-C) (SW-C) (SW-C) (SW-C)

AUTOSAR Run-time for Adaptive (ARA)


Run-time
API API API Service Service

Execution Communication S/W CM Diagnostics


Basic
OS
Services
Adaptive AUTOSAR Services

Adaptive AUTOSAR Foundation

High Performance Hardware/Virtual Machine Hardware

21
Key Concept #1
Everything is a process .. as in “OS process”
OS Process #1 OS Process #2 OS Process #3 OS Process #4

Adaptive Adaptive Adaptive Adaptive


Application Application Application Application
(SW-C) (SW-C) (SW-C) (SW-C)

AUTOSAR Run-time for Adaptive (ARA)

API API API

Provides Execution Communication


multi-process OS
capability (POSIX
Compliant)

Notes: Each OS Process


- Corresponds to main() in C/C++ code
- Has own memory space & namespace
- Can be single or multi-threaded
22
Key Concept #1
Everything is a process .. as in “OS process”
OS Process #1 OS Process #2 OS Process #3 OS Process #4

Adaptive Adaptive Adaptive Adaptive


Application Application Application Application
(SW-C) (SW-C) (SW-C) (SW-C)

AUTOSAR Run-time for Adaptive (ARA)

API API API

Provides Execution Communication


multi-process OS
capability (POSIX Inter-Process
Compliant) Communication

Process life-cycle
Process scheduling management.

23
Key Concept #2
Service-oriented inter-process communication
Linux Machine 1 Linux Machine 2

IPC IPC IPC IPC

Process Process Process Process Process Process

IPC Network

24
Key Concept #2
Service-oriented communication
▪ Service Interface can contain <<interface example>>
RadarService

– Methods (Functions) • result = Calibrate(config)


• [success, out_pos] = Adjust(in_pos)

– Events (Messages)
• BrakeEvent

– Fields (Data)
• UpdateRate

25
Key Concept #3: Everything is C++

Adaptive Application Adaptive Application Adaptive Application Adaptive Application ASW::XYZ ASW::ABC
Non-PF Service Non-PF Service

User Applications

AUTOSAR Run-time for Adaptive (ARA)


* ara::com
Communication Mgnt.
ara::rest
RESTful
ara::tsync
Time Synchronization
ara::sm service
State
ara::diag service
Diagnostics
Management
SOME/IP

ara::phm
(local)

ara::per
DDS
IPC

Persistency Platform Health Mgnt.


ara::s2s service ara::nm service
Signal to Service Mapping Network
Management
ara::core ara::exec ara::iam ara::log
Core Types Execution Mgnt. Identity Access Mgnt. Logging & Tracing

POSIX PSE51 / C++ STL ara::crypto ara::ucm service


Operating System Cryptography Update and Configuration Management

High Performance Hardware/Virtual Machine

26
Motivation for Simulink to support Adaptive

▪ Simulink is heavily used for AUTOSAR Classic


▪ Customers have requested Simulink support for Adaptive platform

▪ Simulink supports service oriented modelling


▪ Embedded Coder generates C and C++ code

▪ MathWorks participates in the AUTOSAR standard development, including


both Classic and Adaptive platforms

27
Adaptive SW Architecture Concepts

RequiredPort Adaptive ProvidedPort


Application

Service Interface "Radar" : {


// events
"event" : {
“brakeEvent"
"parkingBrakeEvent"
},
// methods
"method" : {
"Calibrate"
"Adjust"
},
// fields
"field" : {
“updateRate"
}
}

28
Mapping AUTOSAR AP Concepts to
Simulink

Adaptive
Application
RequiredPort

"Radar" : {
// events
"event" : {
“brakeEvent"
"parkingBrakeEvent"
},
// methods
"method" : {
"Calibrate"
"Adjust"
},
// fields
"field" : {
“updateRate"
}
}

29
Mapping AUTOSAR AP Concepts to Simulink

Adaptive
Application

ProvidedPort
"Radar" : {
// events
"event" : {
“brakeEvent"
"parkingBrakeEvent"
},
// methods
"method" : {
"Calibrate"
"Adjust"
},
// fields
"field" : {
“updateRate"
}
}

30
Generate Production AUTOSAR Adaptive C++ Code

Out-of-box AUTOSAR support


1. Configure Model
main.cpp <model>.cpp
✓ Target
*.hpp *.cpp ✓ AUTOSAR Dictionary
*.arxml 2. Generate C++ code

31
Develop Adaptive AUTOSAR Components

▪ autosar_LaneGuidance shipping demo

32
Agenda

▪ Introduction to AUTOSAR
▪ Simulink for Classic Platform
– Automatic modeling and code generation
– Simulation of AUTOSAR ECU software
– Blocks for AUTOSAR Library routines
– Importing and exporting AUTOSAR descriptions artifacts (ARXML files)
▪ Simulink for Adaptive Platform
– A closer look at the Adaptive layers
– Motivation for Simulink to support Adaptive
– Mapping Adaptive platform to Simulink
– Code Generation for Adaptive components
▪ Polyspace for AUTOSAR
▪ Additional Resources
33
Polyspace for AUTOSAR

34
What if…?

▪ The communication between the software architect and developer is made


easy
▪ An easy setup process for verification
▪ Setup only needs the ARXML and code implementations
▪ And also check for the Run-Time errors in the code

Check if…
▪ Implementation of Software Components Follow Specifications
▪ Edits to Specifications Impact
▪ Implementation for Run-time Errors and Mismatch with Specifications
▪ Implementation Against Specification Update

35
ARXML
Polyspace and AUTOSAR
ARXML provides
specification
of Application Layer Polyspace verifies
and link with RTE the match between
code and ARXML
AUTOSAR architecture

Application Layer Polyspace verifies the Application Layer

Polyspace stubs the RTE Layer


RTE RTE Layer not verified by “Polyspace for AUTOSAR”

ECU Abstraction Layer Complex


Services
Layer Basic Software Device
Drivers
Not verified by “Polyspace for AUTOSAR”
Microcontroller Abstraction Layer

ECU Hardware

36
Polyspace for AUTOSAR(R2018a)

New checks to prove New view to detail the


Use Polyspace to perform a sound unit that the code matches AUTOSAR specification

static analysis of the components of an the specification

AUTOSAR software

swcA.c
swcA.h

swcB.c

ARXML

polyspace-autosar

SW-C1 SW-C2 SW-C3

Polyspace code prover


37
Polyspace for AUTOSAR: How do I launch from UI?

38
Polyspace for AUTOSAR

▪ Verify ARXML against Code Demo

39
Polyspace checks AUTOSAR C++14 Rules

https://www.autosar.org/fileadmin/user_upload/standards/adaptive/17-03/AUTOSAR_RS_CPP14Guidelines.pdf -autosar-cpp14 40
Benefits of using Polyspace for AUTOSAR

• Polyspace automatically modularizes analysis based on AUTOSAR components


• Polyspace detects mismatch between code and AUTOSAR XML spec
• AUTOSAR runnable not implemented
• Invalid result of AUTOSAR runnable implementation
• Invalid use of AUTOSAR runtime environment function
• Prove absence of certain types of run-time errors in runnables (e.g. OverFlow,
divByZero)

41
Summary

AUTOSAR Blockset :
▪ Model AUTOSAR Classic and Adaptive
software components
▪ Simulate AUTOSAR compositions and ECUs
▪ Generate optimized AUTOSAR C/C++ code,
roundtrip ARXML, and perform SIL and PIL
verification (requires Embedded Coder®)
▪ Is well-suited for applications involving
embedded production deployment
▪ Is key part of Model-Based Design by providing
detailed specification of embedded software

43
AUTOSAR Support Transition AUTOSAR Blockset

▪ R2018b and earlier ▪ R2019a and later

AUTOSAR Support
Package
AUTOSAR
Embedded Coder** Blockset Embedded
Embedded Coder**
Coder**
Simulink* Simulink*

Required Required for sim Required for code

*Requires MATLAB
**Requires MATLAB Coder and Simulink Coder
44
User Articles/Presentations

▪ BMW - Model-Based Software Development:


And OEM's Perspective

▪ FCA Global Powertrain Controls - Leveraging


MBD, auto-code generation and AUTOSAR to
architect and implement an Engine Control
Application for series production

▪ LG Chem - Developing AUTOSAR and ISO


26262 Compliant Software for a Hybrid Vehicle
Battery Management System with Model-Based
Design

▪ John Deere - Vertical AUTOSAR System


Development at John Deere
45
To learn more, please visit AUTOSAR Blockset page

Come see us at our demo booth


AUTOSAR

Simulink
for Classic
and
Adaptive
Platform

46

Potrebbero piacerti anche