Building an Application for Execution in a SerialICE Debug Environment

To build an application for execution under SerialICE, you should use the pmcc command. This command "knows" about the requirements of the SerialICE execution environment, and will use the correct include files and run-time library.

Before you use the pmcc command, you will need to set your environment in order to add the pmcc command to your command search path.

The pmcc command accepts most of the usual options that are recognized by a UNIX-style "cc" command. For example, you may..

Please refer to the pmcc documentation for a complete listing of the options supported by this command.

For example, to build a simple "Hello world" program for execution on a BDMR4101 evaluation board, you would type:

	pmcc -board bdmr4101 -o hello hello.c
The -board option "tells" pmcc which startup files to include.

The above command produces three files: hello, hello.map, and hello.rec. The file hello contains the linked and located object code, hello.map contains a global symbol map, and hello.rec contains the downloadable records.

SOURCE-LEVEL DEBUGGERS

Note that if you are using a source-level debugger as your host-resident debugger, you will also need to specify the "-g" option. For example,
	pmcc -board bdmr4101 -g -o hello hello.c
In general it is better to place all of the options before the list of files.

PROMABLE APPLICATIONS

If you want to "burn" your application into ROM, you can specifiy the option -prom. For example,

	pmcc -prom -board bdmr4101 -o hello hello.c
This will produce an S-record file that can be used by a PROM Programmer to create a bootable ROM (or ROMS). The image generated will automatically include a SerialICE Kernel to permit debugging of the ROM-based application. Note that the -prom option must preceed the -board option. If you find that the S4 records that this command creates, confuse your PROM Programmer, you can omit them by adding the -syms option.

If you wish to use imon95 to debug this ROM-based application. You can load the symbol information into imon95 by using the command, "load -m hello.rec". But this won't work if you used the -syms option to exclude the symbol information from the file.

IN-CIRCUIT PROGRAMMING

If you would prefer to self-update the flashes by using in-circuit programming. You can created a self-updating image using the following command together with the hello.rec file created from the previous example.

	pmcc -board bdmr4101 -xflash -o xhello hello.rec
This will create a downloadable image that, when executed, will copy itself into the flashes. Note that the -xflash option must come after the -board option.

If you are using the BDMR4101, you might find it convenient to use the following self-updating scheme to "burn" your program into flash.

  1. Starting with a SerialICE Kernel in the flashes.
  2. Build your application using -xflash as shown above.
  3. Download the xflashed .rec file.
  4. Type "g", and then wait for at least double the number of estimated seconds (the message is printed to tty0).
  5. Press reset.

If you are using either the BDMR4011 or BDMR4102, you might find it convenient to use the following scheme to "burn" your program into flash.

  1. Jumper the board to boot from EPROM, and install a PMON EPROM.
  2. Build your romable application but don't perform the -xflash step.
  3. At the PMON prompt, type "load e0420000" and then download the kernel or rom-based application. The value a0420000 is an offset that causes the S-records that start at bfc00000 or 9fc00000 to be loaded into memory at a0020000 or 80020000 respectively.
  4. At the PMON prompt, type "copy -f a0020000 bfd00000 size", where size is the size of the download as reported by the load command.
  5. Rejumper the board to boot from flash, and then press reset.

R4000 EXCEPTIONS

If your processor supports R4000-style exceptions (eret vs rfe), and you wish to operate in that mode, you should include the -mips2 option. This will instruct the compiler to use instructions from the mips2 architecture, and will cause your application to be linked with the correct startup code for using r4000-style exceptions. Note that the -mips2 option must preceed the -board option. If you do place it after the -board option, it will still instruct the compiler to use mips2 instructions, but you won't get the r4000-compatible startup files.

CUSTOM START ADDRESS

If you wish to override the start address selected by the -board option that you specified. You may use the -T and -D options, but they must appear after the -board option.

HOW IT WORKS

The general rule for combining these pmcc options is, that you may include -prom and -mips2, but these must appear before -board. The -T and -xflash options, if specified, must appear after -board. You may not specify both the -prom and -xflash options. It can be summarized as follows:

	pmcc [-prom] [-mips2] -board boardname [-xflash] [-T address]
You can find the code that implements most of the board-specific logic in tools/misc.c. The -board switch causes pmcc to use one of the following sets of files as the startup code.

FilesBoard
lib/ia4101.s lib/ic4101.c bdmr4101
lib/ia4011.s lib/ic4011.c bdmr4011
lib/ia4102.s lib/ic4102.c bdmr4102
These startup files use the standard PMON mechanisms to provide:


Navigation: Document Home | Document Contents | Document Index