sparc-rtems-mkprom user's manual

Introduction

The sparc-rtems-mkprom program creates boot-images for LEON applications compiled with the RCC cross-compiler. It encapsulates the application in a loader suitable to be placed in a boot prom. The application is compressed with a modified LZSS algorithm, typically achieving a compression factor of 2. The loader operates in the following steps:
  1. The register files of IU and FPU (if present) are initialized.
  2. The control, waitstate and memory configuration registers are set according to the specified options.
  3. The application is decompressed and installed into RAM
  4. Finally, the application is started, setting the stack pointer to the top of ram.

NOTE: sparc-rtems-mkprom can only generate boot proms for LEON2 and LEON3 processors. Other SPARC processors like TSC691 or TSC695 (ERC32) are not supported.

Usage

sparc-rtems-mkprom is a command line utility that takes a number of options and files to encapsulate:

sparc-rtems-mkprom [options] files

To generate a boot-prom for a typical system, do:


sparc-rtems-mkprom -v -rmw -ramsize 1024 hello

LEON3 MKPROM boot-prom builder for BCC v1.0.6
Copyright Gaisler Research 2004, all rights reserved.

loading hello:
section: .text at 0x40000000, size 15744 bytes
Uncoded stream length: 15744 bytes
Coded stream length: 7794 bytes
Compression Ratio: 2.020
section: .data at 0x40003d80, size 2016 bytes
Uncoded stream length: 2016 bytes
Coded stream length: 691 bytes
Compression Ratio: 2.918

creating LEON boot prom: prom.out

When executed, the prom prints a configuration message at start-up:

tsim> run


  MkProm LEON boot loader v1.2
  Copyright Gaisler Research - all right reserved

  system clock   : 50.0 MHz
  baud rate      : 19171 baud
  prom           : 512 K, (2/2) ws (r/w)
  sram           : 1024 K, 1 bank(s), 0/0 ws (r/w)

  decompressing .text
  decompressing .data

  starting hello

Hello world!


sparc-rtems-mkprom general options

-baud baudrate

Set rate of UART A to baudrate. Default value is 19200.

-bdinit

The user can optionally call two user-defined routines, bdinit1() and bdinit2(), during  the boot process. bdinit1() is called after the LEON registers have been initialized but before the memory has been cleared. bdinit2() is called after the memory has been initialized but before the application is loaded. Note that when bdinit1() is called, the stack has not been setup meaning that bdinit1() must be a leaf routine and not allocate any stack space (no local variables). When -bdinit is used, a file called bdinit.o must exist in the current directory, containing the two routines.

-dump

The intermediate assembly code with the compressed application and the LEON register values is put in dump.s (only for debugging of mkprom3).

-freq system_clock

Defines the system clock in MHz. This value is used to calculate the divider value for the baud rate generator and the real-time clock. Default is 50 for LEON.

-noinit

Suppress all code which initializes on-chip peripherals such as uarts, timers and memory controllers. This option requires -bdinit to add custom initialisation code, or the boot process will fail.

-nocomp

Don't compress application. Decreases loading time on the expense of rom size.

-o outfile

Put the resulting image in outfile, rather then prom.out (default).

-stack addr

Sets the initial stack pointer to addr. If not specified, the stack starts at top-of-ram.

-v       

Be verbose; reports compression statistics and compile commands

input_files

The input files must be in aout or elf32 format. If more than one file is specified, all files are loaded by the loader and control is transferred to the first segment of the first file.


sparc-rtems-mkprom options for the LEON2 memory controller

-cas delay

Set the SDRAM CAS delay. Allowed values are 2 and 3, 2 is default.

-col bits

Set the number of SDRAM column bits. Allowed values are 8 - 11, 9 is default.

-nosram

Disables the static RAM and maps SDRAM at address 0x40000000.

-ramsize size

Defines the total available RAM. Used to initialize the in the memory configuration register(s). The default value is 2048 (2 Mbyte).

-ramcs chip_selects

Set the number of ram banks to chip_selects. Default is 1.

-ramws ws

Set the number of waitstates during ram reads and writes to ws. Default is 0.

-ramrws ws

Set the number of waitstates during ram reads to ws. Default is 0.

-ramwws ws

Set the number of waitstates during ram writes to ws. Default is 0.

-romws ws

Set the number of rom waitstates during read and write to ws. Default is 2.

-romrws ws

Set the number of rom waitstates during read to ws. Default is 2.

-romwws ws

        Set the number of rom waitstates during write to ws. Default is 2.

-ramwidth width

Set the data bus width to 8, 16 or 32-bits, default is 32. The prom width is set through the PIO[1:0] ports.

-rmw

Perform read-modify-write cycles during byte and halfword writes.

-sdram size

The amount of attached SDRAM in Mbyte. 0 by default

-sdrambanks num_banks

Set the number of populated SDRAM banks (default is 1).

-trfc delay

Set the SDRAM tRFC parameter (in ns). Default is 66 ns.

-trp delay

Set the SDRAM tRP parameter (in ns). Default is 20 ns.

-refresh delay

Set the SDRAM refresh period (in us). Default is 7.8 us, although many SDRAMS actually use 15.6 us.



Jiri Gaisler.
Copyright 2004 Gaisler Research. Comments or bug reports to jiri@gaisler.com.


Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided also that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.