Bootstrap Examples

These examples are very small and they are designed to fit in less than 256 bytes (less than 240 to leave room for the stack). They represent typical programs that can be uploaded during the 68HC11 bootstrap mode.

In general to compile and link these programs, you will use the following command:

      m6811-elf-gcc -o file.elf -nostdlib -nostartfiles \
		    -Wl,-defsym,_io_ports=0x1000 \
		    -Wl,-defsym,_.tmp=0x0 -Wl,-defsym,_.z=0x2 \
		    -Wl,-m,m68hc11elfb \
		    -mshort -Os -fomit-frame-pointer -msoft-reg-count=0 \
		    file.c
    

In this cryptic and long command, the following options are used by the compiler:
-mshort This option tells gcc to use 16-bit integers.
-Os This option tells gcc to optimize for size.
-fomit-frame-pointer This option tells gcc to remove the frame pointer.
-msoft-reg-count=0 This option tells gcc to avoid to use soft registers (except _.tmp and _.z which are sometimes necessary)

And the following options are used by the linker:
-nostdlib The standard libraries are not passed to the linker.
-nostartfiles The standard startup files are not used during the link.
-defsym _io_ports=0x1000 The linker will define the symbol _io_ports and assign it the value 0x1000. This symbol is used by the examples to access the 68HC11 registers.
-defsym _.tmp=0x0
-defsym _.z=0x0
This will define the symbol _.tmp used by gcc.