ChorusOS 4.0 Porting Guide

Example BootConf Structure

This section contains an example of a BootConf structure for the SBC8260 PPC8260 EC603e-based board.


Example 2-1 BootConf Structure

#include bki/bki.h
#include bki/f_bki.h
PhChunk __mkimage__label__kernelSpace[] = {
        { 0x0, 0x1000000, KSP_PPC60x_BAT|KSP_PPC60x_M|KSP_PPC60x_RW },
        { 0x0, 0xe000000, KSP_INVALID },
        { 0xf000000, 0x20000, KSP_PPC60x_BAT|KSP_PPC60x_G|KSP_PPC60x_I|KSP_PPC60x_RW },
        { 0x0, 0xecfe0000, KSP_INVALID },
        { 0xfc000000, 0x4000000, KSP_PPC60x_BAT|KSP_PPC60x_RO }
};
BankDesc __mkimage__label__banks[] = {
        { "sys_bank", BANK_KSP, 0, 0x100000, 0xb3000}
};
BinDesc __mkimage__label__binDesc[] = {
        {
                "dbgBsp",
                0,
                0,
                0x10042c,
                BIN_DBG_DRIVER,
                0 | 0
        },
        {
                "dbgAgent",
                1,
                1,
                0x104494,
                BIN_DBG_AGENT,
                0 | 0
        },
        {
                "boot",
                2,
                2,
                0x108000,
                BIN_BOOTSTRAP,
                0 | 0
        },
        {
                "reboot",
                3,
                3,
                0x10d27c,
                BIN_REBOOT,
                0 | 0
        },
        {
                "kern",
                4,
                5,
                0x125418,
                BIN_KERNEL,
                0 | 0
        },
        {
                "D_tbDec",
                6,
                6,
                0x186000,
                BIN_DRIVER,
                0 | 0
        },
        {
                "D_quicc8260",
                7,
                8,
                0x188000,
                BIN_DRIVER,
                0 | 0
        },
        {
                "D_fccEther",
                9,
                9,
                0x18e000,
                BIN_DRIVER,
                0 | 0
        },
        {
                "PD",
                10,
                11,
                0x195000,
                BIN_SUPERVISOR,
                0 | 0
        },
        {
                "kernonly_symb",
                12,
                12,
                0x198000,
                BIN_DBG_AGENT,
                0 | 0
        },
        {
                "kernonly_bconf",
                13,
                13,
                0x1b0000,
                BIN_BOOTCONF,
                0 | 0
        }
};
BinSegDesc __mkimage__label__segDesc[] = {
        {
                0x100000,
                0x100000,
                0x608,
                0x608,
                SEG_XIP | SEG_EXEC | SEG_READ | SEG_WRITE,
                SEG_KSP
        },
        {
                0x101000,
                0x101000,
                0x6234,
                0x6234,
                SEG_XIP | SEG_EXEC | SEG_READ | SEG_WRITE,
                SEG_KSP
        },
        {
                0x108000,
                0x108000,
                0x4358,
                0x4358,
                SEG_XIP | SEG_EXEC | SEG_READ | SEG_WRITE,
                SEG_KSP
        },
        {
                0x10d000,
                0x10d000,
                0x2200,
                0x2200,
                SEG_XIP | SEG_EXEC | SEG_READ | SEG_WRITE,
                SEG_KSP
        },
        {
                0x110000,
                0x110000,
                0x75920,
                0x75920,
                SEG_XIP | SEG_EXEC | SEG_READ | SEG_WRITE,
                SEG_KSP
        },
        {
                0x186000,
                0x8000,
                0x0,
                0x1a000,
                SEG_READ | SEG_WRITE,
                SEG_KSP
        },
        {
                0x186000,
                0x186000,
                0x1be4,
                0x1be4,
                SEG_XIP | SEG_EXEC | SEG_READ | SEG_WRITE,
                SEG_KSP
        },
        {
                0x188000,
                0x188000,
                0x50dc,
                0x50dc,
                SEG_XIP | SEG_EXEC | SEG_READ | SEG_WRITE,
                SEG_KSP
        },
        {
                0x18e000,
                0x22000,
                0x0,
                0x10,
                SEG_READ | SEG_WRITE,
                SEG_KSP
        },
        {
                0x18e000,
                0x18e000,
                0x6654,
                0x6654,
                SEG_XIP | SEG_EXEC | SEG_READ | SEG_WRITE,
                SEG_KSP
        },
        {
                0x195000,
                0x195000,
                0x22c4,
                0x22c4,
                SEG_XIP | SEG_EXEC | SEG_READ | SEG_WRITE,
                SEG_KSP
        },
        {
                0x198000,
                0x23000,
                0x0,
                0xc04,
                SEG_READ | SEG_WRITE,
                SEG_KSP
        },
        {
                0x198000,
                0x198000,
                0x170c8,
                0x170c8,
                SEG_XIP | SEG_EXEC | SEG_READ | SEG_WRITE,
                SEG_KSP
        },
        {
                0x1b0000,
                0x1b0000,
                0x2c10,
                0x2c10,
                SEG_XIP | SEG_EXEC | SEG_READ | SEG_WRITE,
                SEG_KSP
        },
        {
                0,
                0,
                0,
                0,
                0,
                0
        },
        {
                0,
                0,
                0,
                0,
                0,
                0
        }
};
PhChunk __mkimage__label__ramChunks[64] = {
        { 0x0, 0x4000, PH_RAM_NONEXISTENT },
        { 0x4000, 0x20000, PH_RAM_ALLOCATED },
        { 0x24000, 0xdc000, PH_RAM_NONEXISTENT },
        { 0x100000, 0xb3000, PH_RAM_ALLOCATED },
        { 0x1b3000, 0xffe4d000, PH_RAM_NONEXISTENT }
};
EnvDesc __mkimage__label__environ = {   0x0, 0x0, (char*) 0x100000};
int heapSize = 0x2000;
char heap[0x2000];
BootConf __mkimage__label__bootConf = {
        0x38216b39,
        0,
        {
                5,
                __mkimage__label__kernelSpace
        },
        0x0,
        1,
        __mkimage__label__banks,
        11,
        __mkimage__label__binDesc,
        14,
        __mkimage__label__segDesc,
        {
                64,
                5,
                __mkimage__label__ramChunks
        },
        0,
        &__mkimage__label__environ,
        heap,
        heap,
        heap + 8192,
};
BootConf* bootConf= &__mkimage__label__bootConf;

