91.305 home
syllabus html pdf
assignment 1 html pdf
rev'd short syll. txt
lecture 3 notes txt
data sheets html
uml305dev html pdf
parts list pdf
assembly html pdf
assignment 2a html pdf
assignment 2b html pdf
assignment 3
  main html pdf
  java setup html
  files zip
bootloader html
assignment 4 html pdf
assignment 5
  main html pdf
  files zip
  reading pdf
assignment 6 html pdf
invokevirtual pdf
assignment 7 html pdf
IA-32 manual pdf
assignment 8 html pdf
assignment 9 pdf
review html pdf
resources data IKonboard software

BootLoad: A Java-based HC11 Bootloader

This page presents a Java program that reads the .rel object files produced by the as6811 assembler, and then loads that code into the HC11 via bootstrap mode.

This means you no longer have to manually copy the object code bytes from the assembler output files into the HC11Boot.java source file.


To use the new bootloader, named BootLoad, first grab the two Java source files (BootLoad.java and ReadRel.java). Save these in the same directory as your previously installed Serial.java file.

Now compile:

javac BootLoad.java ReadRel.java

If you didn't get any errors, it worked, and you should now have the files BootLoad.class and ReadRel.class in your directory. (You may need to give the full path to javac, depending on your installation.)


Next, you must instruct the as6811 assembler to produce a .rel “relocatable object” file. This is done with the -o flag. So, for instance, assemble the beep.s file with:

as6811 -ol beep.s

This will instruct the assembler to produce two files: the .lst listing file, plus now also a .rel object file.

The .rel File

Let's look at the .rel file:

H 1 areas 1 global symbols
S .__.ABS. Def0000
A _CODE size 11 flags 0
T 00 00 CE 10 00 1C 00 10 4A 26 FD 1D 00 10 4A
R 00 00 00 00
T 00 0D 26 FD 20 F2
R 00 00 00 00

The lines starting with T contain the object code. On each of these lines, the next two bytes indicate the starting address for that line of code. The rest of the line contains the bytes.

For example, the first code line indicates a target address of 0x0000 (specified by the "00 00"). There are 13 bytes of object code on that line; the first byte is CE and the last byte on the line is 4A.

(All values in the file are in hex; so, for instance, the line that states A _CODE size 11 tells you that there are 0x11 or 17 decimal total bytes of code.)

The Java class ReadRel has methods that parse this file, returning a 512-byte array containing the resulting object code.

Running It

To download the code from the .rel file to your HC11 board, turn on your board and then say:

java BootLoad beep COM1

The program automatically appends the file suffix .rel to the source file beep.

You should see a display like:

Using serial port COM1
Read 17 bytes of code from file beep.rel
Writing to serial line...

When the bootloader finishes, your HC11 system will then be running the object code from the assembled .rel file. No more transcribing bytes from the listing file!

Last modified: Thursday, 10-Oct-2002 14:07:43 EDT by