SlideShare a Scribd company logo
TargetLink 2.2




NEW
 AUTOSAR support

 Extended target simulation and
  optimization support
 Function interfaces with pointers
  to structures
 Multi-edit and merge functionality
  for the Data Dictionary Manager




                                              dSPACE
Target Implementation




  2
2007
2006
Contents



Target Implementation                                                    4

TargetLink for Production Code Generation _____________________________ 4
NEW: Production Code for AUTOSAR ECUs _____________________________ 4
Software Quality ___________________________________________________ 9
Software Verification and Validation __________________________________ 11

Production Code Generation Software                                     14

TargetLink ________________________________________________________ 14
       How Do I Get the TargetLink I Need? ___________________________ 17
       How Do I Work with TargetLink? ______________________________ 19
       TargetLink Block Library for Implementation _____________________ 22
       Three Simulation Modes for Testing ____________________________ 26
       Scaling of Variables _________________________________________ 30
       Proving Test-Efficiency with Code Coverage ____________________ 32
       Incremental Code Generation _________________________________ 33
       Code Optimization _________________________________________ 34
       Automated Document Generation ____________________________ 35
       Customized Code __________________________________________ 36
       Automation and Process Integration ___________________________ 37
       Integration with OSEK/VDX Operating Systems __________________ 38
NEW: Model-Based Design for AUTOSAR Software Components __________ 40
Managing Data with the dSPACE Data Dictionary _______________________ 44
EmbeddedValidator (by OSC Embedded Systems AG) ___________________ 46




                                                                                         3
                                                                                         2007
Target Implementation



                               TargetLink for
                               Production Code Generation

                               More than just a
                               production code generator




       Key Features             Production code generation directly from
                                 MATLAB®/Simulink®/Stateflow®

                                ANSI C code with the efficiency of handwritten code

                                Optimizations for individual processors

                                Built-in simulation and testing

                                NEW: AUTOSAR support (p. 9, p. 40)




       Introduction            High-Quality Code for Mass Production
                               Following successful rapid control prototyping, target implementation is performed.
                               Functions specified in graphical form are converted to production C code and imple-
                               mented on the electronic control unit (ECU) together with the drivers and real-time
                               operating system. Automatic production code generation gives effective support
                               in this process. TargetLink (p. 14), the production code generator from dSPACE,
                               generates production code automatically for graphically specified functions straight
                               from MATLAB®/Simulink®/Stateflow®. This shortens coding and development times
                               drastically and contributes to a considerable improvement in the quality of the
                               production code.

                                TargetLink (p. 14)


                               Criteria for Successful Production Code
                               There are several criteria for the generated code. It must be:
                                Very efficient, whether fixed-point or floating-point
                                Target-optimized if necessary
                                Human-readable
                                Configurable and adaptable to company specific coding styles
                                Easy to integrate with legacy code, base software, and other application
                                  software in existing ECUs




  4
2007
TargetLink


                       �����������������������������������
                            �����������������������������



                          ��������������������������
                                  ���������������������
                      �������           ����������             ����
                      �����              ��������           ����������




                  �������������        ��������
                  ���������������      ����������           �����������




                    �����������         ��������       ������������������
                     ������              ������             ������




                                ���������������������������


                                                     ����




                                      ��������������




Proven Code Generation with TargetLink
TargetLink, the well-established production code generation software from dSPACE,
meets all the criteria for production code generation and helps function and software
developers to get their control strategies from block diagrams to a production-intent
ECU faster and more reliably, without compromising code efficiency.

Excellent Code Performance
Efficiency is the key to production-quality code. It means that a minimum of execu-
tion time, RAM resources, ROM resources, and stack size is required to run the code
on an embedded processor. TargetLink has been specifically designed for produc-
tion-quality code generation and can well match human programmers’ efficiency in
terms of memory consumption and execution speed – without compromising read-
ability. TargetLink meets the high standards for production-quality code generation
through a variety of state-of-the-art technologies. Numerous benchmarks and user
experience reports show that TargetLink code is broadly similar to what the human
programmers produce.




                                                                                                     5
                                                                                                     2007
Target Implementation


                                                        ������                                    ��������
                               ����                                           ����

                               ����                                           ����
                                                                              ����
                               ���
                                                                              ���
                               ���
                                                                              ���
                               ���
                                                                              ���
                               ���                                            ���
                                ��                                             ��
                                             ��������     �����������������            ��������      �����������������
                                ������
                                ����������
                                                    ��������                                      �������
                               ����                                           ����
                               ����                                           ����

                               ���                                            ���

                               ���                                            ���

                               ���                                            ���

                               ���                                            ���

                                ��                                             ��
                                             ��������     �����������������            ��������       �����������������



                                  Benchmark results comparing TargetLink code with handwritten code on different
                                  processors.

                                  Target-Optimized Code
                                  One of TargetLink’s strength lies in its target awareness. This means generating code
                                  for a specific compiler/processor combination and running it on an evaluation board
                                  during simulation. Most common processors for embedded applications, especially
                                  in the automotive field, are supported by TargetLink.

                                  Code Configurable According to Customer Wishes
                                  Production-quality code generation involves more than just efficiency. When code
                                  runs on preconfigured prototyping hardware, it is irrelevant how it looks. But when
                                  code is to be implemented on a production ECU, many of its details become quite
                                  important. The memory layout needs to be managed, there need to be efficient
                                  ways to link to external code, and the code output format must comply with specific
                                  standards. TargetLink‘s code output generation can be highly customized to meet
                                  these needs.




  6
2007
TargetLink



Process Integration
To provide the full benefits of automatic production code generation, the code
generator has to be optimally integrated into the development process and tool
chain, and interact seamlessly with the model-based design tool. Open interfaces
and options for tool automation are useful for connecting with other tools, auto-
mating work steps, and preparing and supporting later development phases such
as unit and module tests.
TargetLink is easy to integrate into existing development environments. All pro-
cesses can be automated via the TargetLink API (application programming interface).
TargetLink comes with a comprehensive data management tool called the dSPACE
Data Dictionary. This is the key aid when data has to be kept independently of models,
and imported to or exported from existing in-house data dictionaries or other file
formats (such as M, MAT, and XLS files). TargetLink can also automatically generate
an ASAM-MCD 2MC (ASAP2) file containing all the information about measurable
and calibratable variables generated by the Code Generator. For implementation
on OSEK/VDX-compliant operating systems, TargetLink generates code according to
the OSEK/VDX OS standard. It is perfectly suited to a seamless devolopment process
for AUTOSAR ECUs.

Integrated Test Environment
One major advantage of using model-based design methods and tools is the ability to
perform early verification by means of simulation. TargetLink supports several different
simulation modes which allow the correctness of an implementation, i.e., the code
generated by TargetLink, to be tested directly. This is done by comparing simulation
results with results from reference simulation. Automated testing with TargetLink is
supported by MTest, the test environment for the control design phase.




                                                                                                       7
                                                                                                       2007
Target Implementation



       Benefits                 Bridging the Gap
                               Automatic production code generation bridges the gap between model-based
                               function design and production software development. It converts each model
                               quickly and reliably into highly efficient production code. The major benefits of
                               using TargetLink for code generation are increased software quality and reduced
                               development time.

                               Improved Quality
                               A code generator can convert an executable specification with a lower implementa-
                               tion error rate than a human programmer. Manual translation, with iterations and
                               frequent changes, is not only time-consuming but also extremely error-prone, and
                               consistency between the software design specification and the code is often lost. This
                               is not the case when code is generated automatically. A code generator translates the
                               model and the changes made to it into code reliably, reproducibly, and consistently,
                               whenever required. It ensures that the generated code is always consistent with the
                               software design. It is also easy to keep the documentation up to date, as this can
                               be generated along with the code. Automatic production code generation keeps
                               software design, implementation, and documentation in sync. And with TargetLink,
                               the automatically generated ASAM-MCD 2MC (ASAP2) file for calibration is always
                               up-to-date and consistent with the model.

                               Reduced Development Time
                               Together, model-based development and automatic code generation cut the time
                               needed for coding. But that is not all: In the iterative process of ECU software
                               development, they also speed up iterations. Moreover, you can implement and try
                               out changes fast, and verify their impact immediately via simulation – once more
                               saving time and avoiding errors. Overall, TargetLink allows you to cope with increasing
                               complexity despite shorter development times, without compromising quality. Our
                               customers routinely generate large parts of their ECU code with TargetLink, and save
                               up to 50% of their total development time for ECU code by doing so.




                                Benefits at a Glance
                                Development times are reduced and quality is enhanced by:
                                 Integrated development process
                                 Reduced coding times
                                 Fewer implementation errors
                                 Quick modifications
                                 Direct verification via simulation
                                 Early error detection
                                 Early testing on target processor
                                 Consistency between model, code, documentation and ASAM-MCD 2MC
                                  (ASAP2) file




  8
2007
TargetLink



NEW: Production Code for AUTOSAR ECUs
AUTOSAR (AUTomotive Open System ARchitecture) is an industry partnership
that aims to establish an open standard for automotive electric/electronic (E/E)
architectures. The standard provides a basic infrastructure for modular and distributed
application code that is platform-independent and reusable.

The AUTOSAR Software Architecture
The AUTOSAR architecture has three main parts:
 AUTOSAR software components (SW-Cs)
 Run-time environment (RTE)
 Basic software


    �������               �������
     ������                ������           ���        ����������������


                ���������������������������������


        ��               ���                ���         ���    ��������������

The three main parts of the software architecture. The actual application code is
contained in the SW-Cs, and this is the part TargetLink generates code for.

Development Process
The methodology proposed by the AUTOSAR initiative shows that future AUTOSAR-
compliant ECU developments will be highly reliant on efficient tool-support and on
seamless development processes with a high degree of automation.
TargetLink plays a vital role in the AUTOSAR-compliant development process, as it
bridges the gap between the model-based design approach and AUTOSAR-com-
pliant code generation. TargetLink specifically supports designing and generating
production code for AUTOSAR software components (SW-C), which constitute the
application code in the AUTOSAR software architecture (p. 40).

Modeling and Simulation
With TargetLink, AUTOSAR‘s structural elements, such as runnables, ports, and
communication interfaces, are specified directly at block diagram level. Besides
modeling and code generation for SW-Cs, TargetLink also lets you simulate the
modeled AUTOSAR software component designs in early phases of the development
process (p. 42).

Implementation
Another feature that makes code generators so useful is the automatic generation
of software component descriptions, which would be tedious to produce manually
and nearly impossible to keep consistent with the models. Software component
descriptions are required by architecture tools, which are used to import and connect
the SW-Cs. TargetLink can generate a consistent software component description
file together with the code (p. 43).
As a whole, TargetLink greatly simplifies the transformation of function models into
AUTOSAR-compliant software components and provides significant benefits for an
AUTOSAR-compliant development process.




                                                                                                       9
                                                                                                       2007
Target Implementation



                               Software Quality
                               As a company committed to software quality, dSPACE applies a variety of methods
                               to ensure the highest standards for its software products.

                               ISO/IEC 15504-Compliant Development Process
                               ISO/IEC 15504 (also known as SPICE1)) is an international standard for software
                               processes. Its underlying concept is that a mature software product requires a mature
                               development process. dSPACE has dedicated itself to an ISO/IEC 15504-compliant
                               development process.

                               Internal Software Quality Management
                               An internal quality department, the dSPACE quality management team, proactively
                               manages software quality at dSPACE. The team leads software improvement activities,
                               sets internal standards, conducts internal assessments, and provides consultation
                               services to all software groups. It acts independently and ensures that the highest
                               product quality goals are consistently achieved and sustained.

                               MISRA C
                               The British MISRA2) C standard is a widely accepted C subset for projects in the
                               automotive industry. Its aim is to define rules for avoiding common software errors
                               that can occur when software engineers write software by hand. Most of these rules
                               also make sense for machine-generated code.
                               TargetLink-generated code respects the vast majority of MISRA C rules. If deviations
                               from the MISRA C standard are a technical necessity, they are identified and well
                               documented. dSPACE makes this document available to all TargetLink customers.

                               Certified Code
                               TargetLink code is in production in numerous applications, some of which are safety-
                               related – for example, the development of avionics systems. TargetLink-generated code
                               was certified according to RTCA3) DO-178B Level A, the highest safety level, meaning
                               that a software failure would have catastrophic consequences for the aircraft.




                               1)
                                    SPICE: Software Process Improvement and Capability Determination
                               2)
                                    MISRA: Motor Industry Software Reliability Association
                               3)
                                    RTCA: Radio Technical Commission for Aeronautics




 10
2007
TargetLink



Software Verification and Validation
Aspects of Testing                                                                        Model-Based Testing
As software grows in complexity, and development cycles speed up, the software that
is produced must be tested as early and as exhaustively as possible. Testing is seen as
a key element in quality assurance. Model-based development methods are shifting
tests from code level to model level. In the earlier development phases especially,
there is still great potential for complementing largely experimental development
procedures with methods of model-based, automated testing. Typical test activities
in model-based function development are model-in-the-loop, software-in-the-loop,
and processor-in-the-loop simulation, with back-to-back methods based on them;
black-box approaches such as the classification tree method; white-box methods
with coverage measurement at model and code level; and in the broader sense also
formal verification.

Simulation Modes in TargetLink
Systematic use of the simulation facilities available in MATLAB®/Simulink®/Stateflow®
enables developers to perform fast, simple checks on the results obtained and on
the modifications and adjustments that have been made, during the development
process. Three different simulation modes involve simulating the function model, the
generated code on the development PC, and the generated code on an evaluation
board. This means that testing can be performed stepwise:


       �����������������                            ��������������������                      ���������������������
           ����������������                             �����������������                     ��������������������������




                                                                                                      ����������������




    �������������������������������               �������������������������������            �������������������������������



 Simulating the function model as an executable specification is generally
   known as model-in-the-loop (MIL) simulation.
 Simulating the generated code on the development PC (host PC) is known as
  software-in-the-loop (SIL) simulation. The generated code is translated by a
  host compiler.
 Simulating the generated code on an evaluation board, which will typically
  contain the processor used in the ECU, is known as processor-in-the-loop
  (PIL) simulation. The generated code is translated by the appropriate target
  compiler.

TargetLink supports all these simulation modes. A unique feature of TargetLink is
that it logs signal traces during simulation, providing visual feedback of simulation
results from different simulation modes. The results can be compared directly and
used for further automated analysis.

 TargetLink (p. 27)



                                                                                                                                      11
                                                                                                                                      2007
Target Implementation



       Model-Based Testing     Systematic Testing with MTest
                               One of the great advantages of model-based function and software development is
                               that model-based testing can be done in parallel. Hundreds or even thousands of tests
                               can be developed, maintained, and performed conveniently with the aid of a model-
                               based test environment. All the tests can be stored and administered consistently,
                               so that they can be performed repeatedly (“regression testing”) and reproduced at
                               any time. MTest, dSPACE’s test environment for systematic and automated testing
                               during function development, is a powerful tool for managing large test projects.
                               It automates model-based, systematic testing in conjunction with TargetLink and
                               covers all the necessary tasks:

                                  Model-based testing early in the development process
                                  Back-to-back tests between model and code
                                  Systematic test development
                                  Automated test execution, evaluation, and documentation
                                  Open interfaces for test data and test evaluation functions
                                  Test project management




                               MTest can perform a wide variety of tests systematically and automatically for early
                               function design validation. It supports all TargetLink’s simulation modes, so back-to-
                               back tests can be run for all test phases throughout function development. MTest
                               stores and manages all the tests belonging to each function model. The tests can
                               be reused at any time.




 12
2007
TargetLink



Coverage Analysis                                                                         Model-Based Testing
Comprehensive simulations are complemented by code coverage analysis. While
Simulink provides various coverage metrics at model level, TargetLink supports the
measurement of statement coverage and decision coverage at code level during the
simulation or test run. For example, parts of the code that are never executed, despite
a large number of tests, are identified, and then further test cases can be defined
specifically for them. In individual cases, specific parts of the model or code may even
be removed, if they are unreachable and therefore superfluous (dead code).

 Code Coverage (p. 32)


Model Validation by Formal Verification
OSC - Embedded Systems developed the EmbeddedValidator, a tool for the automatic
validation of Simulink®/Stateflow® models, based on TargetLink-generated C code.
EmbeddedValidator checks models for specified functional properties and gives
function developers clear information on whether any model meets the functional
specifications under all conditions.

 EmbeddedValidator (p. 46)




                                                                                                                        13
                                                                                                                        2007
Production Code Generation Software



                          TargetLink

                          Automatic
                          production code generator




       Key Features        Production code generation directly                  Optimizations for individual
                            from MATLAB®/Simulink®/Stateflow®                      processors

                           ANSI C code with the efficiency of                    Built-in simulation and testing
                            handwritten code
                                                                                 NEW: AUTOSAR support




       Description        Application Area                                      Key Benefits
                          Graphical programming using elements such as          Converting graphical models directly into produc-
                          blocks or state diagrams is an evolutionary step in   tion code ensures perfect consistency between
                          programming languages. TargetLink is a software       model and code at all times. Since the same
                          system that generates production code (C code)        model will always result in the same proven code,
                          straight from the MATLAB/Simulink/Stateflow            TargetLink’s code generation is deterministic and
                          graphical development environment. Code gen-          thus guarantees the highest software quality.
                          eration options range from plain ANSI C code          Every step can be tested against the specification
                          to optimized fixed- or floating-point code for          via the built-in simulation features. This allows
                          certain processors. Versatile code configuration       early verification and translates directly into cost
                          options ensure that the production code copes         reduction, for example, in the break-even time
                          with processor constraints.                           and the cost of software defects.



                          Efficient Coding                                       Seamless Tool Chain
                          Efficiency is the key to production-quality code.      TargetLink seamlessly connects function develop-
                          Efficient code means that a minimum of execu-          ment and code generation for the control unit
                          tion time and resources is required to run the        or prototyping hardware. Moreover, it closes the
                          code on a cost-efficient embedded processor.           gap between the design and verification phases
                          Practical experience shows that code generated        by automatic means. This provides transparent
                          with TargetLink is as efficient as handwritten         and defined development processes for con-
                          code. Apart from benchmark performance, fac-          ventional and AUTOSAR ECUs. Calibration files,
                          tors such as human readability, traceable model/      AUTOSAR software component descriptions, and
                          code dependency, and last but not least, the          comprehensive documentation are generated in
                          target awareness of the code, are what makes          addition to the production code.
                          TargetLink such a useful tool.




 14
