Cavium Networks Octeon Simulator

Cavium Networks provides a Linux program that emulates the different CPU/SoCs that they produce. This is available with their SDK. This post outlines a few notes that I have on how to run this on FreeBSD for people that are interested. You'll need to get the simulator from Cavium Networks in order to follow these instructions. If you buy their evaluation boards, you'll get the SDK which includes the simulator. There was some talk of including this in their public releases, but I haven't see that yet.

Installing the SDK

Cavium provides the SDK as a series of RPMs to be added to the system. The first step is to install the linux emulator from ports/packages. I've had good luck with Fedora Core 4 (in /usr/ports/emulators/linux_base-fc-4). I'm told others have used the Fedora Core 6 package, but I've not tested that to see how well that works.

One can install the SDK in one of two ways. One is to just use rpm:

rpm --install /cdrom/OCTEON-SDK-1.7.2-244.i386.rpm

This works well if you want to install the package into the normal places. I've done this exactly once, and then removed it shortly there after due to disk space issues, so I don't know how well it works. The advantage of this is that it also brings in all the dependencies.

One can also play 'fast and loose' and just extract the files:

rpm2cpio /cdrom/OCTEON-SDK-1.7.2-244.i386.rpm | tar xvf -

in the directory you want to install it into. I've used this on a number of different systems, and it has worked well for me.

Setup

Regardless of which approach you take, you need to setup your environment:

pushd /where/it/lives/Cavium-Networks/OCTEON-SDK
source env-setup OCTEON_CN38XX
popd

Running

There's a bunch of command line parameters to the simulator. However, I usually run it like so:

oct-sim kernel.octeon -server=12344 -uart0=12345 -noperf -numcores=1 -envfile=u-boot-env -memsize=384 -quiet

The u-boot-env file looks like:

bootcmd=bootelf 0x1000000

The kernel is loaded into memory at 0x1000000 in the simulator, and then u-boot copies it to its actual load address and starts the exectuion.

The kernel currently clips memory to 96MB in the simulator, not sure why it doesn't get the actual memory from the u-boot parameters. Most likely something is busted there.

The simulator gives an instruction count every so often so you know it is doing things. If you are seeing a crash, you can say -quiet=<some-number> and it will trace the first some-number of instructions quietly, and then start printing verbose information about the CPU that's running. This will usually pinpoint the exact instruction that goes astray. I usually run everything in a typescript so I don't lose any data...

You can change the model by setting OCTEON_MODEL in your environment at any time:

setenv OCTEON_MODEL OCTEON_CN38XX_PASS3
setenv OCTEON_MODEL OCTEON_CN36XX_PASS3
setenv OCTEON_MODEL OCTEON_CN31XX_PASS1_1
setenv OCTEON_MODEL OCTEON_CN3005_PASS1_1
setenv OCTEON_MODEL OCTEON_CN3010_PASS1_1
setenv OCTEON_MODEL OCTEON_CN3020_PASS1_1
setenv OCTEON_MODEL OCTEON_CN58XX_PASS1
setenv OCTEON_MODEL OCTEON_CN56XX_PASS1

FreeBSD/mips/OcteonSim (last edited 2008-12-05 07:41:31 by WarnerLosh)