SimBCM - A Full System Simulator of BCM1250

SimBCM User Manual

$Date: 2006-09-26$
By Zhou Ya Jin


1. Introduction 

SimBCM is an open source full system simulator based on simos. It simulates BCM1250, a dual-core MIPS64 SOC of BroadComm. The entire source code of SimBCM is distributed under GPL.
(Return to top)

2. Installing and running Linux in SimBCM

Currently, Linux kernel and L4 pistachio(nicta) can be run in SimBCM. 

2.1 Before installing SimBCM

SimBCM needs python to parse the configuration file. So before installing SimBCM, you must install python into your system. Also SimBCM needs gcc to build its source code. All the installing processes described by this document are tested under Debian Sarge. If you have any problem when installing SimBCM under other linux distribution, please send the error message with your system information (for example, which linux distribution are you using) to our maillist.
(Return to top)

2.2 Installing SimBCM

Firstly you need to download and unzip the source code of SimBCM. And then you should set the value of environment variable SIMOS_DIR to the directory of some libraries SimBCM needs. For example, if you put SimBCM to directory /home/test/SimBCM, you could use the following command to set the environment variable.

#export SIMOS_DIR=/home/test/SimBCM/src/simos_dir

Alternatively you could edit your .bashrc file in your home directory to avoid setting environment variable SIMOS_DIR every time you build SimBCM. In the following, we will use SIMOS_PATH to represent the path of SimBCM package.

#cd SIMOS_PATH /src

If everything goes well, it will generate an executable file simos in directory SIMOS_PATH/src/cpus/simos/SIMOS-X86/simos.Make a symbolic link to simos in directory SIMOS_PATH/run.

#cd SIMOS_PATH /run
#ln –s SIMOS_PATH/src/cpus/simos/SIMOS-X86/simos SIMOS_PATH/run/simos

(Return to top)

2.3 Installing MIPS64 tool-chain

BroadComm provides MIPS64 tool-chain for BCM1250 SOC. We use the version 2006a_344 sb1-elf toolchain. You can download it from here. After you downloading the tool-chain, unzip it and add the tool-chian binary path to environment variable PATH. In the following, we will use TOOLCHAIN_PATH to represent the path of tool-chain package.

#exportPATH=$PATH:TOOLCHAIN_PATH /opt/specifix/broadcom_2006a_344/i686-pc-linux-gnu/bin
(Return to top)

2.4 Building CFE(Common Firmware Environment)

The Broadcom Common Firmware Environment (CFE) is a collection of software modules for initialization and bootstrap of designs incorporating Broadcom MIPS64™ processors. CFE can be used early in the development of designs using Broadcom processors to do bringup, and later be used to bootstrap the OS in a production environment.

The version of cfe we use is 1.2.5. You can download the package from here, which is configured to be used in SimBCM. We assume that you unzip it to path CFE-PATH. Using the following commands to build cfe.

#cd CFE-PATH/cfe-1.2.5/build/broadcom/swarm

After building cfe, make a symbol link of cfe.bin in SIMOS_PATH/run/kernels. We also provide a built cfe binary for SimBCM. You can download it from here.

#cd SIMOS_PATH/run/kernels
#ln –s CFE-PATH/cfe-1.2.5/build/broadcom/swarm/cfe.bin cfe.bin

(Return to top)

2.5 Building Linux kernel

The description of building process is not available yet. You can download the binary linux kernel built by Kong Gang here.
(Return to top)

2.6 Configuring SimBCM to run Linux

Until now we have successfully build SimBCM and linux kernel. Before running linux kernel in SimBCM, we should configure the SimBCM. Change the value of field kernel_file to linux kernel path and the value of field bootloader_file to cfe.bin in SIMOS_PATH/run/scripts/

bootloader_file=" SIMOS_PATH/run/kernels/cfe.bin";

(Return to top)

2.7 Running Linux kernel

If all the above steps go well, we have successfully built the running environment of SimBCM. Change current path to SimBCM directory.

#cd SIMOS_PATH/run

