DesignWare(R) ARC(R) Emulation (nsim)

Overview

This board configuration can be used to run ARC EM / ARC HS based images in simulation with Designware ARC nSIM or run same images on FPGA based HW platform HAPS. The board includes the following features:

  • ARC EM or ARC HS processor

  • ARC internal timer

  • a virtual console (ns16550 based UART model)

There are four supported board sub-configurations:

  • nsim_em which includes normal ARC EM features and ARC MPUv2

  • nsim_em_em7d_v22 which includes normal ARC EM features and ARC MPUv2, specially with one register bank and fast irq

  • nsim_sem which includes secure ARC EM features and ARC MPUv3

  • nsim_hs which includes base ARC HS features, i.e. w/o PMU and MMU

  • nsim_hs_smp which includes base ARC HS features in multi-core cluster, still w/o PMU and MMU

For detailed arc features, please refer to boards/arc/nsim/support/nsim_em.props, boards/arc/nsim/support/nsim_em7d_v22.props, boards/arc/nsim/support/nsim_sem.props, boards/arc/nsim/support/nsim_hs.props and boards/arc/nsim/support/mdb_hs_smp.args

Hardware

Supported Features

The following hardware features are supported:

Interface

Controller

EM

SEM

HS

Driver/Component

INT

on-chip

Y

Y

Y

interrupt_controller

UART

ns16550

Y

Y

Y

serial port

TIMER

on-chip

Y

Y

Y

system clock

Programming and Debugging

Required Hardware and Software

To run single-core Zephyr RTOS applications in simulation on this board, Designware ARC nSIM or Designware ARC nSIM Lite is required.

To run multi-core Zephyr RTOS applications in simulation on this board, Designware ARC nSIM and MetaWare Debugger from ARC MWDT are required.

To run Zephyr RTOS applications on FPGA-based HAPS platform, MetaWare Debugger from ARC MWDT is required.

Building Sample Applications

Use this configuration to run basic Zephyr applications and kernel tests in nSIM, for example, with the Synchronization Sample:

# From the root of the zephyr repository
west build -b nsim_em samples/synchronization
west flash

This will build an image with the synchronization sample app, boot it using nsim, and display the following console output:

***** BOOTING ZEPHYR OS v1.12 - BUILD: July 6 2018 15:17:26 *****
threadA: Hello World from arc!
threadB: Hello World from arc!
threadA: Hello World from arc!
threadB: Hello World from arc!

Note

To exit the simulator, use Ctrl+], then Ctrl+c

Use this configuration to run same application on HAPS platform:

# From the root of the zephyr repository
west build -b nsim_em samples/synchronization
west flash
west build -t --runner
west build -t mdb-hw

Debugging

Note

The normal make debug command won’t work for debugging applications using nsim because both the nsim simulator and the gdb debugger use the console for output. You need to use separate terminal windows for each tool to avoid intermixing their output.

After building your application, cd to the build folder and open two terminal windows. In terminal one, use nsim to start a GDB server and wait for a remote connection:

# for ninja build system:
ninja debugserver
# for make build system:
make debugserver

In terminal two, connect to the GDB server using arc-elf32-gdb. This command loads the symbol table from the elf binary file, for example the ./zephyr/zephyr.elf file:

..../path/to/arc-elf32-gdb zephyr/zephyr.elf
(gdb) target remote : 3333
(gdb) load

Now the debug environment has been set up, you can debug the application with gdb commands.

References