Jakob Engblom - Workshop Simics

  • View
    215

  • Download
    0

Embed Size (px)

Text of Jakob Engblom - Workshop Simics

  • 8/9/2019 Jakob Engblom - Workshop Simics

    1/100

    Workshops

    Hands-on With Virtutech Simics Jakob Engblom

  • 8/9/2019 Jakob Engblom - Workshop Simics

    2/100

    Welcome

  • 8/9/2019 Jakob Engblom - Workshop Simics

    3/100

    3

    What will we do today?

    • A hands-on look at Virtutech Simics

    • Compile, download, and execute programs – For cross-targets running (embedded) Linux

    – Single virtual development board

    – Network of virtual machines

    • Inspect and debug functionality

    • Running code on a machine with no OS – Extend the model with a new hardware device

    – Test a simple device driver

  • 8/9/2019 Jakob Engblom - Workshop Simics

    4/100

    4

    Network

    Server 

    Simics is a Systems Simulator

    IP Phone

    PC

    Phone

    Internet

  • 8/9/2019 Jakob Engblom - Workshop Simics

    5/100

    5

    Simics

    Simics/Phone Simics/Phone

    Simics

    Sim Network

    Simics

    Simics/Server 

    Simics is a Systems Simulator

    Simics

    IP Simics

    Simics/IP Phone

    Simics

    Simics/PC

    Simics/Phone

  • 8/9/2019 Jakob Engblom - Workshop Simics

    6/100

    6

    Simics

    Simics/Phone Simics/Phone

    Simics

    Sim Network

    Simics

    Simics/Server 

    Simics is a Systems Simulator

    Simics

    IP Simics

    Simics/IP Phone

    Simics

    Simics/PC

    Simics/Phone Hardware model

    RTOS

     Applications

    HW Model

    RTOS

     Apps

    Behavioral simulation of

    function

  • 8/9/2019 Jakob Engblom - Workshop Simics

    7/100

    7

     Traditional Development Process

    • Use hardware to test and debug software

    – Expensive

    – Unwieldy environment for debugging – Not available early enough

    – Often, not every developer can have a test bed

  • 8/9/2019 Jakob Engblom - Workshop Simics

    8/100

    8

    Virtutech Simics • Virtualized Software Development

    – Simulates the system under development and its immediate environment

    – Runs entire software image unchanged – Model peripheral devices

    • Benefits of software overhardware – Customizable

    – Cheaper

    – Programmer-friendly – Scriptable & controllable

    – Available earlier

  • 8/9/2019 Jakob Engblom - Workshop Simics

    9/100

    9 Hardware

    Virtualized Software Development

    CPU

    Operating system

    User program

    RAM

    FLASH

    MiddlewareDBServer 

    Complete

    production software

    LCD

     ASICROM

    PCI

    I2C

    Bus

    CPU

    Drivers Firmware

    The software can’t

    tell the difference

    Network net

    Identical build

    tools chain

    Disk Simulated

    hardware

    Runs binaries

    from real target

    Disk Ctrl

  • 8/9/2019 Jakob Engblom - Workshop Simics

    10/100

    10

    Complete Virtualization

    Host hardwareHost hardware

    Host operating systemHost operating system

    SimicsSimics

    Simulated target hardware

    Target operating system

    User program

    PC (32- & 64-bit) or Sparc

    PC (32- & 64-bit)

    or Sparc

    Linux, Solaris, Windows

    Linux, Solaris,

    Windows

     Arbitrary; currently supports  Alpha, ARM, IA64, 32/64 bit

    x86, 32/64 bit Sparc,32/64 bit MIPS, 32/64 bit PowerPC, TI C6400, msp430

     Arbitrary; currently supports  Alpha, ARM, IA64, 32/64 bit

    x86, 32/64 bit Sparc, 32/64 bit MIPS, 32/64 bit

    PowerPC, TI C6400, msp430

     All software: arbitrary &

    unmodified. Same as on a

    real system.

     All software: arbitrary & unmodified. Same as on a

    real system.

  • 8/9/2019 Jakob Engblom - Workshop Simics

    11/100

    Getting Started

  • 8/9/2019 Jakob Engblom - Workshop Simics

    12/100

    12

    Getting Started: VmWare Player

    • Start VmWare player

    • Select the ”simics-on-linux.vmx” file

  • 8/9/2019 Jakob Engblom - Workshop Simics

    13/100

    13

    Getting Started: Boot

    • When the virtual computer starts

    • It will boot into grub• Press ”return” to boot the Linux we need

  • 8/9/2019 Jakob Engblom - Workshop Simics

    14/100

    14

    Getting Started: Login

    • At login prompt:

    – User “user” – Password “user”

    • Or wait to be

    automatically logged-in as “user”

  • 8/9/2019 Jakob Engblom - Workshop Simics

    15/100

    15

    Getting Started: Terminal

    • When the Linux has

    booted, you will be atthe desktop with no windows open

    • Click the “terminal” to get a text console

  • 8/9/2019 Jakob Engblom - Workshop Simics

    16/100

    16

    Getting Started: More Terminals

    • I find it convenient with two terminals

    – Or even better, two tabs in the terminal

  • 8/9/2019 Jakob Engblom - Workshop Simics

    17/100

    17

    Getting Started: Simics Docs

    • Simics has HTML, PDF,

    and online help • To access HTML & PDF,

    open the ”Simics

    documentation” folder on the desktop

    • User guide is linked directly as well

  • 8/9/2019 Jakob Engblom - Workshop Simics

    18/100

  • 8/9/2019 Jakob Engblom - Workshop Simics

    19/100

    19

    Starting Simics

    • On Linux, Simics is a command-line app

    • Simics exposes a sophisticated command- line interface

    – And graphical or text windows for the displaysand serial ports of the target systems

    • Simics uses a workspace directory:

    – /home/user/simics-workspace in this case

  • 8/9/2019 Jakob Engblom - Workshop Simics

    20/100

    20

    Starting Simics

    • Linux command-line

    – Will be prefixed “host$” in the following slides – What you type is going to be bold

    • So we do the following:host$ cd simics-workspace host$ ./simics target/ebony/ebony-linux-firststeps.simics

  • 8/9/2019 Jakob Engblom - Workshop Simics

    21/100

    21

    Starting Simics Linux commandsto start Simics

    Simics prompt,

    also called the

    Simics console

    Target console,

    output from

    target machineappears here

  • 8/9/2019 Jakob Engblom - Workshop Simics

    22/100

    22

    Starting Simics: target & host

    Host hardwareHost: PC

    Host operating systemHost OS: Linux

    SimicsSimics

    PowerPC 440

    SimicsSimics

    consoleconsole

    Linux

    ProgramsComplete and un- modified

    TargetTarget

    consoleconsole

  • 8/9/2019 Jakob Engblom - Workshop Simics

    23/100

    23

    Simics Workspaces

    • Based on the eclipse concept

    • Provides a base location for:– checkpoints – machine configuration files – locally built simics modules – scripts

    • Keeps user data

    • Simics installation separate from workspace– (here: /opt/virtutech/simics-3.0.22/) • Multiple workspaces & Simics installations

    can coexist on a system

  • 8/9/2019 Jakob Engblom - Workshop Simics

    24/100

  • 8/9/2019 Jakob Engblom - Workshop Simics

    25/100

    25

    Boot the Target

    • Simics command-line

    – Prefixed “simics>” in the following • To run 2 billion cycles for the boot:

    simics> c 2_000_000_000 • To stop simulation at any point: ctrl-C

    • To run simulation until stopped:simics> c

  • 8/9/2019 Jakob Engblom - Workshop Simics

    26/100

    26

    Inspect Target State from Simics

    • Some Simics

    commands:simics> ptime simics> pregs

    simics> pregs –all simics> da count=10

    simics> x %r1

    simics> help simics> si

  • 8/9/2019 Jakob Engblom - Workshop Simics

    27/100

    27

    Inspect Target State from Simics

    • Simics logs all device accesses

    – simics> uart0.log • Devices present their state

    – simics> uart0.status – simics> emac0.status

    – simics> emac0.info

  • 8/9/2019 Jakob Engblom - Workshop Simics

    28/100

    28

     Test the Target Machine

    • Commands on the target machine CLI:

    – Prefixed “$” in the following • Make Simics run, then use target console:

    simics> c $ pwd

    $ uname –a

    $ cat /proc/cpuinfo

    $ ifconfig

  • 8/9/2019 Jakob Engblom - Workshop Simics

    29/100

    Compile & Load

    a User Program

  • 8/9/2019 Jakob Engblom - Workshop Simics

    30/100

    30

    Create and Load a User Program

    • Stop Simics in the meanwhile

    • Use the second terminal