Uploading programs to the Dragon12-Plus

Author: Colin D. Bennett <colin@gibibit.com>
Date: 23 May 2008


The Dragon12-Plus uses a serial boot loader and debug monitor called D-Bug12. D-Bug12 has a mode called EVB mode that allows programs to be downloaded into the HCS12's RAM and then executed directly from RAM. This avoids having to write to flash memory whenever programs are uploaded, and if your program crashes, a board reset will bring it back to life. FreeHC12 currently only supports this EVB mode of the Dragon12-Plus.

Uploading your program

Connect serial port P1 of the Dragon12-Plus (the one closest to the 16x2 alphanumeric LCD display) to your computer. You may use a USB-serial converter or a regular RS-232 serial port. Connect power to the Dragon12-Plus board.

Using a terminal program such as Minicom, open a connection to the serial port at 9600 bps, 8 data bits, 1 stop bit, and no parity. With the terminal program open, connect power to the Dragon12-Plus board. If the serial link is properly connected, you should see the following text on your terminal window:

D-Bug12 4.0.0b32
Copyright 1996 - 2005 Freescale Semiconductor
For Commands type "Help"


This is the D-Bug12 command prompt. Let's build and upload the seven segment LED display example. To build it, change to the example_7segment2 directory in the FreeHC12 examples and type make. This builds the .s19 file build/7seg.s19, which we need to upload to the board. In your terminal program connected to the Dragon12-Plus, type load and press enter:


D-Bug12 now waits for an S-record file to be sent to it. Send build/7seg.s19 with a plain ASCII transfer (i.e., do not use any special file transfer protocol such as Xmodem, Kermit, etc.).

In Minicom, press Ctrl-A and then press S to bring up the upload window. Then highlight ascii with the arrow keys and press Enter. Now you need to navigate to the 7seg.s19 file using Minicom's file browser. It is not a lot of fun to use. If you want to change to a directory, you must press Space twice on it. Once you navigate to the 7seg.s19 file, move the cursor down to it and press Space to mark it. Then press Enter to initiate the transfer. After a second or two, the transfer should be complete and you can press any key to return to the terminal window.

You should be back at the > D-Bug12 prompt. This indicates that the file was successfully loaded into RAM. Now proceed to the next step.

Running your program

With the program loaded into RAM using the D-Bug12 load command, we can now tell D-Bug12 to run the program. The linker script for the examples, memory.x, locates the program at address 0x2000 in memory, so we tell D-Bug12 to begin running code at that address:

>g 2000

This begins executing the program. For the example_7segment2 program, the four LED digits should display "1234" and should be cycling in brightness.

To upload another program, reset the board by pressing SW6, the button marked RESET at the center of bottom edge of the Dragon12-Plus board. D-Bug12 will restart and you can repeat the load / g 2000 process to upload and run another program.