Services and Modeling for Embedded Software Development
Embecosm divider strip
Prev  Next

5.5.2. for the BSP

The first part of is just transferring values from configure and is used unchanged. The first potential variation is in multilib handling. If your GCC implements multilibs, then that may need to be mirrored in the BSP implementation. If not, then there is no need to set MULTIDO and MULTICLEAN to true and these lines can be removed.

The in libnosys includes an option to use new versions of the loader and assembler. However for most implementations, the plain tool is all that is needed, so simple transfer of the configured values is sufficient.

CC = @CC@
AS = @AS@
AR = @AR@
LD = @LD@

The main tools will already have been transformed to take account of any prefix (for example using or32-elf-gcc rather than gcc). However this has not been done for objdump and objcopy, so these are transformed here.

This is the point at which we define the BSPs to be built. Any custom flags for the compilation can be added to CFLAGS here.


We specify the C start up file(s) and BSP(s) to be built.

CRT0     = crt0.o
BSP      = libor32.a
BSP_UART = libor32uart.a


It is important to define OUTPUTS. This is the complete set of programs and libraries being built. It is used in the clean and install targets.

For each BSP we specify the object files from which it is built. For the plain OpenRISC 1000  BSP we have:

OBJS = _exit.o      \
       close.o      \
       environ.o    \
       execve.o     \
       fork.o       \
       fstat.o      \
       getpid.o     \
       isatty.o     \
       kill.o       \
       link.o       \
       lseek.o      \
       open.o       \
       read.o       \
       sbrk.o       \
       stat.o       \
       times.o      \
       uart-dummy.o \
       unlink.o     \
       wait.o       \

For the BSP with UART support we use many of the same files, but also have some different files.

UART_OBJS = _exit.o       \
            close.o       \
            environ.o     \
            execve.o      \
            fork.o        \
            fstat-uart.o  \
            getpid.o      \
            isatty-uart.o \
            kill.o        \
            link.o        \
            lseek-uart.o  \
            open.o        \
            read-uart.o   \
            sbrk.o        \
            stat.o        \
            times.o       \
	    uart.o        \
            unlink.o      \
            wait.o        \

At this point, the version of in libnosys specifies explicitly the rules for compiling object files from C and assembler source. However it is better to incorporate a standard set of rules, using the host_makefile_frag reference from the configuration.


This is the point at which to specify the first make rule to create the C runtime start up files and BSPs.

all: ${CRT0} ${BSP} ${BSP_UART}

The object files (including crt0.o) will be built automatically, but we need rules to build the libraries from them.

$(BSP): $(OBJS)
        ${AR} ${ARFLAGS} $@ $(OBJS)
        ${RANLIB} $@

        ${AR} ${ARFLAGS} $@ $(UART_OBJS)
        ${RANLIB} $@

The remainder of is standard. It provides rules to clean the build directory, to install the generated BSP(s) and C start up file(s), and rules to ensure configure and Makefile are regenerated when necessary.

There also hooks to create, clean and install any documentation (as info files), which are empty by default.

Very often these rules are sufficient, so long as all the entities created have been listed in OUTPUTS. They should be modified if necessary.

Embecosm divider strip