2007
TargetLink


Main Features and Benefits

Feature                        Description                                            Benefit
Efficient code                   Efficient fixed-point or floating-point production       Your specifications – models and diagrams –
                                 code directly from MATLAB/Simulink/Stateflow              are directly translated into efficient C code
Code reliability                Consistent, deterministic translations of models      Errors are avoided
                                 into stress-tested C code
Target optimizations            Code optimization for individual processors/          Highly efficient code that can cope with
                                 compilers                                                processor constraints
Incremental code generation     Code generation for certain subsystems                Faster code generation, approved code does not
                                                                                          need to be touched
Code coverage analyses          Dynamic analyses of program execution to find          Potential problems are detected
                                   areas that have not been run through
Human readability               Concise, yet readable code                            Easy code reviews
Automatic scaling               Intelligent scaling based on worst-case               Precision is ensured
                                   propagation of signal ranges and simulation
                                   based scaling
Test mechanisms                   Various mechanisms to test the production code      Malfunctions found at earliest stage
                                   against the specification (MIL, SIL, PIL)
Compliance with standards         Compliance with relevant quality and                Guaranteed quality and interoperability
                                   functionality standards
Multirate code                    Full support of multirate systems with intertask    You can already define tasks at block level
                                   communication
Support of OSEK/VDX-              Support for the standardized OSEK/VDX               You can design multirate software that is
compliant operating systems        interface and features                                 compliant with OSEK operating systems
NEW: AUTOSAR support              Support for modeling and code generation for        TargetLink 2.2 bridges the gap between model-
                                   AUTOSAR software components (SW-C),                    based design and AUTOSAR-compliant software
                                   and generation of SW-C descriptions                    development
dSPACE Data Dictionary            Central container to handle variables, data           You can manage complex data to plan and
                                   structures, scaling formulas, tasks, functions         structure your projects
TargetLink Blockset               A free TargetLink blockset that can be used           Large workgroups can work with TargetLink
                                   without having the Base Suite installed                models without the need for additional
                                                                                          TargetLink licenses
Calibration data generation     Calibration data exported as ASAM-MCD 2MC               Automated and complete process with perfect
                                 (ASAP2) file for calibration tools                        consistency between model and calibration data
Documentation                   Automatic model and code documentation                  Your projects are transparent and trackable


Order Information
Classification                  Type                                                   Order Number
TargetLink Base Suite          Base Suite                                              TBS
Target Optimization Modules      Freescale HCS12/HC12/Cosmic                           TOM_HCS12/Cosmic
for certain processors/compilers Freescale HCS12/Metrowerks                            TOM_HCS12/Metrowerks
(further details see p. 199)
                                 Freescale MPC5xx/Wind River Diab                      TOM_MPC5xx/Diab
                               Freescale MPC5xx/Green Hills                            TOM_MPC5xx/GREEN
                               NEW: Freescale MPC55xx/Wind River Diab                  TOM_MPC55xx/Diab
                               Infineon C16x/Altium Tasking                             TOM_C16x/Tasking
                               Infineon TriCore/Altium Tasking                          TOM_TriCore/Tasking
                               Renesas M32R/GAIO                                       TOM_M32R/GAIO
                               Renesas SH-2/Renesas                                    TOM_SH2/SHC
Other modules                  Target Simulation Module (for all supported             TSM
                               processors)
                               TargetLink Module for Operating Systems – OSEK          TMOS_OSEK
                               NEW: TargetLink AUTOSAR Module                          TAS
                               dSPACE Data Dictionary Manager (included)               DSDD_MANAGER




                                                                                                                                           15
                                                                                                                                           2007
Production Code Generation Software


       Relevant Software and Hardware
       Software
       Included                          Stand-alone blockset for free model exchange            TargetLink blockset
                                         Data dictionary                                         dSPACE Data Dictionary
       Required                          Integrated development environment                      MATLAB®/Simulink®/Stateflow®
                                                                                                  from The MathWorks
                                                                                                 Compiler for host simulation included in
                                                                                                  MATLAB
                                         Operating system                                        Windows 2000 or Windows XP (32-bit version
                                                                                                  only)
       Optional                          Compilers for processor-in-the-loop tests               Target-specific compiler for processor-in-the-loop
                                                                                                  tests with Target Simulation Module



       Hardware
       Required                          Minimum system                                          Pentium III processor, 800 MHz
                                                                                                 512 MB RAM, 350 MB free disk space
                                         Recommended system                                      Pentium 4 processor, 1.6 GHz or higher
                                                                                                 Memory ≥ 512 MB RAM, 350 MB free disk space



       NEW: Additional TargetLink 2.2 Features
       Improvement                                           Detailed Description
       Model-based design for AUTOSAR ECUs                    New AUTOSAR blocks for specifying AUTOSAR‘s structural elements, such as
                                                               runnable entities, ports, etc.
                                                              Code generation for AUTOSAR software components (SW-Cs)
                                                              Export of software component descriptions to integrate the generated SW-Cs
                                                               in an AUTOSAR software architecture
       Function interfaces with pointers to structures        TargetLink 2.2 now also supports pointers to structures in the function signature,
                                                               which is particularly efficient where there are a large number of function
                                                               parameters and provides extended flexibility for structuring the code.
       Target Optimization Module (TOM) for MPC55xx           Optimized code generation for MPC55xx/Windriver Diab compiler
       Target Simulation Module (TSM) extensions              Freescale MPC5554/Metrowerks CodeWarrior and GNU compilers
                                                              Freescale S12X/Cosmic compilers
                                                              NEC V850 Demonstration Kit F_Line – Drive It/NEC compilers
                                                              Infineon TC1766/Tasking compilers
                                                              Infineon TC1796/GNU Hightec compilers
       More flexible code generation                           TargetLink’s numerous code generation options have been extended, for example,
                                                               with regard to variant coding, and by access functions for structures and bitfields.
                                                               All Code Generator settings can now be edited via a convenient user interface.
       Extended modeling options                              TargetLink 2.2 not only allows numerous blocks to inherit properties, it also
                                                               supports bus-capable blocks and code generation for nested graphical functions
                                                               in Stateflow.
       Multi-edit functionality with the new Object           The new Object Explorer pane provides an overview of multiple objects and
       Explorer pane in the Data Dictionary Manager            selected properties and allows the properties of multiple data dictionary objects
                                                               such as variables to be modified simultaneously, which greatly simplifies the
                                                               handling of large data volumes with the Data Dictionary Manager.
       Improved model-code traceability                       Code files can be optionally generated in HTML format, with hyperlinks for
                                                               navigation from model to code and vice versa at a click.
                                                               This improves overall traceability and simplifies code reviews.
       Requirements Management Interface                      TargetLink 2.2 now preserves requirements information during model conversion
                                                               from Simulink to TargetLink and TargetLink to Simulink, making it easier to use
                                                               Simulink’s Requirements Management Interface from inside TargetLink.




 16
2007
TargetLink


How Do I Get the TargetLink I Need?
TargetLink Modules                                                                                                                               Module Overview
TargetLink is available as a base suite plus addi-
tional modules, so that you can adapt it to
requirements.


                                          ��������������������������
                                     ������             ����������              ����               ���������                            ������������
         ����������                                              ��                    ��                              �����������
                                     �����               ��������            ����������            ���������                             ���������������
         ����������
                                                                            �����������������������������

                                          ����������         ����������             ���������          ��������         ��������             ������
      �����������������                    ������              ����                  �������             ���              ����            ������������
                                                                                                                                            ������
           ������
                                 ����������        ����������            ���������              ����              ��������   �������������������
                                   �����           �������                 ����                 ����               ����            ����



     �������������������         ����������        ����������          ����������          ���������       ���������         ��������         ��������
          �������                  �����            ������             �������               ����           �������           ����              ����




        �����������
          ��������                                ���������������                                                   ��������������
         �������

1)
      Usable in stand-alone mode without license
2)
      Data Dictionary Manager also available as a standalone licence
      e.g to be used with the standalone blockset



TargetLink Base Suite                                                     Target Simulation Module (optional)
 Highly efficient ANSI C code generation                                   Test your generated code on the target
   from MATLAB/Simulink/Stateflow                                             microcontroller
 For all microcontrollers with ANSI C                                       (for supported processors and evaluation
   compiler                                                                  boards see p. 18)
 Fixed-point code, floating-point code or a
   mixture of both
 dSPACE Data Dictionary (p. 44)
 TargetLink blockset (p. 22)
 Floating network license available for
   flexible use of TargetLink in development
   groups



Target Optimization Modules (optional)                                    TargetLink Module for Operating Systems
 For target-specific, optimized code                                      (optional)
   generation                                                              Support of OSEK/VDX-compliant operating
 Uses compiler-specific language extensions                                  systems (p. 38)
   and assembly macros
   (for supported processors see p. 18)



NEW: TargetLink AUTOSAR Module
(optional)
 Support for the development of AUTOSAR
   Software Components (SW-C) (p. 40)




                                                                                                                                                                        17
                                                                                                                                                                        2007
Production Code Generation Software


       Processors and                                   Supported Processors and
       Evaluation Boards                                Evaluation Boards
                                                        TargetLink supports most processors for embed-
                                                        ded applications, especially in the automotive
                                                        field. If a processor is missing, its support is
                                                        perhaps scheduled for the next version or can be
                                                        provided as an engineering service. Please inquire.


                                            ANSI C
                                                             Compiler Supported by      Compiler Supported by                  Evaluation Boards
            Processor Family                Code
                                                             Target Optimization Module Target Simulation Module               Supported by TargetLink
                                            Support
            Any microprocessor with                                        –                                 –                             –
            an ANSI C compiler
            Freescale HCS12                                 Cosmic compilers and              Cosmic compilers and            MCT HCS12 T-Board and
                                                             Metrowerks CodeWarrior            Metrowerks CodeWarrior          Freescale M68EVB912DP256
                                                             compilers                         compilers
            Freescale S12X                                                –                   Cosmic and Metrowerks           MCT S12X T-Board
                                                                                               CodeWarrior compilers
            Freescale MPC5xx                                Green Hills and Wind River        Green Hills, Metrowerks         Axiom CME-0555 and
                                                             Diab compilers                    CodeWarrior, and Wind River     Axiom CMD-05651)
                                                                                               Diab compilers
            Freescale MPC55xx                               Wind River Diab compilers         Green Hills, Metrowerks         Axiom MPC5554DEMO
                                                                                               CodeWarrior, GNU and Wind
                                                                                               River Diab compilers
                                                                                               MicroTec and Wind River Diab    dSPACE DS1603
                                                                                               compilers
            Infineon C16x                                    Altium Tasking compilers          Altium Tasking compilers        i+ME eCAN C167 CR
            Infineon TriCore                                 Altium Tasking compilers          Altium Tasking and GNU2)        Infineon TriBoard TC1775,
                                                                                               compilers                       TriBoard TC1766 and
                                                                                                                               TriBoard TC1796
            NEC V850                                                       –                  Green Hills and NEC compilers   NEC Demonstration
                                                                                                                               Kit F_Line - Drive It
            Renesas H8S                                                    –                  Renesas compilers               Renesas EVB2633F
            Renesas M32R                                    GAIO compilers                    GAIO and Renesas compilers      Renesas MSA2114
            Renesas SH-2                                    Renesas compilers                 Renesas compilers               Renesas EVB7055F and
                                                                                                                               CDK7058
            STMicroelectronics ST10                                        –                  Altium Tasking compilers        FS Forth-Systeme STart276
                                                                                                                               Development Board
            Texas Instruments                                              –                  Texas Instruments compilers     Texas Instruments TMS470R1x
            TMS470
       1)
             Only Wind River Diab Compiler supported.
       2)
             Only for TC1796


                                                        Some of the evaluation boards need to be modi-        For more information on software compatibility
                                                        fied (loader, external RAM, etc.). Please order        with target compilers and evaluation boards,
                                                        them through dSPACE to ensure a correct board         please refer to:
                                                        setup.                                                www.dspace.de/goto?compatibility



       Engineering Services                             TargetLink Engineering Services
                                                        Our engineering portfolio offers special TargetLink    Integration of TargetLink with
                                                        customer services:                                         your development environment
                                                         Knowledge transfer through dSPACE                    Development of target modules for
                                                           consultants (on-site and off-site)                   supporting customer-specific processor/
                                                         Hands-on support: Our engineers can join              compiler combinations
                                                           your project team during evaluation and             Development of customer-specific code
                                                           introduction of TargetLink                           output templates according to company
                                                                                                                code style guides



 18
2007
TargetLink


How Do I Work with TargetLink?
Typical Steps in Generating Production Code

                                              This diagram illustrates the workflow
                                              between model design and code
                                              implementation. It also shows that
                                              code verification based on simulation
                                              is an iterative process. The workflow
                                              is shown in greater detail on the
                                              following pages.




                                                                                     19
                                                                                     2007
Production Code Generation Software


       Workflow            Control Design and Function Prototyping
                          Control design starts with creating a control
                          model in the integrated design environment
                          MATLAB/Simulink/Stateflow. Before production
                          code generation with TargetLink, you could use
                          dSPACE prototyping systems to carry out con-
                          venient function prototyping and validation of
                          your new ECU control algorithms.




                          Using the TargetLink Block Library
                          To implement the control algorithms in C code,
                          you need the TargetLink block library. TargetLink
                          blocks contain additional data for code genera-
                          tion, such as the scaling information for fixed-
                          point variables, variable classes, variable names
                          etc. A utility automatically replaces your Simulink
                          controller model with blocks from the TargetLink
                          block library. The process is reversible without any
                          data losses. If you already use the free TargetLink
                          Blockset during control design, conversion is not
                          necessary.

                          Model-in-the-Loop Simulation on Host PC
                          Model-in-the-loop simulation (floating-point)
                          serves as a reference for the following steps and
                          provides the minima and maxima of variables
                          as a basis for subsequent fixed-point scaling if
                          desired.




 20
2007
TargetLink


Automatic or Manual Scaling                                                                               Workflow
If you want to generate fixed-point code, the
scaling has to be specified. Scaling can be done
manually, or by simulation-based autoscaling
or worst-case autoscaling. You can choose
from a broad range of scaling options for each
TargetLink block individually.



Code Generation
The TargetLink Base Suite generates highly efficient
ANSI C code for a controller model at the click of
a button. This code efficiency can be increased
even further by generating code for a specific
compiler/processor combination using a Target
Optimization Module (see p. 17, p. 18).




Verification on Host PC via                            Verification on Target Processor via
Software-in-the-Loop Simulation                       Processor-in-the-Loop Simulation
By means of software-in-the-loop simulation on        Using the optional Target Simulation Module
a host PC, you can compare the behavior of the        (see p. 17, p. 18), you can execute processor-in-
generated code with the reference data achieved       the-loop simulation to verify the generated code
in model-in-the-loop simulation. TargetLink offers    on an evaluation board equipped with the same
an intelligent graphical user interface, where you    target processor as your final ECU. Successful
can select signal histories of blocks for detailed    verification of processor-in-the-loop simulation
analysis.                                             with model-in-the-loop simulation and softwa-
                                                      re-in-the-loop simulation ensures the software
                                                      quality of the generated code. TargetLink also
                                                      provides information on the code size, the re-
                                                      quired RAM/ROM, and the stack consumption
                                                      as it evolves over time. The execution time can
                                                      be displayed as well.




                                                                                                                                 21
                                                                                                                                 2007
Production Code Generation Software


                             TargetLink Block Library for Implementation
       Extended              Implementation-Specific Information
       Block Functionality   The Simulink block library is very powerful in     have an extended dialog which allows you to
                             simulation tasks. It provides all the necessary    enter the implementation-specific information
                             specification features for the job. When it comes   necessary for code generation. Each block also
                             to code generation, however, more information      provides a means of data logging, overflow de-
                             is needed for each block. That is why there is a   tection, and saturation simulation. A converter
                             TargetLink block library. The TargetLink blocks    automatically replaces each supported Simulink
                             significantly extend the functionality of the       block with the corresponding TargetLink block.
                             supported Simulink blocks. TargetLink blocks




                             TargetLink block dialog for entering implementation-specific
                             information like data type, variable name, scaling data etc.




 22
2007
TargetLink


Free Model Exchange                                                                                          TargetLink Blockset
The TargetLink Blockset is a stand-alone version           TargetLink Blockset offers the following
of the block library used with the TargetLink Base         features:
Suite that allows model transfer without model              Free model exchange in workgroups
conversion. The TargetLink Blockset is compatible             without conversion
with The MathWorks’ Real-Time Workshop® and                 Simulating in floating-point precision
can be used on any computer that has MATLAB/                  with Simulink
Simulink installed. Thus, TargetLink models can             Code generation
be exchanged freely without the need for extra                with Real-Time Workshop
TargetLink licenses.



Linkage Between Control Design,
Prototyping and Implementation
You can use the free TargetLink Blockset to                the TargetLink Blockset allows you to use the
design and prototype your controller without               same models for rapid control prototyping and
TargetLink installed. TargetLink blocks can be             production code generation without model con-
used for rapid control prototyping on dSPACE               version. Development iterations are thus easier
hardware. Although the added functionality of              to perform and less prone to error.
the TargetLink blocks is not available in that case,


         �������������������������                                       ��������������
  �                                                               �
  ��
                                                       �          ��

                                                 ����������
                ������             �����������                               ������            �����������




                         ������������������                                             ����������




       ������������       ������������������                                          ���



Rapid control prototyping with Real-Time Workshop and dSPACE hardware does not require
model conversion.




                                                                                                                                    23
                                                                                                                                    2007
Production Code Generation Software


       Block Overview                   TargetLink Block Library




            These TargetLink blocks
       extend corresponding blocks
       in the Simulink block library.




                                        Directly Supported Simulation Blocks




              These Simulink blocks
           are directly supported by
                          TargetLink.




 24