The kernelSpace field of the BootConf structure contains the description of the kernel address space that must be established by the microkernel's memory management module.

The descriptor specifies that the first 16M of the physical address space, which corresponds to RAM potentially available on the board, must be mapped to the first 16M of the virtual address space using one Block Address Translation register pairs (IBAT and DBAT). The space must be mapped read/write enforcing memory coherency (that is, the memory control bit M must be set in the BATs).

Another pair of BATs must be used to map to the virtual address range from 0x0f000000 to 0x0f020000. These are the PPC8260 internal memory mapped registers which occupy the physical addresses from 0xf000000 to 0x0f020000. The space must be mapped read-only bypassing the memory cache.

The system image is stored in one memory bank that must be installed at the address 0x00100000. The size of the bank is 0x00b3000 bytes.

A third pair of BATs must be used to map the last 64M of the physical address space, which corresponds to ROM (FLASH) potentially available on the board. This space must be mapped read-only.

The system image contains 11 binaries:

Some binaries (for example, boot) have just one XIP segment which includes all text and data. Others (for instance, kern) have zero-initialized data (bss) , link-edited in a separate segment.

The RAM allocator specifies that the RAM from address 0x00004000 to address 0x00024000 and from address 0x00100000 to address 0x001b3000 is allocated. The memory from 0x00100000 to 0x001b3000 is occupied by the system image memory bank, and the memory from 0x00004000 to 0x00024000 by the system control blocks and bss.