Main Content

Map Embedded System Architecture to Simulink Modeling Environment

Map elements of your embedded system architecture to elements of the Simulink® modeling environment. Consider these aspects of the model design.

Modeling AlgorithmsGiven initial state and input, a set of tasks or instructions that efficiently produce the results that you want.
Modeling InterfacesMechanisms that enable algorithm components to communicate and exchange information across component boundaries.
Modeling SystemsCollection of algorithm components that achieve a higher-level, domain-specific goal or result. Components often share resources.
Modeling Target Platform EnvironmentsFramework that handles scheduling of system algorithm resources and execution.

The following sections map questions to consider regarding an embedded system architecture to corresponding modeling capabilities and links to related information. Use the information as a guide for mapping your architecture details to the Simulink modeling environment. Designing a model architecture with your specific embedded system architecture in mind can help you avoid rework and future conversion and maintenance costs.

Modeling Algorithms

Architecture ConsiderationsModeling ConsiderationsRelated Information
What is the system domain?Product prerequisites (based on domains of components)
Does the system involve physical domains, such as mechanical, electrical, or hydraulic domains?Physical systems
What aspects of your algorithm can you represent with blocks provided by MathWorks® products? What blocks do you need to create?Block usage, creation, and customization
Do you want to import existing external MATLAB®, C, or C++ code into a model for inclusion in your generated code?External code importExternal Code Import
Does the architecture include state machine components?Event-driven system

Model Finite State Machines by Using Stateflow Charts (Stateflow)

Do you want to apply modeling guidelines that are relevant to code generation intent? Do models and generated code need to comply with industry standards? Standards and modeling guidelinesStandards, Guidelines, and Block Usage
Is there a need to standardize code that the code generator produces from multiple models? Custom code definitions for data and functions

Modeling Interfaces

Architecture ConsiderationsModeling ConsiderationsRelated Information
  • What data must you represent in the generated code?

  • How do you need to represent input and output—data type, dimension, complexity?

  • Do the algorithms use floating-point or fixed-point arithmetic?

  • How will the data change?

Data representation
Where and how is data pulled into the system and pulled within the system?Input

Comparison of Signal Loading Techniques

  • Where and how is data pushed within the system and out of the system?

  • What external triggers are required?

Output
  • What functions do you need to define for each component?

  • What is the prototype for each entry-point function?

Functions and function calls
Can you benefit from setting up default code generation configurations for categories of data and functions?Data and function configuration
Do you need to export functions that are invoked by controlling logic that is outside the model?Function export
Does the system monitor signals or log data (for example, for calibration)?C API and ASAP2 data exchange interfaces
Do you need to replace code generated for functions or operators, for example, to optimize the code for specific hardware?Code replacement
Do you need to control the placement of data or functions in memory?Memory sections

Control Data and Function Placement in Memory by Inserting Pragmas

Is there a requirement for elaboration and future considerations?Elaboration and future considerations

Define Interfaces of Model Components

Modeling Systems

Architecture ConsiderationsModeling ConsiderationsRelated Information
  • What is the scope of the system? Controller? External environment or plant? Test harness?

  • How is the system partitioned into algorithm components (chunks of logic)?

  • Which components can you represent in Simulink?

  • Can you design components for reuse? What is the motivation for reuse (for example, division of labor or plug-n-play)?

Componentization
  • Do aspects of the system require unit testing?

  • Is a team of people collaborating on the project?

  • Do you need to protect intellectual property?

Model referencing
Are you modeling a client-server architecture?Simulink Function and Caller blocks
Is relevant legacy or custom code available that you can include in a component model?Code importExternal Code Import
Can you apply a reference architecture or reference components?Model and project templates
Do you need to export functions that are invoked by controlling logic that is outside a model?Export-function modelsExport-Function Models Overview
Is there a need to package the source code for a component as a shared object library to simplify distribution or sharing?Shared object libraries (dynamic link libraries)Package Generated Code as Shared Libraries
Can you reuse functions?Function reuse
  • Do components need to share access to global data?

  • Within the system, do state changes occur? In each case, how does the result get communicated?

  • Are there identifier (naming) issues to consider?

Shared data
Do you need to control placement of data or functions in memory?Memory sections

Control Data and Function Placement in Memory by Inserting Pragmas

Are you required to apply the AUTOSAR standard? If yes, what aspects of the architecture involve AUTOSAR?AUTOSARAUTOSAR Blockset
Does your system need to meet other standards or guidelines?Standards and guidelinesSupport for Standards and Guidelines

Modeling Target Platform Environments

Architecture ConsiderationsModeling ConsiderationsRelated Information
  • What level of control over platform interfacing does your application require?

  • How much of your system can you represent in a model?

Platform interfacing
Is the system decomposed into concurrent components to maximize parallelism? Which components?Concurrency

Multicore Processor Targets

  • Are components in the system driven by clocks?

  • What clock rates do system components use?

  • Do components use a single rate or multiple rates?

  • What are the priorities of system tasks and functions?

Clocks, clock, rates, and time-based scheduling
  • Are components in the system driven by events (interrupts)?

  • What are the priorities of system tasks and functions?

Event-based scheduling
Does the system need to handle initialization, reset, or terminate events during system startup or shutdown?Initialization, reset, termination
  • Is the system a single-tasking or multitasking system?

  • Are components required to execute in real time?

  • What are the execution order dependencies (sequencing) between components?

  • What are the time constraints for task and function execution?

Task execution
  • If you know the processing platform, what is it?

  • Will the system run on a single-core or multicore processor?

  • Is the system a distributed system?

  • Is the processing platform hybrid or heterogeneous?

  • Does the architecture employ symmetric or asymmetric multiprocessing? If asymmetric, how is the platform software partitioned across CPUs?

Processing platformsMulticore Processor Targets
  • Do you want to generate and run a standalone executable that does not require an external real-time kernel or operating system?

  • Is a real-time operation system (RTOS) required? If yes, what RTOS?

Kernel, operating system

For multicore scenarios, the code generator assumes that:

  • Target hardware includes two or more cores.

  • System initialization occurs on one core.

  • Services assign tasks to a core statically. Tasks do not switch between cores.

  • Tasks can communicate within and across cores during run time.

This figure illustrates these assumptions. The tasks in the figure represent instances of entry-point functions running in a multi-core target platform environment.

Code generator assumptions for multicore platform scenarios