### 5.4 Adding a new board ¶

Adding a new board consists of creating a new board configuration file. Examples are in `dejagnu/baseboards`. Usually to make a new board file, it’s easiest to copy an existing one. It is also possible to have your file be based on a baseboard file with only one or two changes needed. Typically, this can be as simple as just changing the linker script. Once the new baseboard file is done, add it to the `boards_DATA` list in the `dejagnu/baseboards/Makefile.am`, and regenerate the Makefile.in using automake. Then just rebuild and install DejaGnu. You can test it by:

There is a crude inheritance scheme going on with board files, so you can include one board file into another, The two main procedures used to do this are `load_generic_config` and `load_base_board_description`. The generic configuration file contains other procedures used for a certain class of target. The board description file is where the board specific settings go. Commonly there are similar target environments with just different processors.

Testing a New Board Configuration File

    make check RUNTESTFLAGS="--target_board=newboardfile".

Here’s an example of a board configuration file. There are several helper procedures used in this example. A helper procedure is one that look for a tool of files in commonly installed locations. These are mostly used when testing in the build tree, because the executables to be tested are in the same tree as the new DejaGnu files. The helper procedures are the ones in brackets, which indicates a Tcl procedure call.

Example Board Configuration File

    # Load the generic configuration for this board. This will define a basic
    # set of routines needed by the tool to communicate with the board.
    load_generic_config "sim"

    # basic-sim.exp is a basic description for the standard Cygnus simulator.
    load_base_board_description "basic-sim"

    # The compiler used to build for this board. This has *nothing* to do
    # with what compiler is tested if we're testing gcc. Further, this is
    # the default, so this line is optional for most boards.
    set_board_info compiler "[find_gcc]"

    # We only support newlib on this target.
    # However, we include libgloss so we can find the linker scripts.
    set_board_info cflags "[newlib_include_flags] [libgloss_include_flags]"
    set_board_info ldflags "[newlib_link_flags]"

    # No linker script for this board.
    set_board_info ldscript "-Tsim.ld"

    # The simulator doesn't return exit statuses and we need to indicate this.
    set_board_info needs_status_wrapper 1

    # Can't pass arguments to this target.
    set_board_info noargs 1

    # No signals.
    set_board_info gdb,nosignals 1

    # And it can't call functions.
    set_board_info gdb,cannot_call_functions 1