2007
TargetLink


TargetLink Utility Blocks                                                                              Block Overview
TargetLink Utility blocks provide
access to specific features of
TargetLink or further specify the
code generation process for the
model.




Multirate Blocks
The TargetLink multirate blocks
make multirate operating system
objects available in block diagrams.
There are even OSEK-specific blocks
like the CounterAlarm.

NEW: AUTOSAR Blocks
Model-based design for AUTOSAR ECUs is
supported by blocks for structural elements such
as runnables, ports, and certain communication
elements.



Handling Large Models with                                                                             Block Configurations
the Property Manager
Since it is time-consuming to change the proper-   ties simultaneously. For Stateflow objects this
ties of large models via block dialogs manually,   includes charts, events, states and data. The
TargetLink provides the Property Manager. This     Property Manager provides a tree view of the
is a graphical user interface that displays the    model’s subsystem hierarchy, a list of blocks in
properties of TargetLink blocks and Stateflow       each subsystem, and a configurable list of proper-
objects in a model. The Property Manager allows    ties for each block.
you to view, filter and modify several proper-




                                                                                                       The Property Manager
                                                                                                       for handling models with
                                                                                                       numerous blocks.




                                                                                                                                  25
                                                                                                                                  2007
Production Code Generation Software


                                       Three Simulation Modes for Testing
       Confirmation                     Comparing Simulation Results                          Test Against Specification
       by Simulation                   Although code generators produce virtual-             Verification means checking the implementation
                                       ly flawless results when compared to manual            against the specification. The specification is the
                                       programming, the generated code still needs to        simulation model, as executed by Simulink and
                                       be tested as well as the underlying specification.     Stateflow. The executable and approved specifica-
                                       TargetLink provides powerful and easy-to-use          tion is used as a reference. The implementation is
                                       means to verify the generated code. The code          the generated and compiled C code, as executed
                                       tests are performed in the same simulation envi-      by the target processor. TargetLink provides a
                                       ronment that was used to specify the underlying       3-step verification process which shows at a
                                       simulation model. Functional identity has been        click that specification and implementation are
                                       achieved when simulation results match. The           functionally identical. On the basis of a controller
                                       validity of tests is documented by a C0 or C1         model, TargetLink performs simulations of the
                                       code coverage analysis.                               model, the generated code on the host, and the
                                                                                             generated code on the target, without additional
                                                                                             model modifications or preparations.



       Three-Step                      Model-in-the-Loop Simulation
       Verification Process             The first step is to record data for reference plots   Model-in-the-loop simulation also serves other
                                       from the simulation model. Signals from selected      purposes. It is used for detecting overflows of
                                       blocks and state variables are automatically          integer variables, and its results are used for
                                       logged by TargetLink. The model-in-the-loop           simulation-based autoscaling.
                                       simulation captures the specified behavior of the
                                       model that is to be implemented in C code later
                                       on. The recorded signal plots act as the reference
                                       for the next verification steps.


                   �����������������                             ��������������������                         ���������������������
                       ����������������                               �����������������                        ��������������������������




                                                                                                                       ����������������




                �������������������������������                �������������������������������               �������������������������������



                                       TargetLink performs the three different simulation modes without any changes to the model
                                       or the generated code.



                                       Software-in-the-Loop Simulation
                                       Software-in-the-loop means the code is gene-          the host PC instead. The signal plots should be
                                       rated and replaces the controller blocks in the       largely identical when compared to the results of
                                       same simulation model (for example, same              model-in-the-loop simulation. If they are not,
                                       plant and stimulus signals). TargetLink does          they can be analyzed to get a better understan-
                                       this automatically in the background. You still       ding of the cause of the deviation and to fine-
                                       see, though it is the code that is executed on        tune the fixed-point settings.



 26
2007
TargetLink


Processor-in-the-Loop Simulation                                                                           Three-Step
Finally, the generated code runs on an embedded        with the target compiler and downloaded to          Verification Process
processor. Code that runs correctly on the host        the evaluation board. TargetLink manages the
PC can still cause trouble on the target processor.    communication between the host PC and the
To check that this does not happen, TargetLink         evaluation board. All these activities are auto-
offers processor-in-the-loop simulation. An off-       mated and need no user interaction. Simulation
the-shelf evaluation board is connected to the         on an evaluation board just takes two mouse
host PC, and the generated code is compiled            clicks.



Compare Plots                                          Efficient Approach                                   Display Results
The simulation results are automatically plotted       This 3-step approach, using model-, software-
in the same plot window that was used by the           and processor-in-the-loop simulation, is easy,
other simulation modes. This is a convenient           intuitive, and quick. As a result, tests can be
way to compare the results of simulations in           carried out more frequently, which increases
different modes directly. For example, if plots        software quality.
from processor-in-the-loop simulation deviate
from software-in-the-loop simulation, the most
likely cause is a bug in the target compiler or a
problem with the processor.




                                                                            Signals from MIL and SIL
                                                                            simulation are displayed
                                                                            and can be analyzed to
                                                                            measure deviations.




Complete Simulation Support                                                                                Unparalleled
TargetLink systematically utilizes all the available                                                       Simulation Concept
simulation options to give users an unique
simulation environment.



MIL, SIL, PIL Simulation at a Click                    Integrated Data Logging
Switching from MIL to SIL or PIL simulation            TargetLink blocks come with integrated data
requires just a click. There is no need for a          logging functionality. You can specify if block
separate test model or generating S-functions          output signals can be logged in the block dialog.
or manual insertion into a test harness model.         No changes to the model are necessary, i.e., you
TargetLink has built-in simulation and logging         do not have to insert scope blocks or suchlike.
intelligence in all simulation modes.                  Most importantly, data logging is not limited to
                                                       MIL simulation but available for all simulation
                                                       modes without further user interventions.




                                                       The TargetLink block dialog lets you specify
                                                       whether to log signal histories –
                                                       independent from the simulation mode.



                                                                                                                                  27
                                                                                                                                  2007
Production Code Generation Software


       Unparalleled         Result Plotting
       Simulation Concept   TargetLink directly visualizes the simulation results   Detailed signal analysis can be performed via
                            of logged signals. Simulation results from diffe-       additional plot windows that include details
                            rent simulation runs, no matter which simula-           about deviations in individual simulation runs.
                            tion mode, are plotted one above the other in           This is also available at a click, and you do not
                            the same plot window, using different colors.           need to write your own plotting scripts.



                            Signal Analysis
                            In the Detailed Signal Window, you can zoom
                            signals to inspect deviations visually and get a
                            clear picture of the signal behavior. Constraints
                            can be displayed to show immediately whether
                            signals are within defined ranges, which is espe-
                            cially important for scaling. You can use a cursor
                            to scroll through the signal histories and display
                            signal values numerically. The Signal Deviation
                            Window gives you a graph of the deviation
                            between two signals. These tools are all available
                            at a click for convenient analysis.




                            The Signal Deviation Window displays a graph
                                    of the deviation between two signals.




                                                                                                      The Detailed Signal Window
                                                                                                      lets you inspect signals
                                                                                                      and displays their values
                                                                                                      numerically.




 28
2007
TargetLink


Advantages of Built-in Logging                                                                            Benefits of
and Simulation                                                                                            the Simulation Concept
 MIL/SIL/PIL simulation at a click                  Direct feedback if code generation matches
 Built-in data logging and result plotting for        model simulation
  all simulation modes                               Especially useful for conversion from fixed
 No changes to the model necessary                    point to floating point
 Allows direct comparison of                       In brief: Great ease of use with unmatched
  MIL/SIL/PIL results                               simulation flexibility
 Detailed signal analysis and deviation plots



Profiling the Code                                                                                         Run-Time Analysis
Processor-in-the-loop simulation can also be used   you to try out block options, such as selecting
to profile the generated code. During simulation,    different search routines of a look-up table block.
TargetLink automatically measures execution time    You can immediately measure the impact of the
and stack consumption directly on the target        change on code efficiency. Sound implementa-
processor. A code summary lists RAM and ROM         tion decisions based on accurate benchmarks
usage for each function. These features allow       become a matter of a few clicks.




The results of code profiling:
execution time measurement,
stack size measurement, and code
summary of generated code.




                                                                                                                                   29
                                                                                                                                   2007
Production Code Generation Software


                              Scaling of Variables
       Fixed-Point Accuracy   Quick and Accurate Scaling                            Overflow Detection
                              If TargetLink is to generate only floating-point       Another big advantage: fixed-point overflows
                              code, scaling is not necessary. However, if           no longer entail hour-long debugging sessions.
                              TargetLink is used to generate fixed-point code,       With TargetLink, scaling can be checked during
                              autoscaling can be a huge time-saver. It takes        simulation. If an overflow occurs, TargetLink
                              away the tedious and error-prone task of manu-        shows the exact location in the block diagram.
                              ally scaling each variable and each operation in      The problem can be corrected right away.
                              the software. What took days and weeks in the
                              past can now be done in minutes and hours.




                              Plot overview window indicating an overflow of an outport block.




       Scaling Choices        Scaling Properties                                    Automatic Scaling
                              TargetLink offers a two-coefficient linear scaling     These scaling properties give ample choices to
                              method, which is widely used in embedded              fine-tune fixed-point code to the conflicting
                              control applications. The properties for specifying   requirements of low execution time, high com-
                              fixed-point scalings in TargetLink are:                putational precision and overflow avoidance.
                               Data type                                           Fixed-point scaling can be done manually by a
                               Power-of-two scaling factor or                      software engineer, but in most instances it is left
                                 arbitrary scaling factor                           to the autoscaling tools from TargetLink.
                               Offset value
                               Constraint values
                               Bit safety margins
                               Saturation options




 30
2007
TargetLink


Simulation-Based Autoscaling                        Worst-Case Autoscaling                               Efficient
Simulation-based autoscaling requires that the      When simulation is not possible or deemed            Scaling Methods
model can be simulated. This necessitates either    unfeasible, TargetLink offers the method of
a plant model or stimulus data for all inports.     autoscaling based on a worst-case range calcula-
During simulation, TargetLink records the signals   tion. This method requires value range information
from each Simulink block and determines the         for inports and some specific blocks inside the
value range. This allows TargetLink to calculate    model. TargetLink propagates these value ranges
optimum scaling for each block. The advantage       through the model and calculates the best scaling.
of this scaling method is maximum computa-          The advantages of this scaling method are that
tional precision.                                   it does not require a plant model and that over-
                                                    flows will be prevented.




                                                       Dialogs to carry out automatic scaling.



Scaling with Scaling Formulas and
Type Definitions
Using scaling formulas is not actually an auto-
scaling method; however, it still allows you to
scale a model quickly. A complete set of scaling
properties is defined under one name in the
dSPACE Data Dictionary and selectable in block
dialogs or in the Property Manager. This allows
you to quickly scale signals of one kind or sub-
systems with the same scaling parameters.




                                                                                                                               31
                                                                                                                               2007
Production Code Generation Software


                          Proving Test Efficiency with Code Coverage
       Efficiency and      Run-Time Analyses
       Reliability        TargetLink offers C0 and C1 coverage analysis.      coverage analysis document is generated with
                          This is also referred to as ‘statement coverage’    a coverage overview table and a detailed list-
                          and ‘decision coverage’.                            ing of the code annotated with the execution
                          During simulation on host or target systems,        count numbers for each block. This report deliv-
                          counters document the frequency of execution        ers immediate information on test efficiency and
                          for each branch of code. After simulation, a code   completeness.



                          Quality and Certification
                          Code branches that have never been executed
                          can be easily identified and test strategies can
                          be adjusted accordingly. Consequently, the cov-
                          erage analysis further contributes to increased
                          software quality and is a prerequisite to code
                          certification.


                                                                   Code            Total         Reached        Unreached
                                                                 Coverage        Branches        Branches        Branches
                           Fuel system                            61.87%            139             86              53
                           Fuel rate controller                   58.91%            129             76              53
                           Fuel rate calculator                   56.56%            122             69              53
                           Correction redundancy                   100%              7               7               0
                           Airflow controller                       100%             10              10               0
                           Airflow calculation                      100%              9               9               0
                           Airflow subsystem                        100%              1               1               0

                          Example of the information provided by code coverage.




                          Annotated code listing with execution counts for each code block.




 32
2007
TargetLink


Incremental Code Generation
Working with Subsystems                            Benefits                                          Handle Large Models
Incremental code generation is available for       Incremental code generation has several advan-
Simulink subsystems which contain a TargetLink     tages:
Function block. In a team of developers, each       Team members can work independently
member can work on a subsystem individually           on different subsystems.
and just generate code for that. TargetLink per-    Code generation time can be significantly
forms the necessary consistency checks when           reduced by generating code only for
building the overall application from all the         subsystems that have been modified.
parts.                                              Code for individual subsystems in a model
                                                      can be tested and frozen, while development
                                                      in other subsystems continues.




                                                                    Specifying incremental code
                                                                    generation properties for a
                                                                    subsystem.




                                                                                                                          33
                                                                                                                          2007
Production Code Generation Software


                          Code Optimization
       Highly Efficient    Optimized ANSI C Code                                Standard Optimizations
       Production Code    TargetLink generates highly efficient ANSI C          TargetLink uses many of the optimization tech-
                          code as a standard. This is achieved by various      niques that are also used by C compilers. These
                          optimization techniques, which roughly fall into     are optimizations like constant folding, algebraic
                          3 categories:                                        transformations, dead code elimination, and life-
                           Standard optimizations                             span analysis of variables, to name just a few.
                           Interblock optimization                            They are standard optimization techniques and
                           Code pattern libraries                             are used by TargetLink whenever applicable.



                          Interblock Optimization
                          Interblock optimization combines the code of         usually combined in one expression. Code for
                          several blocks in one C code line. TargetLink’s      calculating the inputs of a switch block is moved
                          interblock optimization gives the generated code     inside the If-Else instruction. The example shows
                          a human touch, because TargetLink combines           interblock optimization at work. This technique
                          code in a very similar way to what a skilled soft-   saves execution time and ROM size, but most
                          ware engineer would do. For instance, a string       importantly, it reduces stack size significantly and
                          of arithmetical, logical, and relational blocks is   enhances code readability considerably.




                                     Example of Interblock Optimization.




                          Code Pattern Libraries
                          Combining the behavior of several blocks in one
                          C code line works well for smaller functionality.
                          If a block is quite powerful, for example, the
                          2-D Look-Up Table block or the FIR Filter block,
                          it needs several lines of code. TargetLink takes
                          them from an internal code pattern library during
                          the code generation process.




 34
2007
TargetLink


Optimized Assembly Code                                                                                   Target-Optimized
With the optional target optimization module          code patterns. Compiler-specific instructions and    Code
(p. 199, p. 200), processor- and compiler-specific     even inline assembly macros are used to deliver
language extensions can also be used for code         top-notch code performance. Some features of
optimizations. This further increases the efficiency   a processor core can be used only by applying
of the generated code. For every processor/           these coding techniques. This sometimes makes
compiler combination supported by TargetLink,         the difference in meeting hard real-time require-
there is a library containing highly optimized        ments and ROM size limits.



                ANSI-C         Optimized Assembly Code
Cycles          1232           45
Code size       100 byte       54 byte


64-tap FIR filter, measured with Infineon TriCore/Tasking
Compiler: Optimized code is 27 times faster than ANSI-C.




Automated Document Generation
Consistent Documentation and Model                                                                        Stay Organized
TargetLink does not just generate code, it also       subsystems, and simulation plots can also be
documents exactly what it does – keeping per-         included. Links to the generated C code are
fect consistency with the model and the code.         provided. Document generation can be custo-
An automatically generated document provides          mized to specific user needs, for example, the
information about function interfaces, global         level of detail. Documentation can be generated
variables, a list of all measurable and adjustable    in the HTML, RTF (for word processing) and PDF
variables, scaling parameters, code generator         formats.
options and much more. Screenshots of models,




                                                                    Production code documentation
                                                                    in HTML.




                                                                                                                                35
                                                                                                                                2007
Production Code Generation Software


                                       Customized Code
       Code According to               Readability
       Customer Standards              TargetLink code is easily readable and has many       over variable, function, and file naming, as well
                                       comments. Unnecessary macros, function calls,         as the flexibility of partitioning the code into
                                       cryptic naming, etc. are avoided. Comprehen-          functions and files to keep the structure logical
                                       sive configuration options give you full control       and manageable.



                                       Variable Classes
                                       You also have full control of how TargetLink          be generated before and after each declaration
                                       generates variables and, as a consequence, full       or block of declarations. To keep things simple,
                                       control of how the RAM and processor stack is         TargetLink bundles all these properties into
                                       utilized. The scope and storage class of a variable   ‘variable classes’. They are selectable in block
                                       can be specified, as well as other C attributes like   dialogs, which saves you a lot of repetitive
                                       ‘volatile’ or ‘const’. Even PRAGMA directives can     specification work.




         Variable class specification
                   for a Gain Block.



                                       External Code Integration                             Code Output Formatting
                                       TargetLink offers a wide variety of specification      TargetLink can generate code in a format that
                                       options on the block diagram level for easy           exactly matches company-specific C code tem-
                                       interfacing with external code such as device         plates. Code output can be formatted via an XML
                                       drivers, or with any other routine written in C       configuration file and an XSL style sheet. This
                                       or assembler.                                         allows you to define the format of file and function
                                       These are:                                            headers, the format of code comments, and the
                                        Inclusion of external header files                   inclusion of specific header files. Comments can
                                        Use of external global variables                    even contain Unicode characters, for example,
                                        Use of externally defined macros                     to support the Japanese language.
                                        Call to imported functions
                                        Call to access functions or macros
                                        Definition of Custom Code block which
                                          contains handwritten C code




 36
2007
TargetLink


Automation and Process Integration
Comprehensive TargetLink API                                                                                   Full Access to
TargetLink is easy to integrate into existing de-        while at the same time providing options for          TargetLink
velopment environments, because it comes with            intervention in the individual process phases. For
a comprehensive and fully documented API. This           example, “hook functions” allow user tasks to be
grants full access to all TargetLink properties and      performed at all stages of the build process.
settings and allows processes to be automated,



