II.2 Customizing BOOT-51

BOOT-51 must be customized for the target board, before it is ready for assembly. This is performed with an include file boot51.inc, containing the required configuration data. boot51.inc is generated with the BOOT-51 Customization Utility CUSTOMIZ.
There are two major groups of configuration parameters:

CUSTOMIZ is invoked as shown below:

   customiz <baud> [<timer> [<prec> [<clock> [<start> [<user>]]]]]

The first four parameters are for baudrate generation, and the last two parameters are memory addresses. Parameters in brackets are optional.
If CUSTOMIZ is invoked without parameters, it displays a help screen.

<baud> is the desired nominal baudrate (in Baud), BOOT-51 should use for communication with the host system.
<timer> is the on-chip timer or baudrate generator that is used for baudrate generation. Legal values are:

T1 = timer 1, available on nearly all 8051 derivatives (default)
T2 = timer 2, available on 8052/32 and all true compatibles
BG = internal baudrate generator on 80C515/35 and 80C517/37
BA = internal baudrate generator on 80C515A and 80C517A
D1 = timer 1 with clock/12 or clock/4 prescaler on 80C320
<prec> is the required relative precision of the baudrate in %. The default precision is 1.0 %.
<clock> is the system clock frequency in MHz. (11.0592 MHz default)
<start> is the start address of BOOT-51 on the target system in hex representation. (default is 0000H)
<user> is the usual hex start address of the application programs in the external memory. (default is 8000H)

Baudrate:

For the serial interface, the standard UART is used that is available on almost every 8051 derivative. BOOT-51 is always running the UART in Mode 1, that is asynchronous mode, 8 data bits, 1 stop bit, no parity.
However, depending on the derivative, there may be various timers or prescalers that can be used for baudrate generation.
If the desired baudrate cannot be generated or the precision is too bad, CUSTOMIZ will display a corresponding error message. In this case, try another baudrate generator that is also available on your derivative. If this fails, too, try another baudrate that may also do, or think of using another oscillator crystal that suits better for the task. You should play around with CUSTOMIZ, to explore how to get best results. The tables in Appendix E show the precisions of the most frequently used baudrates that can be generated with the supported timers and baudrate generators, for some standard clock frequencies. In most cases baudrate deviations of 2 to 3 % are no problem for the communication with a PC. Whenever in doubt, try it!
BOOT-51 can receive data at very high baudrates without the need for a handshake protocol. Output is done more slowly with short pauses between the characters, to avoid a data overrun of the PC UART. The maximum effective output speed of BOOT-51 is corresponding to 9600 Baud (max. 1 character per ms).
In general, speed is rather a problem for the PC than for the micro.

Example 1:        customiz 9600 BG 0.1 12
  
  will generate an include file for BOOT-51 that configures it for 9600 Baud, generated with the internal baudrate generator of a SAB80C535 or SAB80C537 that is clocked with 12.0 MHz. The required precision is 0.1 %. The bootstrap and application program start addresses are set to their default values.

Addresses:

<start>:
An 8051 starts program execution at CODE address 0000H after reset. Thus there must always be ROM at CODE address 0000H to execute the first instructions. On most 8051 boards there is EPROM in the range 0000H-7FFFH, and RAM in the range 8000H-FFFFH. However, the final application programs will usually start at address 0000H, and the 8051 interrupt addresses start at address 0003H. If application programs can be loaded into RAM at 8000H, this is normally not quite realistic for testing.
Hence it would be nice to have CODE/XDATA-RAM at address 0000H to load and test application programs. That is why some evaluation boards (e.g. the Keil MCB-517) remap the EPROM from address 0000H to 8000H, and the RAM from 8000H to 0000H, when the first memory access to a CODE address > 7FFFH occurs.
To support this, BOOT-51 starts with a long jump to its entry point, to eventually remap the memory. If you own a corresponding evaluation board, specify the <start> address of BOOT-51 to the location, where it resides after memory remapping!

<user>:
In principle, BOOT-51 can load an application program at any location in the external RAM and start it there. However, the interrupt addresses should be redirected to the location, where application programs usually start, e.g. the start address of the external RAM.
Hence the <user> address should point to the location, where the CODE/XDATA-RAM starts. If it starts at 8000H, interrupt 0003H is redirected to 8003H, interrupt 000BH to 800BH, and so on.
If the CODE/XDATA-RAM starts at 0000H (after remapping), the <user> address has no practical meaning and can be left default.

Example 2:        customiz 19200 T2 1 11.0592 0 C000
  
  will generate an include file for BOOT-51 that configures it for 19200 Baud, generated with timer 2 of an 80C52 or 80C32 that is clocked with 11.0592 MHz. The required precision is 1 %. BOOT-51 is located at address 0000H in the EPROM, and the interrupt addresses are redirected to location 0C000H.

If CUSTOMIZ aborts with an error message, it returns exit code 1 on parameter- and baudrate-errors, and exit code 2 on fatal runtime errors. When CUSTOMIZ terminates without error message, it returns exit code 0, and a customization header file boot51.inc should be present in the default directory. With this file, BOOT-51 can be assembled as usual with

ASEM BOOT51                           (DOS)
asem boot51.a51                       (Linux)

Remember that BOOT-51 requires ASEM-51 V1.3 or later!
Now there should be an Intel-HEX file boot51.hex, which may serve directly as an input for the EPROM programmer. We may also convert it to a binary image file with the HEXBIN utility:

HEXBIN BOOT51/LENGTH:4000              (DOS)
hexbin -l 4000 boot51.hex              (Linux)

would generate a binary image file boot51.bin for a 16 kB EPROM (27C128).
(Note: Only 1 kB of EPROM is required for the BOOT-51 program code.)
Once in an EPROM, BOOT-51 should be ready to run on the target system.