Targetlink Presentation


Published on

Target Link Related Information

Published in: Automotive, Technology, Business
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Targetlink Presentation

  1. 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. 2. Target Implementation 2 2007 2006
  3. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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