ASAM-MCD 2MC File Format                                                                                       Calibration
Another important requirement for a code gen-            CalDesk support this standard. Since the C code       File Generation
erator is close links with calibration systems. ECU      and the ASAM-MCD 2MC file are generated us-
code must be prepared for parameter fine-tuning           ing the same data basis, they will always be con-
by making calibratable or measurable variables           sistent. Thus another error source is eliminated,
accessible to a calibration system. For that pur-        and the development process streamlined.
pose, TargetLink supports the generation of the          TargetLink offers several predefined variable class-
standardized ASAM-MCD 2MC file format (for-               es for calibratable and measurable variables. Ad-
merly ASAP2) via the Data Dictionary to make             ditionally, you can also specify your own classes,
the variables and parameters available for ECU           ensuring that each class holds proper attributes
calibration. All major calibration tools like dSPACE     for calibration and/or measurement.


           ����������




                                                     ����������                               ��������
                                                  �����������������                      ������������������

                                                       ��������������
                                                       �����������������������
                                                       �����
                                                       �������������������
                                                       �����
                                                       ����������������������
                                                       �����
      ���������������
      �                       ����������
      ������
      �                                                                          �����           �����


                    ���




                                                                              ���������������




              ���                          ������������������           �������������������������




                                                                                                                                       37
                                                                                                                                       2007
Production Code Generation Software


                          Integration with OSEK/VDX Operating Systems
       Taking Advantage   The OSEK/VDX Standard
       of Standards       The OSEK/VDX1) standard was defined by a                                implementation instructions, the OSEK OS
                          committee of major automotive manufacturers                            standard provides a concept of a multitasking-
                          and component suppliers to provide an opera-                           capable, real-time operating system. TargetLink
                          ting system interface for embedded automotive                          equipped with the OSEK module is fully compliant
                          applications. The major goal is to support the                         with the OSEK/VDX standard and can generate
                          portability and reusability of the application soft-                   code for real-time multitasking applications.
                          ware. In addition to a common API definition and



                          The TargetLink OSEK Module
                          OSEK operating system objects and services are                         TargetLink allows to create multirate models
                          available on the block diagram level once the                          containing blocks with different sample times.
                          TargetLink OSEK module is installed. For instance,                     Multirate systems are mapped to operating sys-
                          you can set up alarms, define tasks, or specify                         tem tasks – periodic or event-driven – in a very
                          intertask communication without leaving the                            flexible manner.
                          block diagram.



                          Benefits
                          This combination of TargetLink and the OSEK/                           in detail. Consistency checks on user inputs and
                          VDX standard gives you huge advantages. A                              OSEK-aware automatic code generation pre-
                          whole real-time system can be described in one                         vent common mistakes and shorten the instal-
                          environment. Control algorithms and operating                          lation and testing phases for ECU software. As
                          system objects are specified in one model. Au-                          a consequence, development time is reduced
                          tomatic mapping of the model characteristics                           significantly. Finally yet importantly: the same
                          to operating system objects means there is no                          code is reusable on other OSEK/VDX-compatible
                          more need to learn the OSEK/VDX specification                           operating systems.


                                                               ���������������                                                              �����
                                                                                                                                         ������������

                               ����������                                                                     �������
                                 �����                   �����                                                ������


                                                                                                                                           �����

                                                                          �����



                                                         ��������                                             �����

                                            ����������                                         �����������
                                                                                                ���������
                                                         ���������


                                                                                                              ���������                  �����������




                                                         ���                                                  ���                                     ���

                                                                       �������������������������

                          1)
                               OSEK: Offene Systeme und deren Schnittstellen für die Elektronik im Kraftfahrzeug (Open systems and their interfaces to automotive
                               electronics), VDX: Vehicle Distributed Executive ; more details at www.osek-vdx.org



 38
2007
TargetLink


Task Specification                                     Intertask Communication                              Interaction
You can specify all the OSEK attributes of a task     TargetLink InPort and OutPort blocks allow you       with the OSEK
in dialogs. The options available include selecting   to completely specify communication between          Operating System
an existing task and creating new tasks, along        different tasks. Data can be exchanged using
with specifying priority, number of activations,      OSEK messages or global variables. The code
preemptability, resources used, and associated        optionally works with local copies of global
events. TargetLink also adds customer-specific         variables. Critical code sections can be protected
OSEK options to the task dialog, for example,         from being preempted. If you do not specify
specification of stack sizes.                          intertask communication manually, TargetLink’s
                                                      intelligent interblock optimization finds the best
                                                      setup automatically.



OIL File Generation                                   Compatibility
As part of the operating system standard, the         TargetLink-generated code should run with any
specification and generation process involves          operating system that is OSEK/VDX-compliant.
defining system services and their attributes          TargetLink code was specifically tested with the
via the OSEK Implementation Language (OIL).           following operating systems:
TargetLink gives full freedom to use either            Metrowerks OSEKturbo
TargetLink’s built-in graphical user interface or      Vector Informatik osCAN
the operating system’s dialog-based OSEK con-          Vector Informatik osCANopen
figurator for editing the OIL file. The generated        3Soft ProOSEK
code and operating system are automatically            WindRiver OSEKWorks
consistent.                                            LiveDevices RTA/OSEK




Specifying task properties on block diagram level.




                                                                                                                                 39
                                                                                                                                 2007
Production Code Generation Software


                          NEW: Model-Based Design
                          for AUTOSAR Software Components
       TargetLink         The TargetLink AUTOSAR Module
       AUTOSAR Module     The optional TargetLink AUTOSAR Module makes       converted directly into AUTOSAR-compliant
                          TargetLink’s modeling, simulation and code gene-   production code.
                          ration features available for designing AUTOSAR     Learn more about AUTOSAR and the role
                          software components (SW-Cs). Developers can           TargetLink plays in an AUTOSAR-compliant
                          specify AUTOSAR structure elements, such as           development process in Target Implemen-
                          runnables, ports, and communication interfaces,       tation (p. 9)
                          simply at model level. Model-based designs are



                          Functionality                                      Benefits
                           Model-based design for AUTOSAR software           Efficient and easy modeling by using
                            components (SW-Cs)                                  proven workflows for AUTOSAR
                           Code generation for AUTOSAR SW-Cs                 Code generation compliant with AUTOSAR
                           Generation of software component                    standard
                            descriptions                                      Easy migration of existing TargetLink
                           Simulation of SW-Cs in all three simulation         models to AUTOSAR
                            modes (MIL/SIL/PIL)                               Tests and verification of SW-Cs in early
                                                                                design phases
                                                                              No tedious manual creation of software
                                                                                component description files
                                                                              Easy integration of code and software
                                                                                component descriptions in AUTOSAR
                                                                                infrastructures
                                                                             In brief: You get from model to AUTOSAR-
                                                                             compliant code faster.



                          TargetLink AUTOSAR Block Library
                          The library offers the following AUTOSAR            Client ports to initiate client/server
                          blocks:                                              communications, for example, calling a
                           Runnables – the executable elements                service in the underlying AUTOSAR basic
                           Runnable inports and outports for                  software
                             specifying data exchange                         SW-C sender ports and receiver ports, optio-
                                                                               nal ports as equivalents to AUTOSAR ports




                                                                             AUTOSAR software components are modeled
                                                                             by means of the additional AUTOSAR blocks.




 40
2007
TargetLink


Modeling with the AUTOSAR Blocks                                                                      Model-Based
The AUTOSAR library offers the blocks needed      To define how data is exchanged between the          Design Process with
for designing and specifying AUTOSAR-compliant    runnables of one or more SW-Cs, runnable inports    the TargetLink
models. To define an executable unit, the         and outports have to be inserted, similar to the    AUTOSAR Module
Runnable block is applied to a modeled sub-       TargetLink inports and outports in non-AUTOSAR
system, in a similar way to TargetLink function   applications. TargetLink supports sender-receiver
blocks. This can be done either for new models    and synchronized client-server communication.
designed from scratch or for legacy models with   Property specifications are made both on block
established control functions.                    level and via the dSPACE Data Dictionary.




A runnable is defined by the runnable block in conjunction with runnable inports and outports.




                                                                SWC
                                                             ReceiverPort

Referencing AUTOSAR properties specified in the dSPACE Data Dictionary from AUTOSAR block
dialogs.




                                                                                                                             41
                                                                                                                             2007
Production Code Generation Software


       Model-Based           Code Generation
       Design Process with   TargetLink generates production code for            and runnable inports and outports are imple-
       the TargetLink        AUTOSAR software components and provides            mented as Runtime Environment (RTE) macros
       AUTOSAR Module        all the code generation options for optimization.   according to the AUTOSAR standard.
                             Modeled runnables are converted to C functions




                             The generated C code for a runnable with three included RTE macro calls.



                             Simulation
                             With TargetLink, SW-Cs can be simulated in all      Multiple SW-Cs can be simulated in one simu-
                             three simulation modes:                             lation run. Communication between SW-Cs is
                              Model-in-the-loop (MIL)                           simulated to the extent supported by the Simulink
                              Software-in-the-loop (SIL)                        design environment; for example, there is no
                              Processor-in-the-loop (PIL)                       asynchronous client-server communication.




                             Top hierarchy of a model for simulating runnables and entire components. Runnables are included
                             in the TargetLink controller subsystem and activated by events emitted from the Stateflow chart
                             called Chart.




 42
2007
TargetLink


Software Component Descriptions                                                                        Model-Based
To integrate the code generated for SW-Cs in the   creation of component descriptions and exports      Design Process with
overall AUTOSAR software architecture, software    the descriptions in XML format.                     the TargetLink
component description files are required. They      The dSPACE Data Dictionary also supports the        AUTOSAR Module
describe which structural elements such as run-    import of existing component descriptions and
nables or ports are used in an SW-C. TargetLink    provides the structural elements they contain for
relieves function designers of tedious manual      further modeling.




At a click, the dSPACE Data Dictionary exports AUTOSAR software component description files
in XML format.




                                                                                                                              43
                                                                                                                              2007
Production Code Generation Software


                                   Managing Data with the dSPACE Data Dictionary
       Central Data Container      Key Features
                                    Central container for managing ECU data              Full access to code specifics
                                    Convenient administration of variables,              Various import and export formats
                                     scaling formulas, typedefs, etc.                     Full access to all dSPACE Data Dictionary
                                    Tight integration with TargetLink                      objects via powerful MATLAB API



                                   Description
                                   The dSPACE Data Dictionary is a unique data           properties, and you can specify structured data
                                   container that centrally holds the relevant in-       types and use them for variable declarations.
                                   formation about an ECU application for code           Scaling formulas can be entered and used to
                                   generation or calibration. Data dictionary objects    uniformly scale fixed-point signals and param-
                                   can be referenced from TargetLink models, in-         eters in the model. You can import and export
                                   dependently of any model partitioning. You can        standardized or proprietary data and share the
                                   define and manage variables and corresponding          data with the calibration system.



                                   Benefits
                                   The dSPACE Data Dictionary is the perfect tool for    is well structured in a hierarchical tree and can
                                   defining and handling project-related code spe-        also be accessed via an application programming
                                   cifics, even for workgroups. It provides access to     interface (API). It also supports common import
                                   a wealth of additional information, for example,      and export formats, which means that existing
                                   specifics on C modules, function calls, tasks, vari-   and proven definitions, for example, an existing
                                   able classes, data variants and so forth. The data    calibration file, can be used as templates.




                                                                                                                    ������������



                       ���������������                                                                              ���
                          �������

                                                                                                                    ���
                                                                    �����
                                                                  ����������
                                                                                                                    ������������
                                                                                                                    ������������


                                                                       ���                                          �����


                      The data and the model are systematically separated.




 44
2007
TargetLink


Data Structure
The dSPACE Data Dictionary has specific main           objects, loading and saving individual data
areas where you can set the configuration data,        branches and searching the complete dictionary.
the pool data for models (pre-code generation         Selected branches of the Data Dictionary can be
data), and the subsystem and application data         loaded from separate include files, which are
(post-code generation data). Typical user interface   maintained centrally for a whole workgroup.
functions are available, like copying and pasting




                                                                                                          Data Dictionary Manager with
                                                                                                          Treeview, Object Explorer,
                                                                                                          Property Value, and Model
                                                                                                          Browser Window.



Import and Export                                     Data Dictionary API                                 Share Data
The dSPACE Data Dictionary supports various           The dSPACE Data Dictionary MATLAB API gives
import/export formats, including                      you full access to the dSPACE Data Dictionary via
 XML (Extensible Markup Language)                    MATLAB. All the functions necessary for manag-
 OIL (OSEK Implementation Language)                  ing data are available, for example, for creat-
 ASAM-MCD 2MC (Standardized                          ing Data Dictionary objects and defining their
   Description Data, formerly ASAP2)                  properties. With open API interfaces, you can
 Variables and Simulink data objects from/to         easily integrate the dSPACE Data Dictionary into
   MATLAB workspace and files                          company-specific environments. To connect your
                                                      own database to the Data Dictionary, you can
                                                      develop your own export or import functionality.



Prepare for Calibration                               Order Number
After code generation, TargetLink writes a de-        dSPACE Data Dictionary
tailed description of the resulting C code to         (for separate use without TargetLink Base Suite)
the dSPACE Data Dictionary, including lists of         DSDD_MANAGER
generated C modules, functions, variables, type
definitions, scalings, variable classes, etc. This
information is a great help later when you export
data for the calibration of ECU parameters.




                                                                                                                                         45
                                                                                                                                         2007
Production Code Generation Software



                          EmbeddedValidator™

                          Simulink/Stateflow
                          verification environment




       Key Features        Automatic Simulink®/Stateflow® and                    Support of Simulink subsystems
                            TargetLink model validation                           with a large set of open-loop control
                                                                                  blocks (Simulink/TargetLink)
                           Operates on
                            TargetLink generated code                            Powerful verification support by
                                                                                  complete and bounded engines
                           Full support of Stateflow charts
                                                                                 Pattern-based requirements
                                                                                  specification




       Description        Application Area                                      Benefits
                          EmbeddedValidator™ checks models for specified         Model checking analyzes a system with regard to
                          functional properties. It gives function developers   arbitrary input scenarios and can thus be viewed
                          clear information on whether any model meets          as a “complete test” that is performed against
                          the functional specifications under all conditions.    a formally specified requirement. Such require-
                          EmbeddedValidator provides a tool suite for for-      ments may be simple Boolean expressions such
                          mal, automatic, and model-based verification.          as “an error state is never reached”, or more so-
                          It performs model checking for reactive embed-        phisticated ones expressing temporal and causal
                          ded systems designed using Simulink, Stateflow,        properties like “an output is set only after
                          and TargetLink. The tool suite supports Stateflow      certain input values are observed”. This technology
                          charts and a large set of Simulink and TargetLink     results in designs that meet tough requirements
                          blocks for open-loop control. In contrast to con-     regarding robustness and correctness, decreases
                          ventional testing approaches, the model checking      design faults and costs.
                          technology is fully automatic and complete in a
                          mathematical sense, meaning that it can detect
                          every logical design flaw and error in the model
                          being validated.



                          Risk Identification                                    Early Model and Code Verification
                          Open-loop control systems usually have deep           The combination of EmbeddedValidator and
                          dependencies that designers cannot cover com-         TargetLink allows early testing and verification.
                          pletely. Complexity has increased enormously,         Applying EmbeddedValidator‘s model checking
                          as has time-to-market pressure, and as a              method in early development phases not only
                          consequence the error rate is also rising. Today’s    validates models, it is also a step towards pro-
                          embedded control units have such enormous             duction code verification. TargetLink builds the
                          functionality that designers and testers cannot       bridge between verified models and verified
                          ensure correct functioning under all environ-         controllers as it is the only code generator that
                          mental conditions by means of conventional            is officially proven for formal verification with
                          testing methods.                                      EmbeddedValidator.




 46
2007
TargetLink

Main Features
     Feature                           Description
     Range Violation Analysis           Dynamic checks for range violations,
                                          i.e., whether there is a run in which an overflow or underflow for a certain variable occurs.
     Drive to State                     Using the Drive-to-State analysis, you can select one, several, or all the states of a Stateflow chart
                                          and perform the reachability check on them in one verification task.
     Drive to Configuration              Analyses of whether two or more states in different parallel subcharts are reachable at the same point
                                          in time.
     Drive to Property                  Abstract check that constructively tries to reach a state of the system where a certain property holds.
     Requirement Certification           Providing a correctness assertion,
                                          i.e., a safety requirement has to be proven for a Simulink/Stateflow design.
     Failure Analysis Support           For a quick view of the analysis result, EmbeddedValidator provides a waveform diagram view of
                                          all the observables of a design. It also generates an M script for simulation purposes.
     Report Generation                  Detailed application reports contain all the information on the profile,
                                          for example, defined analyses and defined proofs. Formats: HTML, TXT

Order Information1)
                                                                                                                                                Order Number
     OSC - Embedded Systems AG, Industriestr. 11, D-26121 Oldenburg, Germany                                                                             –
     Tel.: +49 4 41 3 50 42-3 30, Fax: +49 4 41 3 50 42-3 64
     info@osc-es.de, www.osc-es.de
1)
      For information regarding system requirements and compatible MATLAB and TargetLink versions, please contact OSC Embedded Systems AG directly.




                                                                                                                                                                    47
                                                                                                                                                                    2007
 Copyright 2007 by dSPACE GmbH. All rights reserved. Written permission is required for reproduction of all or parts of this publication. The source must be stated in any such reproduction.
                                                                                           dSPACE is continually improving its products and reserves the right to alter the specifications of the products contained within this publication at any time without notice.
                                                                                           Brand names or product names are trademarks or registered trademarks of their respective companies or organizations.
     Headquarters in Germany   USA and Canada               France
     dSPACE GmbH               dSPACE Inc.                  dSPACE Sarl
     Technologiepark 25        28700 Cabot Drive            Parc Burospace . Bâtiment 20
     33100 Paderborn           Suite 1100                   Route de la Plaine de Gisy
     Tel.: +49 52 51 16 38-0   Novi . MI 48377              91573 Bièvres Cedex
     Fax: +49 52 51 6 65 29    Tel.: +1 248 567 1300        Tel.: +33 1 6935 5060
     info@dspace.de            Fax: +1 248 567 0130         Fax: +33 1 6935 5061
                               info@dspaceinc.com           info@dspace.fr

                               Japan                        United Kingdom
                               dSPACE Japan K.K.            dSPACE Ltd.
                               West Tower 9F                Unit B7 . Beech House
                               Yokohama Business Park       Melbourn Science Park
                               134 Godo-cho . Hodogaya-ku   Melbourn
                               Yokohama-shi                 Hertfordshire
                               Kanagawa-ken 240-0005        SG8 6HB
                               Tel.: +81 45 338 3361        Tel.: +44 1763 269 020
                               Fax: +81 45 338 3362         Fax: +44 1763 269 021
                               info@dspace.jp               info@dspace.ltd.uk


     dSPACE
                                                            www.dspace.com
