2.8 Compiling and Linking

In section 2.3 we introduced the boot function boot without much explanation. Yet there is no set specification for this function, and the programmer is free to change the settings for this function using the spec file, which we introduced in Chapter 1.

The spec file specifies the final ROM image information for the compiled object files when they are linked.

List 2-6 See basic2 "spec"

#include <nusys.h>

/* Code area  */
beginseg
          name    "code"
          flags   BOOT OBJECT
          entry   nuBoot
          address NU_SPEC_BOOT_ADDR
          stack   NU_SPEC_BOOT_STACK
          include "codesegment.o"
          include "$(ROOT)/usr/lib/PR/rspboot.o"
          include "$(ROOT)/usr/lib/PR/gspF3DEX.fifo.o"
            (Some lines have been omitted)
          include "$(ROOT)/usr/lib/PR/gspS2DEX.fifo.o"
          include "$(ROOT)/usr/lib/PR/gspS2DEX.fifo_d.o"
endseg

beginwave
        name "64basic2"
        include "code"
endwave

Take a look at the actual spec file for the basic2 program. On line 7, you see the following description:

entry nuBoot

As you probably already understand, if for example, you were to write "entry afunc" here, the function afunc would become the boot function that is executed when the program is activated (if you use NuSystem, please call nuBoot). You can also specify with the spec file, the array to be used as the framebuffer area (the program, and not the spec file, determines what it will be used for).