Simulating Embedded Hardware for Software Development Class 410 Jakob Engblom, PhD Virtutech jakob@virtutech.com 1
Scope & Context of This Talk � Supporting embedded software development � Using simulation of computer systems – On computers (obviously) � It is not about – Simulating computer hardware to design it (primarily) – Chip design – Mechanical system simulation and design 2
3 Why?
Because Hardware Is... Not yet available Flaky prototype stage Not available anymore ? Photo: Freescale Photo: Computer History Museum 4
Because Hardware Is... Inconvenient Dangerous Inaccessible Photo: www.mil.se, Bromma Conquip Photo: ESA 5
6 Inflexible Because Hardware Is... Limited Impractical in scale
Simulation Advantages � “Just software” � Inspectability � Availability – Any variable or property can be observed, even if hidden in – Easy to copy & distribute the real world – Requires no special lab � Controllability – Good for global reach – Any variable or property can – Available before hardware is be changed completed – Controlled experiments, not � Flexibility real-world random – Engineering computer can be � Configurability “any” system – Easy to change configuration – Fewer fixed lab setups and create new configurations � Easy to vary parameters 7
Example: Early Hardware First successful First successful power-on and boot power-on and boot Hardware/Software Hardware design and production Integration and Test Hardware-dependent software development Hardware design and production Reduced project Reduced project time-to-ship using time-to-ship using Simulator simulated hardware simulated hardware development Hardware/Software Integration and Test Hardware-dependent software development 8
...but the simulated target ...but the simulated target Example: Late Hardware hardware stays the same hardware stays the same Allowing continuous use and Allowing continuous use and evolution of the same evolution of the same software stack software stack Applications Applications Applications Target OS Target OS Target OS PPC 750fx Card PPC 750fx Card PPC 750fx Card Sim for Linux/x86-64 Simics Sim for X/Y Simics Sim for Win/x86 Simics Host operating system Linux Host operating system Y OS Host operating system Windows Yesterday: 32-bit PC Host hardware Today: 64-bit PC Host hardware Future: X Hardware Host hardware The host machines available The host machines available change over time... Time change over time... 9
Example: Loading Flash Convenient bin bin FLASH Flash Programmer Simics Simulator Simics Much shorter turn-around time for changing target software setup No risk of “bricking” a target 10
11 Technology
Embedded Computer System Software stack Applications Middleware, libraries Networks Operating system BootROM, drivers, HAL Human user Controlled interface Environment 12
Embedded Computer System Software stack Applications Middleware, libraries Networks Operating system BootROM, drivers, HAL Human user Controlled interface Simulating the board(s) and Simulating the board(s) and Environment running their software is the running their software is the focus of this presentation focus of this presentation 13
14 User Interface Simulation Short overview
User Interface Simulation � A category of tools of its own � Many different levels: � Part of many other simulation – Virtual screen & mouse tools – Clickable touch screens – Clickable button panels – Graphics displays – Serial console – Real panels connected to PC � Target software representation: – Simulated by scripts – Special code for special API – Actual target code in some form of other simulator 15
16 Environment Simulation Short overview
Environment Simulation � Large field for powerful � Everybody is using it, CAD commercial tools has been doing mechanical simulations for 50 years – MatLab/Simulink � Commonly used for control – LabView/Matrixx algorithm development – MSC software � Key part of the model-driven – .. and many more ... � In-house models common architecture/model-driven design paradigm � Interface to board simulation: – AD, DA converters – Digital inputs & outputs 17
18 Network Simulation In a little more depth
Network Simulation Variants � Connections between � Virtual packet-level network abstracted nodes, to study links between simulated nodes communication patterns – No protocol understanding – Contains models of node – Nodes run network stacks behavior, no actual code � Connect physical and � “Rest of network simulation” to simulated nodes provide the environment for a – Virtual machines visible on single node physical network – Generates “real” traffic � Network types: – Implements actual protocols – Ethernet, AFDX, CAN, LIN, – Bidirectional reactive traffic FlexRay, MOST, PCIe, I2C, � Dumb traffic generation LonWorks, ARINC 429, MIL- STD-1553, Serial, RapidIO, – Generate traffic from rules VME, SpaceWire, USB, – Unidirectional FireWire, ... 19
Network Simulation Levels High-level application actions Load software, configure node, restart FTP, DHCP, SS7, CANopen Application protocol TCP/IP etc. Network protocol Hardware/software Hardware/software boundary boundary Ethernet packets with MAC address, CAN packets, Packet transmission serial characters, VME data read/write Clocked zeros and ones, CAN with Bit stream contention, Ethernet with CSMA model Physical signaling Analog signals, bit errors, radio modeling 20
Network Simulation Levels High-level application actions Load software, configure node, restart FTP, DHCP, SS7, CANopen Application protocol TCP/IP etc. Network protocol Hardware/software Hardware/software boundary boundary Ethernet packets with MAC address, CAN packets, Packet transmission serial characters, VME data read/write Clocked zeros and ones, CAN with Bit stream contention, Ethernet with CSMA model Physical signaling Analog signals, bit errors, radio modeling Levels of main interest for Levels of main interest for embedded software work embedded software work on simulators on simulators 21
Example: Rest-of-Network Rest-of-network simulation solution for telecom networks. UMTS, GSM, POTS. All protocols and all nodes types. 400 employees to develop and maintain. Source: Nethawk Marketing Materials 22
23 Something you can actually run code on Simulating a Board Part I: Technology background
Cardinal Rule of Simulation Scope of modeled system Universe Galaxy Reasonable to Reasonable to simulate: scope simulate: scope proportional proportional to abstraction to abstraction Atom Units of the simulation Quarks Planets Galaxies 24
Computer Simulation Use Cases � System-on-Chip Design � Software Development – Hardware designer needs – Execute large workloads – Architecture exploration – Debug code – Sizing, performance, optimization – Get the system to work of hardware – (Optimize the software) � Fidelity to target is primary driver � Speed of execution is the primary for models driver for model – Bus structure – Abstract as far as possible – Bus protocols and arbitration – Approximate timing � The system processor or – Timing – Bandwidth processors key driver – Latency – Clear difference between processors and other devices – Cycles � Our focus today � All components are equals 25
For embedded For embedded software work, FSS software work, FSS and API-level sim and API-level sim are really the best are really the best Simulation/Virtualization Tech options options Desktop/Server Para- API-Level Full-system Emulation ISS Virtualization virtualization Simulation simulation Scope of exec System System Application Processor Application System CPU A on A Yes Yes Yes Yes Yes Yes CPU B on A No No Yes Yes No Yes Run full OS Yes Yes No No No Yes OS A on A Yes Yes Yes N/A Yes Yes OS B on A Yes Yes No N/A Yes Yes Run unmodified Yes No No No No Yes software stack Custom devices No No No No No Yes & drivers Deterministic No No No Yes No Yes Complexity Medium Low High Medium Low High VmWare, Example Xen Rosetta gdb ISS VxSim Simics LPAR, kvm 26
Full System vs API-Level “Java is java”: simulate “Java is java”: simulate using some common using some common middleware/API set middleware/API set User program Classic OS API simulation: Classic OS API simulation: compile to PC host, use compile to PC host, use Java VM DB Middleware special implementation of special implementation of OS API OS API Operating system Low-level API-level Low-level API-level simulation: special device simulation: special device Hardware Drivers Boot firmware drivers and HAL for PC drivers and HAL for PC abstraction layer simulation, compile to host simulation, compile to host including the kernel including the kernel “Full-system simulation”: “Full-system simulation”: simulate the simulate the hardware/software interface, hardware/software interface, unmodified software stack unmodified software stack from target compilation from target compilation 27
Recommend
More recommend