01/2007

More Related Content

PPT
Unit ii sensors and actuators
PDF
Automotive Embedded Systems Handbook
PPTX
Model based design-Hardware in loop-software in loop
PPTX
Microprocessor applications
PPTX
Map sensor
PDF
What is HIL (HardWare In The Loop)
PDF
Cruise control & Adaptive Cruise Control
DOCX
chassis control systems
Unit ii sensors and actuators
Automotive Embedded Systems Handbook
Model based design-Hardware in loop-software in loop
Microprocessor applications
Map sensor
What is HIL (HardWare In The Loop)
Cruise control & Adaptive Cruise Control
chassis control systems

What's hot (20)

PDF
Handbook on Functional Testing; HIL | MIL | SIL Testing
PDF
Hardware in loop simulation
PDF
Simulink Stateflow workshop
PPTX
Autosar software component
PDF
MiL Testing of Highly Configurable Continuous Controllers
PPTX
Thesis Presentation
PPTX
Vehicle Safety and Accident Analysis
PDF
ECU ... Engine Control Unit .. Inputs & Outputs _ Explained
PPTX
1628502836912_CAN_TP,DCM&AutosarCAN.pptx
PPTX
UDS: Vehicle Diagnostics in AUTOSAR Software Architecture
PPTX
Autosar fundamental
PDF
Embedded System in Automobiles
PPT
Hardware in Loop System Design
PDF
LMS Imagine.Lab Amesim: Animate your engineering life
PPTX
Automotive Cybersecurity: The Gap Still Exists
PPTX
Adaptive cruise control system by NIKHIL R
PDF
Principles of a vehicle infotainment platform - Hans-Ulrich Michel, BMW
PDF
Driving simulators to support the design of autonomous vehicles
PPTX
AUToSAR introduction
PPTX
Electronic Control Unit(ECU)
Handbook on Functional Testing; HIL | MIL | SIL Testing
Hardware in loop simulation
Simulink Stateflow workshop
Autosar software component
MiL Testing of Highly Configurable Continuous Controllers
Thesis Presentation
Vehicle Safety and Accident Analysis
ECU ... Engine Control Unit .. Inputs & Outputs _ Explained
1628502836912_CAN_TP,DCM&AutosarCAN.pptx
UDS: Vehicle Diagnostics in AUTOSAR Software Architecture
Autosar fundamental
Embedded System in Automobiles
Hardware in Loop System Design
LMS Imagine.Lab Amesim: Animate your engineering life
Automotive Cybersecurity: The Gap Still Exists
Adaptive cruise control system by NIKHIL R
Principles of a vehicle infotainment platform - Hans-Ulrich Michel, BMW
Driving simulators to support the design of autonomous vehicles
AUToSAR introduction
Electronic Control Unit(ECU)
Ad

Viewers also liked (20)

DOC
Shivani_Sethi__Resume
PDF
ECS architecture with Unity by example - Unite Europe 2016
PPTX
Polynomials and Curve Fitting in MATLAB
PDF
Curve fitting
PPSX
Introduction to MATLAB
PDF
Simulation of A Communications System Using Matlab
PDF
MATLAB and Simulink for Communications System Design (Design Conference 2013)
PPT
Simulating communication systems with MATLAB: An introduction
PDF
Фотоматериалы
PDF
How emotional abuse is wrecking your mental health
PPTX
Historia inspiradora 2 solangel barrera
PPT
DOCX
7 câu mẹ nào cũng muốn hỏi khi mang bầu
PPTX
Mobile is your friend, not enemy.
DOCX
Universidad nacional de chimbor
PDF
School of Fish: The MSC End of Term Report on sustainable fish in schools 2015
DOCX
Teoría de las relaciones humanas
PDF
servo press P2113 BA for press fit
PPT
Ponencia experiencia e learning y web 2.0
Shivani_Sethi__Resume
ECS architecture with Unity by example - Unite Europe 2016
Polynomials and Curve Fitting in MATLAB
Curve fitting
Introduction to MATLAB
Simulation of A Communications System Using Matlab
MATLAB and Simulink for Communications System Design (Design Conference 2013)
Simulating communication systems with MATLAB: An introduction
Фотоматериалы
How emotional abuse is wrecking your mental health
Historia inspiradora 2 solangel barrera
7 câu mẹ nào cũng muốn hỏi khi mang bầu
Mobile is your friend, not enemy.
Universidad nacional de chimbor
School of Fish: The MSC End of Term Report on sustainable fish in schools 2015
Teoría de las relaciones humanas
servo press P2113 BA for press fit
Ponencia experiencia e learning y web 2.0
Ad

Similar to Targetlink Presentation (20)

PDF
Cisco career certification paths
PDF
Efficient Product Development for IDEO 2002
PDF
George Washington University - Next Generation of modeling and Solving Tools
PDF
Visio Team Spiral V15 20060407
PDF
Primitives And Design Patterns for Top-Down SOA Implementations
PDF
Creating Tomorrow - System2
PDF
8846 aerospace map front hr
PDF
2012 10 23_3115_rational_integration_tester_tr
PPTX
Viedome Presentation Eu
PDF
2012 10 23_2649_rational_integration_tester_vi
PDF
Connections and Ports in ESX / ESXi
PPTX
Dmaic phases & tools
PDF
Large-Scale Simulator for Global Data Infrastructure Optimization
PDF
Best of Breed OpenStack Compute & Block Storage Cloud... .pdf
PPT
SPRINT 13 Workshop 5 Open changes everything Oliver Morley - The National Arc...
PDF
Kapruch steve
PDF
REST: putting the web back in to web services
PDF
Trahan stuart
PDF
The guard brochure
PDF
[D1]deview 2012 nvidia
Cisco career certification paths
Efficient Product Development for IDEO 2002
George Washington University - Next Generation of modeling and Solving Tools
Visio Team Spiral V15 20060407
Primitives And Design Patterns for Top-Down SOA Implementations
Creating Tomorrow - System2
8846 aerospace map front hr
2012 10 23_3115_rational_integration_tester_tr
Viedome Presentation Eu
2012 10 23_2649_rational_integration_tester_vi
Connections and Ports in ESX / ESXi
Dmaic phases & tools
Large-Scale Simulator for Global Data Infrastructure Optimization
Best of Breed OpenStack Compute & Block Storage Cloud... .pdf
SPRINT 13 Workshop 5 Open changes everything Oliver Morley - The National Arc...
Kapruch steve
REST: putting the web back in to web services
Trahan stuart
The guard brochure
[D1]deview 2012 nvidia

Recently uploaded (20)

PPTX
Cloud_Computing_ppt[1].pptx132EQ342RRRRR1
PDF
Caterpillar Cat 315C Excavator (Prefix ANF) Service Repair Manual Instant Dow...
PPTX
Transmission system. Describe construction & working of varius automobile sys...
PDF
How Much does a Volvo EC290C NL EC290CNL Weight.pdf
PPTX
Business Economics uni 1.pptxRTRETRETRTRETRETRETRETERT
PPTX
Intro to ISO 9001 2015.pptx for awareness
PPTX
Small Fleets, Big Change: Market Acceleration by Niki Okuk
PDF
Volvo EC20C Excavator Service maintenance schedules.pdf
PDF
Volvo EC290C NL EC290CNL engine Manual.pdf
PDF
book-slidefsdljflsk fdslkfjslf sflgs.pdf
PDF
Physics class 12thstep down transformer project.pdf
PDF
Volvo EC20C Excavator Step-by-step Maintenance Instructions pdf
DOCX
lp of food hygiene.docxvvvvvvvvvvvvvvvvvvvvvvv
PDF
Life Cycle Analysis of Electric and Internal Combustion Engine Vehicles
PDF
Volvo EC290C NL EC290CNL excavator weight.pdf
PDF
EC290C NL EC290CNL Volvo excavator specs.pdf
PDF
EC290C NL EC290CNL - Volvo Service Repair Manual.pdf
PDF
Marketing project 2024 for marketing students
PDF
Caterpillar Cat 315C Excavator (Prefix CJC) Service Repair Manual Instant Dow...
PPTX
1. introduction-to-bvcjdhjdfffffffffffffffffffffffffffffffffffmicroprocessors...
Cloud_Computing_ppt[1].pptx132EQ342RRRRR1
Caterpillar Cat 315C Excavator (Prefix ANF) Service Repair Manual Instant Dow...
Transmission system. Describe construction & working of varius automobile sys...
How Much does a Volvo EC290C NL EC290CNL Weight.pdf
Business Economics uni 1.pptxRTRETRETRTRETRETRETRETERT
Intro to ISO 9001 2015.pptx for awareness
Small Fleets, Big Change: Market Acceleration by Niki Okuk
Volvo EC20C Excavator Service maintenance schedules.pdf
Volvo EC290C NL EC290CNL engine Manual.pdf
book-slidefsdljflsk fdslkfjslf sflgs.pdf
Physics class 12thstep down transformer project.pdf
Volvo EC20C Excavator Step-by-step Maintenance Instructions pdf
lp of food hygiene.docxvvvvvvvvvvvvvvvvvvvvvvv
Life Cycle Analysis of Electric and Internal Combustion Engine Vehicles
Volvo EC290C NL EC290CNL excavator weight.pdf
EC290C NL EC290CNL Volvo excavator specs.pdf
EC290C NL EC290CNL - Volvo Service Repair Manual.pdf
Marketing project 2024 for marketing students
Caterpillar Cat 315C Excavator (Prefix CJC) Service Repair Manual Instant Dow...
1. introduction-to-bvcjdhjdfffffffffffffffffffffffffffffffffffmicroprocessors...

