MIPSsim

From LinuxMIPS
Revision as of 09:22, 17 August 2012 by Ralf (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This article is a stub. You can help by expanding it

MIPSsim support is deprecated and scheduled for removal in late 2012 (for the 3.7 release)


MIPSsim is a proprietary software emulator product of MIPS Technologies. It emulates a fairly simple system with two 8250-class UARTs and a simple network controller. MIPSsim consists of several simulators that differ in performance, degree of details and debugging features. One for example maintains every bit in the system as having three states: 0, 1 and uninitialized. It's cycle accurate simulator may be slow but allows accurate predictors of performance.

Introduction

One of the difficulties of a SoC designer is to evaluate the impact of the SoC architecture and its configuration on the final system. When the final system includes the Linux Kernel, the MIPSsim simulator can be the good candidate to solve the problem.

Analyzing the traces of several simulations its possible to (in)validate an architecture and to configure the SoC to obtain the best system performances. And in the case of the cache configuration, the impact of this analysis can be very important due to the cost of the cache ram.

This page intends to explain briefly how to quickly run a Linux kernel on MIPSsim configured to simulate a 4KSd where throughout this document the 4KSd should be considered a placeholder for another core made by MIPS Technologies.

This document has been validated on the following platform:

  • Ubuntu 7.10/8.04
  • Redhat Enterprise 5
  • Fedora 8

Support status

MIPSsim is supported by a stock Linux/MIPS kernel since several years. MIPSsim is a proprietary product that is not available to the general public. However Qemu supports a MIPSsim target as well. That said, MIPSsim is an extremly simple platform and virtually everybody is better served by the other targets supported by Qemu and the Linux in general. At the same time it also appears MIPS Techologies has been shifting away from MIPSsim for a while and as such MIPSsim support in the kernel is considered obsolete and will eventually be removed probably whenever its continued support is getting in the way of more useful work.

Configuration

Configuration of the different components.

Kernel Configuration

To configure the kernel, the best way is to use the MIPSsim default configuration and to modify it:

make mipssim_defconfig

Using menuconfig/xconfig you must choose the endianess correpsponding to the core configuration.

Excepted that, there is no other mandatory modification.

This configuration uses the virtual UART, you must not modify the section "Serial Drivers" excepted if you want integrated your own virtual UART.

MIPSsim Configuration

In order to allow the kernel to calibrate the delay you need to enable interruption from the internal timer. In the configuration file you must have this line:

set TIMER_INT_ENABLE 1

The second part of the MIPSsim configuration is the configuration of the Device Manager. This one is in charge to simulate hardware devices. MIPSsim is provided with some virtual devices. In order to run the Linux kernel on MIPsim you have to enable a RAM, an UART (to get the console) and a RTC. The default configuration of those last devices are those you have to use.

Your device configuration files should look like:

MemIntf(EB, SparseMemRam, 0, 0x0, 64M, MIPS_SparseMemRam)
MemIntf(EB, RTC, 2, 0x1fd00070, 0x00000002, MIPS_Rtc)
MemIntf(EB, UART, 3, 0x1fd003f8, 0x00000008, MIPS_Uart)
SparseMemRam(0,,,0,0,0,0,0)
RTC(2,,0,0,1)
UART(3,UNBUFFERED,0,0,1)

An important point here is the delay you can add to the SparseMemRam accesses modifying the last number of the line:

 SparseMemRam(0,,,0,0,0,0,0)

GDB Script

The GDB script must set the configuration file, the MIPSsim library and the target MIPS core. By example for a 4KSd the gdb script can look like this:

set mdi library libMIPSsim_MDIc.so
set mdi configfile 4KSd.cfg
set mdi target 19
set mdi device 01
target mdi
load
run

Run the Simulation

First make the kernel:

make CROSS_COMPILE=mipsel-linux-

Set environment variables depending on your configuration:

export LM_LICENSE_FILE=@license-server
export LD_LIBRARY_PATH=/path/to/MIPSsim/libraries

Then run the simulation:

sde-gdb -x gdbinit vmlinux