ChorusOS 4.0 Porting Guide

Power-up Program Implementation

Example 3-1 is an example power-up initialization program for the EST SBC8260 board. The source is provided in src/nucleus/bsp/powerpc/sbc8260/src/boot/trampoline.s.


Example 3-1 Power-up Program

        .text

        .globl  __mkimage__label__REF_start
        /*
         * If used as powerup initialization program, 
         * "reset" must be link-edited at address where CPU starts from
         */
        .globl  reset

reset:
        /*
         * Put power up initialization code here
         */   
        
        /*
         * Jump to bootconf entry point
         */
        xor        r3, r3, r3
        addis      r5, r0, entryPoint@ha        /*                      */
        addi       r5, r5, entryPoint@l         /*                      */
        lwz        r5, 0(r5)                    /* r5 = entryPoint      */
        mtlr       r5                           /*                      */
        blr                                     /* (*entryPoint)();     */

        .globl  __mkimage__label__REF_start
__mkimage__label__REF_start:
entryPoint:
        .long    0                              /* bootconf entry point */

mkimage binds the bootconf program entry point to the power-up initialization program, patching the contents of the location labelled __mkimage__label__REF_start with the address of the entry point location labelled by __mkimage__label__start, as described in "bconf_crt0.s Source File".

This power-up program forces the board-specific (second) argument of the bootconf program to 0, using the argument passing convension described in "bootconf Binary".