SimBCM will dump some information of configuration and cfe information. At last, it will stop at cfe command console. Type boot –elf flash1:a to continue running SimBCM. This command tells cfe to load and run the kernel file in flash (the kernel file path value is specified by  field kernel_file in file SIMOS_PATH/run/scripts/

CFE>boot –elf flash1:a
Loader:elf Filesys:raw Dev:flash1 File:a Options:(null)  
Loading: 0xffffffff80100000/1950836 0xffffffff802dc474/84924 Entry at 0x802a1000
Starting program at 0x802a1000                    <-This process will take a long time. Please wait.
Broadcom SiByte BCM1250 A0-A6 @ 50 MHz (SB1 rev 0)
Board type: SiByte BCM91250A (SWARM)
Linux version (root@gkong) (gcc version 3.3.3 (DENX ELDK 3.1.1 3.3.3-9)) #62 SMP Mon Apr 17 07:26:26 CST 2006
CPU revision is: 01040100
This kernel optimized for simulation runs with CFE
Determined physical RAM map:
memory: 03fffe00 @ 00000000 (usable)
Built 1 zonelists
Kernel command line: root=/dev/ram0 
Primary instruction cache 32kB, 4-way, linesize 32 bytes.
Primary data cache 48kB, 3-way, linesize 32 bytes.
Synthesized TLB refill handler (27 instructions).
Synthesized TLB load handler fastpath (41 instructions).
Synthesized TLB store handler fastpath (36 instructions).
Synthesized TLB modify handler fastpath (35 instructions).
PID hash table entries: 256 (order: 8, 4096 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 61724k/65532k available (1438k kernel code, 3656k reserved, 225k data, 240k init, 0k highmem)
Mount-cache hash table entries: 512
Checking for 'wait' instruction... unavailable.
Detected 1 available secondary CPU(s)
softlockup thread 0 started up.
CPU revision is: 03040100
Primary instruction cache 32kB, 4-way, linesize 32 bytes.
Primary data cache 48kB, 3-way, linesize 32 bytes.
Synthesized TLB refill handler (27 instructions).
Brought up 2 CPUs
softlockup thread 1 started up.
NET: Registered protocol family 16
PCI: Skipping PCI probe. Bus is not initialized.
io scheduler noop registered
eth0: enabling TCP rcv checksum
eth0: enabling TCP rcv checksum
eth0: SiByte Ethernet at 0x10064000, address: 02:10:18:10:06:40
eth1: enabling TCP rcv checksum
eth1: enabling TCP rcv checksum
eth1: SiByte Ethernet at 0x10065000, address: 02:10:18:10:06:50
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
TCP bic registered
NET: Registered protocol family 10
IPv6 over IPv4 tunneling driver
Freeing unused kernel memory: 240k freed
(Return to top)

3. Building and running NICTA L4 pistachio

Currently L4 pistachio of NICTA can be run in SimBCM. NICTA L4 uses scons to build L4. However the build script of BCM1250 platform is not included in current release of NICTA L4 pistachio. We need to patch it before building l4 pistachio.

Firstly we need to download the hello-pistachio package containing L4 micro-kernel, sigma0, hello world root server and some libraries from here. Then unzip it and path it with the patch file we released. The patch file can be downloaded from here.

#tar zxvf hello-project--devel--1.1--patch-1.tar.gz
#patch –p0 <hello-pistachio.patch

Now you can build hello pistachio with scons. Before building you must ensure that scons has beed installed into your computer. 

#cd hello-project--devel--1.1--patch-1
#scons machine=sb1

During the building process, scons use dite to integrate pistachio kernel, sigma0 and hello root server into one binary file. This process is done automatically by scons script. If every thing goes well, the binary file will be put into directory hello-project--devel--1.1--patch-1/build. 

After builing hello pistachio, we need to configure SimBCM so that it can find hello-pistachio binary file we just built.

#cd hello-project--devel--1.1--patch-1/build
#ln –s bootimg.dite SIMOS_PATH/run/kernels/bootimg.dite
#cd SIMOS_PATH/run/scripts

Edit SIMOS_PATH/run/scripts/ Change kernel_file field to the following value.


Then run hello-pistachio in SimBCM.

#cd SIMOS_PATH/run

CFE> boot -elf flash1:a
Loader:elf Filesys:raw Dev:flash1 File:a Options:(null)
Loading: 0xffffffff80010000/106221 0xffffffff8002a000/68280 0xffffffff80040000/1696 0xffffffff800806a0/32 0xffffffff800806c0/9624 0xffffffff80090000/826 0xffffffff800d0340/320 0xffffffff800d0480/9296 0xffffffff800d3000/408 0xffffffff800d3198/3688 0xffffffff800d4000/144 0xffffffff800d4090/3952 Entry at 0x80010030
Starting program at 0x80010030

NICTA::Pistachio - built on Sep 26 2006 09:49:50 by root@Dragon using gcc version 3.4.4 broadcom_2006a_344
init_tlb:44: Initialize TLB
exception vector[0] = ffffffff80016f08
exception vector[1] = ffffffff800175f0
exception vector[2] = ffffffff80017468
exception vector[3] = ffffffff80017468
exception vector[8] = ffffffff80016ab0
interrupt vector[2] = ffffffff8001f5a0
interrupt vector[3] = ffffffff8001f5a0
interrupt vector[4] = ffffffff8001f5a0
interrupt vector[5] = ffffffff8001f5a0
interrupt vector[6] = ffffffff8001f5a0
kmem_init (ffffffff800d4000, ffffffff804d4000) [4M]
Allocated kernel space of size 0x2000 @ ffffffff800d4000
interrupt vector[7] = ffffffff80021d40
Registering processor 0 in KIP (100MHz, 50MHz)
Kernel configuration:
KTCB area: 0x4000000000000000 -> 0x4000007fffffffff (0x8000000000)
Initializing threading
Switching to idle thread (CPU 0)
Finalized CPU 0
system has 7 interrupts
Initializing root servers
root-servers: utcb_area: 0000000100000120 (256KB), kip_area: 00000002000000c0 (4KB)
creating sigma0 (0000002700000001)
creating root server (0000002900000001)
idle thread started on CPU 0
Hello, world. Press any key to continue
That's all folks!

If You do not want to build L4 kernel from scratch, you can download the hello-pistachio binary file built by Zhou Ya Jin from here.
(Return to top)

4. Debug OS kernel in SimBCM using GDB

You can use gdb to debug the OS kernel running in SimBCM. The GDB source code can be downloaded here(patched by konggang). Assume GDB_PATH is the path you put GDB package.

#gzip –d simbcm-gdb.tar.gz

#tar -xvf simbcm-gdb.tar
#mkdir gdb-build
#mkdir gdb-install
#cd gdb-build
#export PREFIX= GDB_PATH/gdb-install
#export TARGET=mips-unknown-linux-gnu
#../gdb/configure --target=$TARGET --prefix=$PREFIX
#make install
#cd GDB_PATH/gdb-install/bin

The binary file mips-unknown-linux-gnu-gdb is the binary file we just build. You can add this file's path to PATH.Before you debug the kernel running in SimBCM, you need to turn on the debug option in SimBCM configure. Change the value of field gdb_debug in SIMOS_PATH/run/script/ from 0 to 1.


You need a .gdbinit to tell the GDB some information of the target and the kernel before GDB runs. The following is an example of .gdbinit file.

add-symbol-file vmlinux.sym
set remotebreak 0
set remotecache 0
set debug remote 0
set remotetimeout 10000
set watchdog 0
set architecture mips:sb1
target remote localhost:5000
b *0x80010030

Now you can use mips-unknown-linux-gnu-gdb to debug your kernel just like the way you use gdb to debug your application.
(Return to top)

5. Feedback

If you have any suggestion or feedback of this document, please send a message to our maillist.
(Return to top)

This site is hosted by Logo

The css file is taken from SDCC website.

Last updated:
Sept 26, 2006 20:00:01 By Zhou Ya Jin