Targetlink Presentation

  • 1. TargetLink 2.2 NEW  AUTOSAR support  Extended target simulation and optimization support  Function interfaces with pointers to structures  Multi-edit and merge functionality for the Data Dictionary Manager dSPACE
  • 2. Target Implementation 2 2007 2006
  • 3. Contents Target Implementation 4 TargetLink for Production Code Generation _____________________________ 4 NEW: Production Code for AUTOSAR ECUs _____________________________ 4 Software Quality ___________________________________________________ 9 Software Verification and Validation __________________________________ 11 Production Code Generation Software 14 TargetLink ________________________________________________________ 14 How Do I Get the TargetLink I Need? ___________________________ 17 How Do I Work with TargetLink? ______________________________ 19 TargetLink Block Library for Implementation _____________________ 22 Three Simulation Modes for Testing ____________________________ 26 Scaling of Variables _________________________________________ 30 Proving Test-Efficiency with Code Coverage ____________________ 32 Incremental Code Generation _________________________________ 33 Code Optimization _________________________________________ 34 Automated Document Generation ____________________________ 35 Customized Code __________________________________________ 36 Automation and Process Integration ___________________________ 37 Integration with OSEK/VDX Operating Systems __________________ 38 NEW: Model-Based Design for AUTOSAR Software Components __________ 40 Managing Data with the dSPACE Data Dictionary _______________________ 44 EmbeddedValidator (by OSC Embedded Systems AG) ___________________ 46 3 2007
  • 4. Target Implementation TargetLink for Production Code Generation More than just a production code generator Key Features  Production code generation directly from MATLAB®/Simulink®/Stateflow®  ANSI C code with the efficiency of handwritten code  Optimizations for individual processors  Built-in simulation and testing  NEW: AUTOSAR support (p. 9, p. 40) Introduction High-Quality Code for Mass Production Following successful rapid control prototyping, target implementation is performed. Functions specified in graphical form are converted to production C code and imple- mented on the electronic control unit (ECU) together with the drivers and real-time operating system. Automatic production code generation gives effective support in this process. TargetLink (p. 14), the production code generator from dSPACE, generates production code automatically for graphically specified functions straight from MATLAB®/Simulink®/Stateflow®. This shortens coding and development times drastically and contributes to a considerable improvement in the quality of the production code.  TargetLink (p. 14) Criteria for Successful Production Code There are several criteria for the generated code. It must be:  Very efficient, whether fixed-point or floating-point  Target-optimized if necessary  Human-readable  Configurable and adaptable to company specific coding styles  Easy to integrate with legacy code, base software, and other application software in existing ECUs 4 2007
  • 5. TargetLink ����������������������������������� ����������������������������� �������������������������� ��������������������� ������� ���������� ���� ����� �������� ���������� ������������� �������� ��������������� ���������� ����������� ����������� �������� ������������������ ������ ������ ������ ��������������������������� ���� �������������� Proven Code Generation with TargetLink TargetLink, the well-established production code generation software from dSPACE, meets all the criteria for production code generation and helps function and software developers to get their control strategies from block diagrams to a production-intent ECU faster and more reliably, without compromising code efficiency. Excellent Code Performance Efficiency is the key to production-quality code. It means that a minimum of execu- tion time, RAM resources, ROM resources, and stack size is required to run the code on an embedded processor. TargetLink has been specifically designed for produc- tion-quality code generation and can well match human programmers’ efficiency in terms of memory consumption and execution speed – without compromising read- ability. TargetLink meets the high standards for production-quality code generation through a variety of state-of-the-art technologies. Numerous benchmarks and user experience reports show that TargetLink code is broadly similar to what the human programmers produce. 5 2007
  • 6. Target Implementation ������ �������� ���� ���� ���� ���� ���� ��� ��� ��� ��� ��� ��� ��� ��� �� �� �������� ����������������� �������� ����������������� ������ ���������� �������� ������� ���� ���� ���� ���� ��� ��� ��� ��� ��� ��� ��� ��� �� �� �������� ����������������� �������� ����������������� Benchmark results comparing TargetLink code with handwritten code on different processors. Target-Optimized Code One of TargetLink’s strength lies in its target awareness. This means generating code for a specific compiler/processor combination and running it on an evaluation board during simulation. Most common processors for embedded applications, especially in the automotive field, are supported by TargetLink. Code Configurable According to Customer Wishes Production-quality code generation involves more than just efficiency. When code runs on preconfigured prototyping hardware, it is irrelevant how it looks. But when code is to be implemented on a production ECU, many of its details become quite important. The memory layout needs to be managed, there need to be efficient ways to link to external code, and the code output format must comply with specific standards. TargetLink‘s code output generation can be highly customized to meet these needs. 6 2007
  • 7. TargetLink Process Integration To provide the full benefits of automatic production code generation, the code generator has to be optimally integrated into the development process and tool chain, and interact seamlessly with the model-based design tool. Open interfaces and options for tool automation are useful for connecting with other tools, auto- mating work steps, and preparing and supporting later development phases such as unit and module tests. TargetLink is easy to integrate into existing development environments. All pro- cesses can be automated via the TargetLink API (application programming interface). TargetLink comes with a comprehensive data management tool called the dSPACE Data Dictionary. This is the key aid when data has to be kept independently of models, and imported to or exported from existing in-house data dictionaries or other file formats (such as M, MAT, and XLS files). TargetLink can also automatically generate an ASAM-MCD 2MC (ASAP2) file containing all the information about measurable and calibratable variables generated by the Code Generator. For implementation on OSEK/VDX-compliant operating systems, TargetLink generates code according to the OSEK/VDX OS standard. It is perfectly suited to a seamless devolopment process for AUTOSAR ECUs. Integrated Test Environment One major advantage of using model-based design methods and tools is the ability to perform early verification by means of simulation. TargetLink supports several different simulation modes which allow the correctness of an implementation, i.e., the code generated by TargetLink, to be tested directly. This is done by comparing simulation results with results from reference simulation. Automated testing with TargetLink is supported by MTest, the test environment for the control design phase. 7 2007
  • 8. Target Implementation Benefits Bridging the Gap Automatic production code generation bridges the gap between model-based function design and production software development. It converts each model quickly and reliably into highly efficient production code. The major benefits of using TargetLink for code generation are increased software quality and reduced development time. Improved Quality A code generator can convert an executable specification with a lower implementa- tion error rate than a human programmer. Manual translation, with iterations and frequent changes, is not only time-consuming but also extremely error-prone, and consistency between the software design specification and the code is often lost. This is not the case when code is generated automatically. A code generator translates the model and the changes made to it into code reliably, reproducibly, and consistently, whenever required. It ensures that the generated code is always consistent with the software design. It is also easy to keep the documentation up to date, as this can be generated along with the code. Automatic production code generation keeps software design, implementation, and documentation in sync. And with TargetLink, the automatically generated ASAM-MCD 2MC (ASAP2) file for calibration is always up-to-date and consistent with the model. Reduced Development Time Together, model-based development and automatic code generation cut the time needed for coding. But that is not all: In the iterative process of ECU software development, they also speed up iterations. Moreover, you can implement and try out changes fast, and verify their impact immediately via simulation – once more saving time and avoiding errors. Overall, TargetLink allows you to cope with increasing complexity despite shorter development times, without compromising quality. Our customers routinely generate large parts of their ECU code with TargetLink, and save up to 50% of their total development time for ECU code by doing so. Benefits at a Glance Development times are reduced and quality is enhanced by:  Integrated development process  Reduced coding times  Fewer implementation errors  Quick modifications  Direct verification via simulation  Early error detection  Early testing on target processor  Consistency between model, code, documentation and ASAM-MCD 2MC (ASAP2) file 8 2007
  • 9. TargetLink NEW: Production Code for AUTOSAR ECUs AUTOSAR (AUTomotive Open System ARchitecture) is an industry partnership that aims to establish an open standard for automotive electric/electronic (E/E) architectures. The standard provides a basic infrastructure for modular and distributed application code that is platform-independent and reusable. The AUTOSAR Software Architecture The AUTOSAR architecture has three main parts:  AUTOSAR software components (SW-Cs)  Run-time environment (RTE)  Basic software ������� ������� ������ ������ ��� ���������������� ��������������������������������� �� ��� ��� ��� �������������� The three main parts of the software architecture. The actual application code is contained in the SW-Cs, and this is the part TargetLink generates code for. Development Process The methodology proposed by the AUTOSAR initiative shows that future AUTOSAR- compliant ECU developments will be highly reliant on efficient tool-support and on seamless development processes with a high degree of automation. TargetLink plays a vital role in the AUTOSAR-compliant development process, as it bridges the gap between the model-based design approach and AUTOSAR-com- pliant code generation. TargetLink specifically supports designing and generating production code for AUTOSAR software components (SW-C), which constitute the application code in the AUTOSAR software architecture (p. 40). Modeling and Simulation With TargetLink, AUTOSAR‘s structural elements, such as runnables, ports, and communication interfaces, are specified directly at block diagram level. Besides modeling and code generation for SW-Cs, TargetLink also lets you simulate the modeled AUTOSAR software component designs in early phases of the development process (p. 42). Implementation Another feature that makes code generators so useful is the automatic generation of software component descriptions, which would be tedious to produce manually and nearly impossible to keep consistent with the models. Software component descriptions are required by architecture tools, which are used to import and connect the SW-Cs. TargetLink can generate a consistent software component description file together with the code (p. 43). As a whole, TargetLink greatly simplifies the transformation of function models into AUTOSAR-compliant software components and provides significant benefits for an AUTOSAR-compliant development process. 9 2007
  • 10. Target Implementation Software Quality As a company committed to software quality, dSPACE applies a variety of methods to ensure the highest standards for its software products. ISO/IEC 15504-Compliant Development Process ISO/IEC 15504 (also known as SPICE1)) is an international standard for software processes. Its underlying concept is that a mature software product requires a mature development process. dSPACE has dedicated itself to an ISO/IEC 15504-compliant development process. Internal Software Quality Management An internal quality department, the dSPACE quality management team, proactively manages software quality at dSPACE. The team leads software improvement activities, sets internal standards, conducts internal assessments, and provides consultation services to all software groups. It acts independently and ensures that the highest product quality goals are consistently achieved and sustained. MISRA C The British MISRA2) C standard is a widely accepted C subset for projects in the automotive industry. Its aim is to define rules for avoiding common software errors that can occur when software engineers write software by hand. Most of these rules also make sense for machine-generated code. TargetLink-generated code respects the vast majority of MISRA C rules. If deviations from the MISRA C standard are a technical necessity, they are identified and well documented. dSPACE makes this document available to all TargetLink customers. Certified Code TargetLink code is in production in numerous applications, some of which are safety- related – for example, the development of avionics systems. TargetLink-generated code was certified according to RTCA3) DO-178B Level A, the highest safety level, meaning that a software failure would have catastrophic consequences for the aircraft. 1) SPICE: Software Process Improvement and Capability Determination 2) MISRA: Motor Industry Software Reliability Association 3) RTCA: Radio Technical Commission for Aeronautics 10 2007
  • 11. TargetLink Software Verification and Validation Aspects of Testing Model-Based Testing As software grows in complexity, and development cycles speed up, the software that is produced must be tested as early and as exhaustively as possible. Testing is seen as a key element in quality assurance. Model-based development methods are shifting tests from code level to model level. In the earlier development phases especially, there is still great potential for complementing largely experimental development procedures with methods of model-based, automated testing. Typical test activities in model-based function development are model-in-the-loop, software-in-the-loop, and processor-in-the-loop simulation, with back-to-back methods based on them; black-box approaches such as the classification tree method; white-box methods with coverage measurement at model and code level; and in the broader sense also formal verification. Simulation Modes in TargetLink Systematic use of the simulation facilities available in MATLAB®/Simulink®/Stateflow® enables developers to perform fast, simple checks on the results obtained and on the modifications and adjustments that have been made, during the development process. Three different simulation modes involve simulating the function model, the generated code on the development PC, and the generated code on an evaluation board. This means that testing can be performed stepwise: ����������������� �������������������� ��������������������� ���������������� ����������������� �������������������������� ���������������� ������������������������������� ������������������������������� �������������������������������  Simulating the function model as an executable specification is generally known as model-in-the-loop (MIL) simulation.  Simulating the generated code on the development PC (host PC) is known as software-in-the-loop (SIL) simulation. The generated code is translated by a host compiler.  Simulating the generated code on an evaluation board, which will typically contain the processor used in the ECU, is known as processor-in-the-loop (PIL) simulation. The generated code is translated by the appropriate target compiler. TargetLink supports all these simulation modes. A unique feature of TargetLink is that it logs signal traces during simulation, providing visual feedback of simulation results from different simulation modes. The results can be compared directly and used for further automated analysis.  TargetLink (p. 27) 11 2007
  • 12. Target Implementation Model-Based Testing Systematic Testing with MTest One of the great advantages of model-based function and software development is that model-based testing can be done in parallel. Hundreds or even thousands of tests can be developed, maintained, and performed conveniently with the aid of a model- based test environment. All the tests can be stored and administered consistently, so that they can be performed repeatedly (“regression testing”) and reproduced at any time. MTest, dSPACE’s test environment for systematic and automated testing during function development, is a powerful tool for managing large test projects. It automates model-based, systematic testing in conjunction with TargetLink and covers all the necessary tasks:  Model-based testing early in the development process  Back-to-back tests between model and code  Systematic test development  Automated test execution, evaluation, and documentation  Open interfaces for test data and test evaluation functions  Test project management MTest can perform a wide variety of tests systematically and automatically for early function design validation. It supports all TargetLink’s simulation modes, so back-to- back tests can be run for all test phases throughout function development. MTest stores and manages all the tests belonging to each function model. The tests can be reused at any time. 12 2007
  • 13. TargetLink Coverage Analysis Model-Based Testing Comprehensive simulations are complemented by code coverage analysis. While Simulink provides various coverage metrics at model level, TargetLink supports the measurement of statement coverage and decision coverage at code level during the simulation or test run. For example, parts of the code that are never executed, despite a large number of tests, are identified, and then further test cases can be defined specifically for them. In individual cases, specific parts of the model or code may even be removed, if they are unreachable and therefore superfluous (dead code).  Code Coverage (p. 32) Model Validation by Formal Verification OSC - Embedded Systems developed the EmbeddedValidator, a tool for the automatic validation of Simulink®/Stateflow® models, based on TargetLink-generated C code. EmbeddedValidator checks models for specified functional properties and gives function developers clear information on whether any model meets the functional specifications under all conditions.  EmbeddedValidator (p. 46) 13 2007
  • 14. Production Code Generation Software TargetLink Automatic production code generator Key Features  Production code generation directly  Optimizations for individual from MATLAB®/Simulink®/Stateflow® processors  ANSI C code with the efficiency of  Built-in simulation and testing handwritten code  NEW: AUTOSAR support Description Application Area Key Benefits Graphical programming using elements such as Converting graphical models directly into produc- blocks or state diagrams is an evolutionary step in tion code ensures perfect consistency between programming languages. TargetLink is a software model and code at all times. Since the same system that generates production code (C code) model will always result in the same proven code, straight from the MATLAB/Simulink/Stateflow TargetLink’s code generation is deterministic and graphical development environment. Code gen- thus guarantees the highest software quality. eration options range from plain ANSI C code Every step can be tested against the specification to optimized fixed- or floating-point code for via the built-in simulation features. This allows certain processors. Versatile code configuration early verification and translates directly into cost options ensure that the production code copes reduction, for example, in the break-even time with processor constraints. and the cost of software defects. Efficient Coding Seamless Tool Chain Efficiency is the key to production-quality code. TargetLink seamlessly connects function develop- Efficient code means that a minimum of execu- ment and code generation for the control unit tion time and resources is required to run the or prototyping hardware. Moreover, it closes the code on a cost-efficient embedded processor. gap between the design and verification phases Practical experience shows that code generated by automatic means. This provides transparent with TargetLink is as efficient as handwritten and defined development processes for con- code. Apart from benchmark performance, fac- ventional and AUTOSAR ECUs. Calibration files, tors such as human readability, traceable model/ AUTOSAR software component descriptions, and code dependency, and last but not least, the comprehensive documentation are generated in target awareness of the code, are what makes addition to the production code. TargetLink such a useful tool. 14 2007
  • 15. TargetLink Main Features and Benefits Feature Description Benefit Efficient code  Efficient fixed-point or floating-point production  Your specifications – models and diagrams – code directly from MATLAB/Simulink/Stateflow are directly translated into efficient C code Code reliability  Consistent, deterministic translations of models  Errors are avoided into stress-tested C code Target optimizations  Code optimization for individual processors/  Highly efficient code that can cope with compilers processor constraints Incremental code generation  Code generation for certain subsystems  Faster code generation, approved code does not need to be touched Code coverage analyses  Dynamic analyses of program execution to find  Potential problems are detected areas that have not been run through Human readability  Concise, yet readable code  Easy code reviews Automatic scaling  Intelligent scaling based on worst-case  Precision is ensured propagation of signal ranges and simulation based scaling Test mechanisms  Various mechanisms to test the production code  Malfunctions found at earliest stage against the specification (MIL, SIL, PIL) Compliance with standards  Compliance with relevant quality and  Guaranteed quality and interoperability functionality standards Multirate code  Full support of multirate systems with intertask  You can already define tasks at block level communication Support of OSEK/VDX-  Support for the standardized OSEK/VDX  You can design multirate software that is compliant operating systems interface and features compliant with OSEK operating systems NEW: AUTOSAR support  Support for modeling and code generation for  TargetLink 2.2 bridges the gap between model- AUTOSAR software components (SW-C), based design and AUTOSAR-compliant software and generation of SW-C descriptions development dSPACE Data Dictionary  Central container to handle variables, data  You can manage complex data to plan and structures, scaling formulas, tasks, functions structure your projects TargetLink Blockset  A free TargetLink blockset that can be used  Large workgroups can work with TargetLink without having the Base Suite installed models without the need for additional TargetLink licenses Calibration data generation  Calibration data exported as ASAM-MCD 2MC  Automated and complete process with perfect (ASAP2) file for calibration tools consistency between model and calibration data Documentation  Automatic model and code documentation  Your projects are transparent and trackable Order Information Classification Type Order Number TargetLink Base Suite Base Suite  TBS Target Optimization Modules Freescale HCS12/HC12/Cosmic  TOM_HCS12/Cosmic for certain processors/compilers Freescale HCS12/Metrowerks  TOM_HCS12/Metrowerks (further details see p. 199) Freescale MPC5xx/Wind River Diab  TOM_MPC5xx/Diab Freescale MPC5xx/Green Hills  TOM_MPC5xx/GREEN NEW: Freescale MPC55xx/Wind River Diab  TOM_MPC55xx/Diab Infineon C16x/Altium Tasking  TOM_C16x/Tasking Infineon TriCore/Altium Tasking  TOM_TriCore/Tasking Renesas M32R/GAIO  TOM_M32R/GAIO Renesas SH-2/Renesas  TOM_SH2/SHC Other modules Target Simulation Module (for all supported  TSM processors) TargetLink Module for Operating Systems – OSEK  TMOS_OSEK NEW: TargetLink AUTOSAR Module  TAS dSPACE Data Dictionary Manager (included)  DSDD_MANAGER 15 2007
  • 16. Production Code Generation Software Relevant Software and Hardware Software Included Stand-alone blockset for free model exchange  TargetLink blockset Data dictionary  dSPACE Data Dictionary Required Integrated development environment  MATLAB®/Simulink®/Stateflow® from The MathWorks  Compiler for host simulation included in MATLAB Operating system  Windows 2000 or Windows XP (32-bit version only) Optional Compilers for processor-in-the-loop tests  Target-specific compiler for processor-in-the-loop tests with Target Simulation Module Hardware Required Minimum system  Pentium III processor, 800 MHz  512 MB RAM, 350 MB free disk space Recommended system  Pentium 4 processor, 1.6 GHz or higher  Memory ≥ 512 MB RAM, 350 MB free disk space NEW: Additional TargetLink 2.2 Features Improvement Detailed Description Model-based design for AUTOSAR ECUs  New AUTOSAR blocks for specifying AUTOSAR‘s structural elements, such as runnable entities, ports, etc.  Code generation for AUTOSAR software components (SW-Cs)  Export of software component descriptions to integrate the generated SW-Cs in an AUTOSAR software architecture Function interfaces with pointers to structures  TargetLink 2.2 now also supports pointers to structures in the function signature, which is particularly efficient where there are a large number of function parameters and provides extended flexibility for structuring the code. Target Optimization Module (TOM) for MPC55xx  Optimized code generation for MPC55xx/Windriver Diab compiler Target Simulation Module (TSM) extensions  Freescale MPC5554/Metrowerks CodeWarrior and GNU compilers  Freescale S12X/Cosmic compilers  NEC V850 Demonstration Kit F_Line – Drive It/NEC compilers  Infineon TC1766/Tasking compilers  Infineon TC1796/GNU Hightec compilers More flexible code generation  TargetLink’s numerous code generation options have been extended, for example, with regard to variant coding, and by access functions for structures and bitfields. All Code Generator settings can now be edited via a convenient user interface. Extended modeling options  TargetLink 2.2 not only allows numerous blocks to inherit properties, it also supports bus-capable blocks and code generation for nested graphical functions in Stateflow. Multi-edit functionality with the new Object  The new Object Explorer pane provides an overview of multiple objects and Explorer pane in the Data Dictionary Manager selected properties and allows the properties of multiple data dictionary objects such as variables to be modified simultaneously, which greatly simplifies the handling of large data volumes with the Data Dictionary Manager. Improved model-code traceability  Code files can be optionally generated in HTML format, with hyperlinks for navigation from model to code and vice versa at a click. This improves overall traceability and simplifies code reviews. Requirements Management Interface  TargetLink 2.2 now preserves requirements information during model conversion from Simulink to TargetLink and TargetLink to Simulink, making it easier to use Simulink’s Requirements Management Interface from inside TargetLink. 16 2007
  • 17. TargetLink How Do I Get the TargetLink I Need? TargetLink Modules Module Overview TargetLink is available as a base suite plus addi- tional modules, so that you can adapt it to requirements. �������������������������� ������ ���������� ���� ��������� ������������ ���������� �� �� ����������� ����� �������� ���������� ��������� ��������������� ���������� ����������������������������� ���������� ���������� ��������� �������� �������� ������ ����������������� ������ ���� ������� ��� ���� ������������ ������ ������ ���������� ���������� ��������� ���� �������� ������������������� ����� ������� ���� ���� ���� ���� ������������������� ���������� ���������� ���������� ��������� ��������� �������� �������� ������� ����� ������ ������� ���� ������� ���� ���� ����������� �������� ��������������� �������������� ������� 1) Usable in stand-alone mode without license 2) Data Dictionary Manager also available as a standalone licence e.g to be used with the standalone blockset TargetLink Base Suite Target Simulation Module (optional)  Highly efficient ANSI C code generation  Test your generated code on the target from MATLAB/Simulink/Stateflow microcontroller  For all microcontrollers with ANSI C (for supported processors and evaluation compiler boards see p. 18)  Fixed-point code, floating-point code or a mixture of both  dSPACE Data Dictionary (p. 44)  TargetLink blockset (p. 22)  Floating network license available for flexible use of TargetLink in development groups Target Optimization Modules (optional) TargetLink Module for Operating Systems  For target-specific, optimized code (optional) generation  Support of OSEK/VDX-compliant operating  Uses compiler-specific language extensions systems (p. 38) and assembly macros (for supported processors see p. 18) NEW: TargetLink AUTOSAR Module (optional)  Support for the development of AUTOSAR Software Components (SW-C) (p. 40) 17 2007
  • 18. Production Code Generation Software Processors and Supported Processors and Evaluation Boards Evaluation Boards TargetLink supports most processors for embed- ded applications, especially in the automotive field. If a processor is missing, its support is perhaps scheduled for the next version or can be provided as an engineering service. Please inquire. ANSI C Compiler Supported by Compiler Supported by Evaluation Boards Processor Family Code Target Optimization Module Target Simulation Module Supported by TargetLink Support Any microprocessor with  – – – an ANSI C compiler Freescale HCS12  Cosmic compilers and Cosmic compilers and MCT HCS12 T-Board and Metrowerks CodeWarrior Metrowerks CodeWarrior Freescale M68EVB912DP256 compilers compilers Freescale S12X  – Cosmic and Metrowerks MCT S12X T-Board CodeWarrior compilers Freescale MPC5xx  Green Hills and Wind River Green Hills, Metrowerks Axiom CME-0555 and Diab compilers CodeWarrior, and Wind River Axiom CMD-05651) Diab compilers Freescale MPC55xx  Wind River Diab compilers Green Hills, Metrowerks Axiom MPC5554DEMO CodeWarrior, GNU and Wind River Diab compilers MicroTec and Wind River Diab dSPACE DS1603 compilers Infineon C16x  Altium Tasking compilers Altium Tasking compilers i+ME eCAN C167 CR Infineon TriCore  Altium Tasking compilers Altium Tasking and GNU2) Infineon TriBoard TC1775, compilers TriBoard TC1766 and TriBoard TC1796 NEC V850  – Green Hills and NEC compilers NEC Demonstration Kit F_Line - Drive It Renesas H8S  – Renesas compilers Renesas EVB2633F Renesas M32R  GAIO compilers GAIO and Renesas compilers Renesas MSA2114 Renesas SH-2  Renesas compilers Renesas compilers Renesas EVB7055F and CDK7058 STMicroelectronics ST10  – Altium Tasking compilers FS Forth-Systeme STart276 Development Board Texas Instruments  – Texas Instruments compilers Texas Instruments TMS470R1x TMS470 1) Only Wind River Diab Compiler supported. 2) Only for TC1796 Some of the evaluation boards need to be modi- For more information on software compatibility fied (loader, external RAM, etc.). Please order with target compilers and evaluation boards, them through dSPACE to ensure a correct board please refer to: setup. www.dspace.de/goto?compatibility Engineering Services TargetLink Engineering Services Our engineering portfolio offers special TargetLink  Integration of TargetLink with customer services: your development environment  Knowledge transfer through dSPACE  Development of target modules for consultants (on-site and off-site) supporting customer-specific processor/  Hands-on support: Our engineers can join compiler combinations your project team during evaluation and  Development of customer-specific code introduction of TargetLink output templates according to company code style guides 18 2007
  • 19. TargetLink How Do I Work with TargetLink? Typical Steps in Generating Production Code This diagram illustrates the workflow between model design and code implementation. It also shows that code verification based on simulation is an iterative process. The workflow is shown in greater detail on the following pages. 19 2007
  • 20. Production Code Generation Software Workflow Control Design and Function Prototyping Control design starts with creating a control model in the integrated design environment MATLAB/Simulink/Stateflow. Before production code generation with TargetLink, you could use dSPACE prototyping systems to carry out con- venient function prototyping and validation of your new ECU control algorithms. Using the TargetLink Block Library To implement the control algorithms in C code, you need the TargetLink block library. TargetLink blocks contain additional data for code genera- tion, such as the scaling information for fixed- point variables, variable classes, variable names etc. A utility automatically replaces your Simulink controller model with blocks from the TargetLink block library. The process is reversible without any data losses. If you already use the free TargetLink Blockset during control design, conversion is not necessary. Model-in-the-Loop Simulation on Host PC Model-in-the-loop simulation (floating-point) serves as a reference for the following steps and provides the minima and maxima of variables as a basis for subsequent fixed-point scaling if desired. 20 2007
  • 21. TargetLink Automatic or Manual Scaling Workflow If you want to generate fixed-point code, the scaling has to be specified. Scaling can be done manually, or by simulation-based autoscaling or worst-case autoscaling. You can choose from a broad range of scaling options for each TargetLink block individually. Code Generation The TargetLink Base Suite generates highly efficient ANSI C code for a controller model at the click of a button. This code efficiency can be increased even further by generating code for a specific compiler/processor combination using a Target Optimization Module (see p. 17, p. 18). Verification on Host PC via Verification on Target Processor via Software-in-the-Loop Simulation Processor-in-the-Loop Simulation By means of software-in-the-loop simulation on Using the optional Target Simulation Module a host PC, you can compare the behavior of the (see p. 17, p. 18), you can execute processor-in- generated code with the reference data achieved the-loop simulation to verify the generated code in model-in-the-loop simulation. TargetLink offers on an evaluation board equipped with the same an intelligent graphical user interface, where you target processor as your final ECU. Successful can select signal histories of blocks for detailed verification of processor-in-the-loop simulation analysis. with model-in-the-loop simulation and softwa- re-in-the-loop simulation ensures the software quality of the generated code. TargetLink also provides information on the code size, the re- quired RAM/ROM, and the stack consumption as it evolves over time. The execution time can be displayed as well. 21 2007
  • 22. Production Code Generation Software TargetLink Block Library for Implementation Extended Implementation-Specific Information Block Functionality The Simulink block library is very powerful in have an extended dialog which allows you to simulation tasks. It provides all the necessary enter the implementation-specific information specification features for the job. When it comes necessary for code generation. Each block also to code generation, however, more information provides a means of data logging, overflow de- is needed for each block. That is why there is a tection, and saturation simulation. A converter TargetLink block library. The TargetLink blocks automatically replaces each supported Simulink significantly extend the functionality of the block with the corresponding TargetLink block. supported Simulink blocks. TargetLink blocks TargetLink block dialog for entering implementation-specific information like data type, variable name, scaling data etc. 22 2007
  • 23. TargetLink Free Model Exchange TargetLink Blockset The TargetLink Blockset is a stand-alone version TargetLink Blockset offers the following of the block library used with the TargetLink Base features: Suite that allows model transfer without model  Free model exchange in workgroups conversion. The TargetLink Blockset is compatible without conversion with The MathWorks’ Real-Time Workshop® and  Simulating in floating-point precision can be used on any computer that has MATLAB/ with Simulink Simulink installed. Thus, TargetLink models can  Code generation be exchanged freely without the need for extra with Real-Time Workshop TargetLink licenses. Linkage Between Control Design, Prototyping and Implementation You can use the free TargetLink Blockset to the TargetLink Blockset allows you to use the design and prototype your controller without same models for rapid control prototyping and TargetLink installed. TargetLink blocks can be production code generation without model con- used for rapid control prototyping on dSPACE version. Development iterations are thus easier hardware. Although the added functionality of to perform and less prone to error. the TargetLink blocks is not available in that case, ������������������������� �������������� � � �� � �� ���������� ������ ����������� ������ ����������� ������������������ ���������� ������������ ������������������ ��� Rapid control prototyping with Real-Time Workshop and dSPACE hardware does not require model conversion. 23 2007
  • 24. Production Code Generation Software Block Overview TargetLink Block Library These TargetLink blocks extend corresponding blocks in the Simulink block library. Directly Supported Simulation Blocks These Simulink blocks are directly supported by TargetLink. 24 2007
  • 25. TargetLink TargetLink Utility Blocks Block Overview TargetLink Utility blocks provide access to specific features of TargetLink or further specify the code generation process for the model. Multirate Blocks The TargetLink multirate blocks make multirate operating system objects available in block diagrams. There are even OSEK-specific blocks like the CounterAlarm. NEW: AUTOSAR Blocks Model-based design for AUTOSAR ECUs is supported by blocks for structural elements such as runnables, ports, and certain communication elements. Handling Large Models with Block Configurations the Property Manager Since it is time-consuming to change the proper- ties simultaneously. For Stateflow objects this ties of large models via block dialogs manually, includes charts, events, states and data. The TargetLink provides the Property Manager. This Property Manager provides a tree view of the is a graphical user interface that displays the model’s subsystem hierarchy, a list of blocks in properties of TargetLink blocks and Stateflow each subsystem, and a configurable list of proper- objects in a model. The Property Manager allows ties for each block. you to view, filter and modify several proper- The Property Manager for handling models with numerous blocks. 25 2007
  • 26. Production Code Generation Software Three Simulation Modes for Testing Confirmation Comparing Simulation Results Test Against Specification by Simulation Although code generators produce virtual- Verification means checking the implementation ly flawless results when compared to manual against the specification. The specification is the programming, the generated code still needs to simulation model, as executed by Simulink and be tested as well as the underlying specification. Stateflow. The executable and approved specifica- TargetLink provides powerful and easy-to-use tion is used as a reference. The implementation is means to verify the generated code. The code the generated and compiled C code, as executed tests are performed in the same simulation envi- by the target processor. TargetLink provides a ronment that was used to specify the underlying 3-step verification process which shows at a simulation model. Functional identity has been click that specification and implementation are achieved when simulation results match. The functionally identical. On the basis of a controller validity of tests is documented by a C0 or C1 model, TargetLink performs simulations of the code coverage analysis. model, the generated code on the host, and the generated code on the target, without additional model modifications or preparations. Three-Step Model-in-the-Loop Simulation Verification Process The first step is to record data for reference plots Model-in-the-loop simulation also serves other from the simulation model. Signals from selected purposes. It is used for detecting overflows of blocks and state variables are automatically integer variables, and its results are used for logged by TargetLink. The model-in-the-loop simulation-based autoscaling. simulation captures the specified behavior of the model that is to be implemented in C code later on. The recorded signal plots act as the reference for the next verification steps. ����������������� �������������������� ��������������������� ���������������� ����������������� �������������������������� ���������������� ������������������������������� ������������������������������� ������������������������������� TargetLink performs the three different simulation modes without any changes to the model or the generated code. Software-in-the-Loop Simulation Software-in-the-loop means the code is gene- the host PC instead. The signal plots should be rated and replaces the controller blocks in the largely identical when compared to the results of same simulation model (for example, same model-in-the-loop simulation. If they are not, plant and stimulus signals). TargetLink does they can be analyzed to get a better understan- this automatically in the background. You still ding of the cause of the deviation and to fine- see, though it is the code that is executed on tune the fixed-point settings. 26 2007
  • 27. TargetLink Processor-in-the-Loop Simulation Three-Step Finally, the generated code runs on an embedded with the target compiler and downloaded to Verification Process processor. Code that runs correctly on the host the evaluation board. TargetLink manages the PC can still cause trouble on the target processor. communication between the host PC and the To check that this does not happen, TargetLink evaluation board. All these activities are auto- offers processor-in-the-loop simulation. An off- mated and need no user interaction. Simulation the-shelf evaluation board is connected to the on an evaluation board just takes two mouse host PC, and the generated code is compiled clicks. Compare Plots Efficient Approach Display Results The simulation results are automatically plotted This 3-step approach, using model-, software- in the same plot window that was used by the and processor-in-the-loop simulation, is easy, other simulation modes. This is a convenient intuitive, and quick. As a result, tests can be way to compare the results of simulations in carried out more frequently, which increases different modes directly. For example, if plots software quality. from processor-in-the-loop simulation deviate from software-in-the-loop simulation, the most likely cause is a bug in the target compiler or a problem with the processor. Signals from MIL and SIL simulation are displayed and can be analyzed to measure deviations. Complete Simulation Support Unparalleled TargetLink systematically utilizes all the available Simulation Concept simulation options to give users an unique simulation environment. MIL, SIL, PIL Simulation at a Click Integrated Data Logging Switching from MIL to SIL or PIL simulation TargetLink blocks come with integrated data requires just a click. There is no need for a logging functionality. You can specify if block separate test model or generating S-functions output signals can be logged in the block dialog. or manual insertion into a test harness model. No changes to the model are necessary, i.e., you TargetLink has built-in simulation and logging do not have to insert scope blocks or suchlike. intelligence in all simulation modes. Most importantly, data logging is not limited to MIL simulation but available for all simulation modes without further user interventions. The TargetLink block dialog lets you specify whether to log signal histories – independent from the simulation mode. 27 2007
  • 28. Production Code Generation Software Unparalleled Result Plotting Simulation Concept TargetLink directly visualizes the simulation results Detailed signal analysis can be performed via of logged signals. Simulation results from diffe- additional plot windows that include details rent simulation runs, no matter which simula- about deviations in individual simulation runs. tion mode, are plotted one above the other in This is also available at a click, and you do not the same plot window, using different colors. need to write your own plotting scripts. Signal Analysis In the Detailed Signal Window, you can zoom signals to inspect deviations visually and get a clear picture of the signal behavior. Constraints can be displayed to show immediately whether signals are within defined ranges, which is espe- cially important for scaling. You can use a cursor to scroll through the signal histories and display signal values numerically. The Signal Deviation Window gives you a graph of the deviation between two signals. These tools are all available at a click for convenient analysis. The Signal Deviation Window displays a graph of the deviation between two signals. The Detailed Signal Window lets you inspect signals and displays their values numerically. 28 2007
  • 29. TargetLink Advantages of Built-in Logging Benefits of and Simulation the Simulation Concept  MIL/SIL/PIL simulation at a click  Direct feedback if code generation matches  Built-in data logging and result plotting for model simulation all simulation modes  Especially useful for conversion from fixed  No changes to the model necessary point to floating point  Allows direct comparison of In brief: Great ease of use with unmatched MIL/SIL/PIL results simulation flexibility  Detailed signal analysis and deviation plots Profiling the Code Run-Time Analysis Processor-in-the-loop simulation can also be used you to try out block options, such as selecting to profile the generated code. During simulation, different search routines of a look-up table block. TargetLink automatically measures execution time You can immediately measure the impact of the and stack consumption directly on the target change on code efficiency. Sound implementa- processor. A code summary lists RAM and ROM tion decisions based on accurate benchmarks usage for each function. These features allow become a matter of a few clicks. The results of code profiling: execution time measurement, stack size measurement, and code summary of generated code. 29 2007
  • 30. Production Code Generation Software Scaling of Variables Fixed-Point Accuracy Quick and Accurate Scaling Overflow Detection If TargetLink is to generate only floating-point Another big advantage: fixed-point overflows code, scaling is not necessary. However, if no longer entail hour-long debugging sessions. TargetLink is used to generate fixed-point code, With TargetLink, scaling can be checked during autoscaling can be a huge time-saver. It takes simulation. If an overflow occurs, TargetLink away the tedious and error-prone task of manu- shows the exact location in the block diagram. ally scaling each variable and each operation in The problem can be corrected right away. the software. What took days and weeks in the past can now be done in minutes and hours. Plot overview window indicating an overflow of an outport block. Scaling Choices Scaling Properties Automatic Scaling TargetLink offers a two-coefficient linear scaling These scaling properties give ample choices to method, which is widely used in embedded fine-tune fixed-point code to the conflicting control applications. The properties for specifying requirements of low execution time, high com- fixed-point scalings in TargetLink are: putational precision and overflow avoidance.  Data type Fixed-point scaling can be done manually by a  Power-of-two scaling factor or software engineer, but in most instances it is left arbitrary scaling factor to the autoscaling tools from TargetLink.  Offset value  Constraint values  Bit safety margins  Saturation options 30 2007
  • 31. TargetLink Simulation-Based Autoscaling Worst-Case Autoscaling Efficient Simulation-based autoscaling requires that the When simulation is not possible or deemed Scaling Methods model can be simulated. This necessitates either unfeasible, TargetLink offers the method of a plant model or stimulus data for all inports. autoscaling based on a worst-case range calcula- During simulation, TargetLink records the signals tion. This method requires value range information from each Simulink block and determines the for inports and some specific blocks inside the value range. This allows TargetLink to calculate model. TargetLink propagates these value ranges optimum scaling for each block. The advantage through the model and calculates the best scaling. of this scaling method is maximum computa- The advantages of this scaling method are that tional precision. it does not require a plant model and that over- flows will be prevented. Dialogs to carry out automatic scaling. Scaling with Scaling Formulas and Type Definitions Using scaling formulas is not actually an auto- scaling method; however, it still allows you to scale a model quickly. A complete set of scaling properties is defined under one name in the dSPACE Data Dictionary and selectable in block dialogs or in the Property Manager. This allows you to quickly scale signals of one kind or sub- systems with the same scaling parameters. 31 2007
  • 32. Production Code Generation Software Proving Test Efficiency with Code Coverage Efficiency and Run-Time Analyses Reliability TargetLink offers C0 and C1 coverage analysis. coverage analysis document is generated with This is also referred to as ‘statement coverage’ a coverage overview table and a detailed list- and ‘decision coverage’. ing of the code annotated with the execution During simulation on host or target systems, count numbers for each block. This report deliv- counters document the frequency of execution ers immediate information on test efficiency and for each branch of code. After simulation, a code completeness. Quality and Certification Code branches that have never been executed can be easily identified and test strategies can be adjusted accordingly. Consequently, the cov- erage analysis further contributes to increased software quality and is a prerequisite to code certification. Code Total Reached Unreached Coverage Branches Branches Branches Fuel system 61.87% 139 86 53 Fuel rate controller 58.91% 129 76 53 Fuel rate calculator 56.56% 122 69 53 Correction redundancy 100% 7 7 0 Airflow controller 100% 10 10 0 Airflow calculation 100% 9 9 0 Airflow subsystem 100% 1 1 0 Example of the information provided by code coverage. Annotated code listing with execution counts for each code block. 32 2007
  • 33. TargetLink Incremental Code Generation Working with Subsystems Benefits Handle Large Models Incremental code generation is available for Incremental code generation has several advan- Simulink subsystems which contain a TargetLink tages: Function block. In a team of developers, each  Team members can work independently member can work on a subsystem individually on different subsystems. and just generate code for that. TargetLink per-  Code generation time can be significantly forms the necessary consistency checks when reduced by generating code only for building the overall application from all the subsystems that have been modified. parts.  Code for individual subsystems in a model can be tested and frozen, while development in other subsystems continues. Specifying incremental code generation properties for a subsystem. 33 2007
  • 34. Production Code Generation Software Code Optimization Highly Efficient Optimized ANSI C Code Standard Optimizations Production Code TargetLink generates highly efficient ANSI C TargetLink uses many of the optimization tech- code as a standard. This is achieved by various niques that are also used by C compilers. These optimization techniques, which roughly fall into are optimizations like constant folding, algebraic 3 categories: transformations, dead code elimination, and life-  Standard optimizations span analysis of variables, to name just a few.  Interblock optimization They are standard optimization techniques and  Code pattern libraries are used by TargetLink whenever applicable. Interblock Optimization Interblock optimization combines the code of usually combined in one expression. Code for several blocks in one C code line. TargetLink’s calculating the inputs of a switch block is moved interblock optimization gives the generated code inside the If-Else instruction. The example shows a human touch, because TargetLink combines interblock optimization at work. This technique code in a very similar way to what a skilled soft- saves execution time and ROM size, but most ware engineer would do. For instance, a string importantly, it reduces stack size significantly and of arithmetical, logical, and relational blocks is enhances code readability considerably. Example of Interblock Optimization. Code Pattern Libraries Combining the behavior of several blocks in one C code line works well for smaller functionality. If a block is quite powerful, for example, the 2-D Look-Up Table block or the FIR Filter block, it needs several lines of code. TargetLink takes them from an internal code pattern library during the code generation process. 34 2007
  • 35. TargetLink Optimized Assembly Code Target-Optimized With the optional target optimization module code patterns. Compiler-specific instructions and Code (p. 199, p. 200), processor- and compiler-specific even inline assembly macros are used to deliver language extensions can also be used for code top-notch code performance. Some features of optimizations. This further increases the efficiency a processor core can be used only by applying of the generated code. For every processor/ these coding techniques. This sometimes makes compiler combination supported by TargetLink, the difference in meeting hard real-time require- there is a library containing highly optimized ments and ROM size limits. ANSI-C Optimized Assembly Code Cycles 1232 45 Code size 100 byte 54 byte 64-tap FIR filter, measured with Infineon TriCore/Tasking Compiler: Optimized code is 27 times faster than ANSI-C. Automated Document Generation Consistent Documentation and Model Stay Organized TargetLink does not just generate code, it also subsystems, and simulation plots can also be documents exactly what it does – keeping per- included. Links to the generated C code are fect consistency with the model and the code. provided. Document generation can be custo- An automatically generated document provides mized to specific user needs, for example, the information about function interfaces, global level of detail. Documentation can be generated variables, a list of all measurable and adjustable in the HTML, RTF (for word processing) and PDF variables, scaling parameters, code generator formats. options and much more. Screenshots of models, Production code documentation in HTML. 35 2007
  • 36. Production Code Generation Software Customized Code Code According to Readability Customer Standards TargetLink code is easily readable and has many over variable, function, and file naming, as well comments. Unnecessary macros, function calls, as the flexibility of partitioning the code into cryptic naming, etc. are avoided. Comprehen- functions and files to keep the structure logical sive configuration options give you full control and manageable. Variable Classes You also have full control of how TargetLink be generated before and after each declaration generates variables and, as a consequence, full or block of declarations. To keep things simple, control of how the RAM and processor stack is TargetLink bundles all these properties into utilized. The scope and storage class of a variable ‘variable classes’. They are selectable in block can be specified, as well as other C attributes like dialogs, which saves you a lot of repetitive ‘volatile’ or ‘const’. Even PRAGMA directives can specification work. Variable class specification for a Gain Block. External Code Integration Code Output Formatting TargetLink offers a wide variety of specification TargetLink can generate code in a format that options on the block diagram level for easy exactly matches company-specific C code tem- interfacing with external code such as device plates. Code output can be formatted via an XML drivers, or with any other routine written in C configuration file and an XSL style sheet. This or assembler. allows you to define the format of file and function These are: headers, the format of code comments, and the  Inclusion of external header files inclusion of specific header files. Comments can  Use of external global variables even contain Unicode characters, for example,  Use of externally defined macros to support the Japanese language.  Call to imported functions  Call to access functions or macros  Definition of Custom Code block which contains handwritten C code 36 2007
  • 37. TargetLink Automation and Process Integration Comprehensive TargetLink API Full Access to TargetLink is easy to integrate into existing de- while at the same time providing options for TargetLink velopment environments, because it comes with intervention in the individual process phases. For a comprehensive and fully documented API. This example, “hook functions” allow user tasks to be grants full access to all TargetLink properties and performed at all stages of the build process. settings and allows processes to be automated, ASAM-MCD 2MC File Format Calibration Another important requirement for a code gen- CalDesk support this standard. Since the C code File Generation erator is close links with calibration systems. ECU and the ASAM-MCD 2MC file are generated us- code must be prepared for parameter fine-tuning ing the same data basis, they will always be con- by making calibratable or measurable variables sistent. Thus another error source is eliminated, accessible to a calibration system. For that pur- and the development process streamlined. pose, TargetLink supports the generation of the TargetLink offers several predefined variable class- standardized ASAM-MCD 2MC file format (for- es for calibratable and measurable variables. Ad- merly ASAP2) via the Data Dictionary to make ditionally, you can also specify your own classes, the variables and parameters available for ECU ensuring that each class holds proper attributes calibration. All major calibration tools like dSPACE for calibration and/or measurement. ���������� ���������� �������� ����������������� ������������������ �������������� ����������������������� ����� ������������������� ����� ���������������������� ����� ��������������� � ���������� ������ � ����� ����� ��� ��������������� ��� ������������������ ������������������������� 37 2007
  • 38. Production Code Generation Software Integration with OSEK/VDX Operating Systems Taking Advantage The OSEK/VDX Standard of Standards The OSEK/VDX1) standard was defined by a implementation instructions, the OSEK OS committee of major automotive manufacturers standard provides a concept of a multitasking- and component suppliers to provide an opera- capable, real-time operating system. TargetLink ting system interface for embedded automotive equipped with the OSEK module is fully compliant applications. The major goal is to support the with the OSEK/VDX standard and can generate portability and reusability of the application soft- code for real-time multitasking applications. ware. In addition to a common API definition and The TargetLink OSEK Module OSEK operating system objects and services are TargetLink allows to create multirate models available on the block diagram level once the containing blocks with different sample times. TargetLink OSEK module is installed. For instance, Multirate systems are mapped to operating sys- you can set up alarms, define tasks, or specify tem tasks – periodic or event-driven – in a very intertask communication without leaving the flexible manner. block diagram. Benefits This combination of TargetLink and the OSEK/ in detail. Consistency checks on user inputs and VDX standard gives you huge advantages. A OSEK-aware automatic code generation pre- whole real-time system can be described in one vent common mistakes and shorten the instal- environment. Control algorithms and operating lation and testing phases for ECU software. As system objects are specified in one model. Au- a consequence, development time is reduced tomatic mapping of the model characteristics significantly. Finally yet importantly: the same to operating system objects means there is no code is reusable on other OSEK/VDX-compatible more need to learn the OSEK/VDX specification operating systems. ��������������� ����� ������������ ���������� ������� ����� ����� ������ ����� ����� �������� ����� ���������� ����������� ��������� ��������� ��������� ����������� ��� ��� ��� ������������������������� 1) OSEK: Offene Systeme und deren Schnittstellen für die Elektronik im Kraftfahrzeug (Open systems and their interfaces to automotive electronics), VDX: Vehicle Distributed Executive ; more details at www.osek-vdx.org 38 2007
  • 39. TargetLink Task Specification Intertask Communication Interaction You can specify all the OSEK attributes of a task TargetLink InPort and OutPort blocks allow you with the OSEK in dialogs. The options available include selecting to completely specify communication between Operating System an existing task and creating new tasks, along different tasks. Data can be exchanged using with specifying priority, number of activations, OSEK messages or global variables. The code preemptability, resources used, and associated optionally works with local copies of global events. TargetLink also adds customer-specific variables. Critical code sections can be protected OSEK options to the task dialog, for example, from being preempted. If you do not specify specification of stack sizes. intertask communication manually, TargetLink’s intelligent interblock optimization finds the best setup automatically. OIL File Generation Compatibility As part of the operating system standard, the TargetLink-generated code should run with any specification and generation process involves operating system that is OSEK/VDX-compliant. defining system services and their attributes TargetLink code was specifically tested with the via the OSEK Implementation Language (OIL). following operating systems: TargetLink gives full freedom to use either  Metrowerks OSEKturbo TargetLink’s built-in graphical user interface or  Vector Informatik osCAN the operating system’s dialog-based OSEK con-  Vector Informatik osCANopen figurator for editing the OIL file. The generated  3Soft ProOSEK code and operating system are automatically  WindRiver OSEKWorks consistent.  LiveDevices RTA/OSEK Specifying task properties on block diagram level. 39 2007
  • 40. Production Code Generation Software NEW: Model-Based Design for AUTOSAR Software Components TargetLink The TargetLink AUTOSAR Module AUTOSAR Module The optional TargetLink AUTOSAR Module makes converted directly into AUTOSAR-compliant TargetLink’s modeling, simulation and code gene- production code. ration features available for designing AUTOSAR  Learn more about AUTOSAR and the role software components (SW-Cs). Developers can TargetLink plays in an AUTOSAR-compliant specify AUTOSAR structure elements, such as development process in Target Implemen- runnables, ports, and communication interfaces, tation (p. 9) simply at model level. Model-based designs are Functionality Benefits  Model-based design for AUTOSAR software  Efficient and easy modeling by using components (SW-Cs) proven workflows for AUTOSAR  Code generation for AUTOSAR SW-Cs  Code generation compliant with AUTOSAR  Generation of software component standard descriptions  Easy migration of existing TargetLink  Simulation of SW-Cs in all three simulation models to AUTOSAR modes (MIL/SIL/PIL)  Tests and verification of SW-Cs in early design phases  No tedious manual creation of software component description files  Easy integration of code and software component descriptions in AUTOSAR infrastructures In brief: You get from model to AUTOSAR- compliant code faster. TargetLink AUTOSAR Block Library The library offers the following AUTOSAR  Client ports to initiate client/server blocks: communications, for example, calling a  Runnables – the executable elements service in the underlying AUTOSAR basic  Runnable inports and outports for software specifying data exchange  SW-C sender ports and receiver ports, optio- nal ports as equivalents to AUTOSAR ports AUTOSAR software components are modeled by means of the additional AUTOSAR blocks. 40 2007
  • 41. TargetLink Modeling with the AUTOSAR Blocks Model-Based The AUTOSAR library offers the blocks needed To define how data is exchanged between the Design Process with for designing and specifying AUTOSAR-compliant runnables of one or more SW-Cs, runnable inports the TargetLink models. To define an executable unit, the and outports have to be inserted, similar to the AUTOSAR Module Runnable block is applied to a modeled sub- TargetLink inports and outports in non-AUTOSAR system, in a similar way to TargetLink function applications. TargetLink supports sender-receiver blocks. This can be done either for new models and synchronized client-server communication. designed from scratch or for legacy models with Property specifications are made both on block established control functions. level and via the dSPACE Data Dictionary. A runnable is defined by the runnable block in conjunction with runnable inports and outports. SWC ReceiverPort Referencing AUTOSAR properties specified in the dSPACE Data Dictionary from AUTOSAR block dialogs. 41 2007
  • 42. Production Code Generation Software Model-Based Code Generation Design Process with TargetLink generates production code for and runnable inports and outports are imple- the TargetLink AUTOSAR software components and provides mented as Runtime Environment (RTE) macros AUTOSAR Module all the code generation options for optimization. according to the AUTOSAR standard. Modeled runnables are converted to C functions The generated C code for a runnable with three included RTE macro calls. Simulation With TargetLink, SW-Cs can be simulated in all Multiple SW-Cs can be simulated in one simu- three simulation modes: lation run. Communication between SW-Cs is  Model-in-the-loop (MIL) simulated to the extent supported by the Simulink  Software-in-the-loop (SIL) design environment; for example, there is no  Processor-in-the-loop (PIL) asynchronous client-server communication. Top hierarchy of a model for simulating runnables and entire components. Runnables are included in the TargetLink controller subsystem and activated by events emitted from the Stateflow chart called Chart. 42 2007
  • 43. TargetLink Software Component Descriptions Model-Based To integrate the code generated for SW-Cs in the creation of component descriptions and exports Design Process with overall AUTOSAR software architecture, software the descriptions in XML format. the TargetLink component description files are required. They The dSPACE Data Dictionary also supports the AUTOSAR Module describe which structural elements such as run- import of existing component descriptions and nables or ports are used in an SW-C. TargetLink provides the structural elements they contain for relieves function designers of tedious manual further modeling. At a click, the dSPACE Data Dictionary exports AUTOSAR software component description files in XML format. 43 2007
  • 44. Production Code Generation Software Managing Data with the dSPACE Data Dictionary Central Data Container Key Features  Central container for managing ECU data  Full access to code specifics  Convenient administration of variables,  Various import and export formats scaling formulas, typedefs, etc.  Full access to all dSPACE Data Dictionary  Tight integration with TargetLink objects via powerful MATLAB API Description The dSPACE Data Dictionary is a unique data properties, and you can specify structured data container that centrally holds the relevant in- types and use them for variable declarations. formation about an ECU application for code Scaling formulas can be entered and used to generation or calibration. Data dictionary objects uniformly scale fixed-point signals and param- can be referenced from TargetLink models, in- eters in the model. You can import and export dependently of any model partitioning. You can standardized or proprietary data and share the define and manage variables and corresponding data with the calibration system. Benefits The dSPACE Data Dictionary is the perfect tool for is well structured in a hierarchical tree and can defining and handling project-related code spe- also be accessed via an application programming cifics, even for workgroups. It provides access to interface (API). It also supports common import a wealth of additional information, for example, and export formats, which means that existing specifics on C modules, function calls, tasks, vari- and proven definitions, for example, an existing able classes, data variants and so forth. The data calibration file, can be used as templates. ������������ ��������������� ��� ������� ��� ����� ���������� ������������ ������������ ��� ����� The data and the model are systematically separated. 44 2007
  • 45. TargetLink Data Structure The dSPACE Data Dictionary has specific main objects, loading and saving individual data areas where you can set the configuration data, branches and searching the complete dictionary. the pool data for models (pre-code generation Selected branches of the Data Dictionary can be data), and the subsystem and application data loaded from separate include files, which are (post-code generation data). Typical user interface maintained centrally for a whole workgroup. functions are available, like copying and pasting Data Dictionary Manager with Treeview, Object Explorer, Property Value, and Model Browser Window. Import and Export Data Dictionary API Share Data The dSPACE Data Dictionary supports various The dSPACE Data Dictionary MATLAB API gives import/export formats, including you full access to the dSPACE Data Dictionary via  XML (Extensible Markup Language) MATLAB. All the functions necessary for manag-  OIL (OSEK Implementation Language) ing data are available, for example, for creat-  ASAM-MCD 2MC (Standardized ing Data Dictionary objects and defining their Description Data, formerly ASAP2) properties. With open API interfaces, you can  Variables and Simulink data objects from/to easily integrate the dSPACE Data Dictionary into MATLAB workspace and files company-specific environments. To connect your own database to the Data Dictionary, you can develop your own export or import functionality. Prepare for Calibration Order Number After code generation, TargetLink writes a de- dSPACE Data Dictionary tailed description of the resulting C code to (for separate use without TargetLink Base Suite) the dSPACE Data Dictionary, including lists of  DSDD_MANAGER generated C modules, functions, variables, type definitions, scalings, variable classes, etc. This information is a great help later when you export data for the calibration of ECU parameters. 45 2007
  • 46. Production Code Generation Software EmbeddedValidator™ Simulink/Stateflow verification environment Key Features  Automatic Simulink®/Stateflow® and  Support of Simulink subsystems TargetLink model validation with a large set of open-loop control blocks (Simulink/TargetLink)  Operates on TargetLink generated code  Powerful verification support by complete and bounded engines  Full support of Stateflow charts  Pattern-based requirements specification Description Application Area Benefits EmbeddedValidator™ checks models for specified Model checking analyzes a system with regard to functional properties. It gives function developers arbitrary input scenarios and can thus be viewed clear information on whether any model meets as a “complete test” that is performed against the functional specifications under all conditions. a formally specified requirement. Such require- EmbeddedValidator provides a tool suite for for- ments may be simple Boolean expressions such mal, automatic, and model-based verification. as “an error state is never reached”, or more so- It performs model checking for reactive embed- phisticated ones expressing temporal and causal ded systems designed using Simulink, Stateflow, properties like “an output is set only after and TargetLink. The tool suite supports Stateflow certain input values are observed”. This technology charts and a large set of Simulink and TargetLink results in designs that meet tough requirements blocks for open-loop control. In contrast to con- regarding robustness and correctness, decreases ventional testing approaches, the model checking design faults and costs. technology is fully automatic and complete in a mathematical sense, meaning that it can detect every logical design flaw and error in the model being validated. Risk Identification Early Model and Code Verification Open-loop control systems usually have deep The combination of EmbeddedValidator and dependencies that designers cannot cover com- TargetLink allows early testing and verification. pletely. Complexity has increased enormously, Applying EmbeddedValidator‘s model checking as has time-to-market pressure, and as a method in early development phases not only consequence the error rate is also rising. Today’s validates models, it is also a step towards pro- embedded control units have such enormous duction code verification. TargetLink builds the functionality that designers and testers cannot bridge between verified models and verified ensure correct functioning under all environ- controllers as it is the only code generator that mental conditions by means of conventional is officially proven for formal verification with testing methods. EmbeddedValidator. 46 2007
  • 47. TargetLink Main Features Feature Description Range Violation Analysis  Dynamic checks for range violations, i.e., whether there is a run in which an overflow or underflow for a certain variable occurs. Drive to State  Using the Drive-to-State analysis, you can select one, several, or all the states of a Stateflow chart and perform the reachability check on them in one verification task. Drive to Configuration  Analyses of whether two or more states in different parallel subcharts are reachable at the same point in time. Drive to Property  Abstract check that constructively tries to reach a state of the system where a certain property holds. Requirement Certification  Providing a correctness assertion, i.e., a safety requirement has to be proven for a Simulink/Stateflow design. Failure Analysis Support  For a quick view of the analysis result, EmbeddedValidator provides a waveform diagram view of all the observables of a design. It also generates an M script for simulation purposes. Report Generation  Detailed application reports contain all the information on the profile, for example, defined analyses and defined proofs. Formats: HTML, TXT Order Information1) Order Number OSC - Embedded Systems AG, Industriestr. 11, D-26121 Oldenburg, Germany – Tel.: +49 4 41 3 50 42-3 30, Fax: +49 4 41 3 50 42-3 64 info@osc-es.de, www.osc-es.de 1) For information regarding system requirements and compatible MATLAB and TargetLink versions, please contact OSC Embedded Systems AG directly. 47 2007
  • 48.  Copyright 2007 by dSPACE GmbH. All rights reserved. Written permission is required for reproduction of all or parts of this publication. The source must be stated in any such reproduction. dSPACE is continually improving its products and reserves the right to alter the specifications of the products contained within this publication at any time without notice. Brand names or product names are trademarks or registered trademarks of their respective companies or organizations. Headquarters in Germany USA and Canada France dSPACE GmbH dSPACE Inc. dSPACE Sarl Technologiepark 25 28700 Cabot Drive Parc Burospace . Bâtiment 20 33100 Paderborn Suite 1100 Route de la Plaine de Gisy Tel.: +49 52 51 16 38-0 Novi . MI 48377 91573 Bièvres Cedex Fax: +49 52 51 6 65 29 Tel.: +1 248 567 1300 Tel.: +33 1 6935 5060 info@dspace.de Fax: +1 248 567 0130 Fax: +33 1 6935 5061 info@dspaceinc.com info@dspace.fr Japan United Kingdom dSPACE Japan K.K. dSPACE Ltd. West Tower 9F Unit B7 . Beech House Yokohama Business Park Melbourn Science Park 134 Godo-cho . Hodogaya-ku Melbourn Yokohama-shi Hertfordshire Kanagawa-ken 240-0005 SG8 6HB Tel.: +81 45 338 3361 Tel.: +44 1763 269 020 Fax: +81 45 338 3362 Fax: +44 1763 269 021 info@dspace.jp info@dspace.ltd.uk dSPACE www.dspace.com 01/2007