User`s manual
3.3.3 Use on-chip flash for testing your code in BOOTLOADER mode.
In this mode, you download your program directly into on-chip flash memory. You first
erase the D-Bug12 monitor portion of flash memory, and then program that portion of the
flash memory by downloading your application program code in an s29 file. Your program
will replace the D-Bug12 monitor in the flash memory. The bootloader portion of the flash
memory remains intact. To run your code, set the mode switch S7 to EVB mode, then
press the reset button. It usually runs the D-Bug12 monitor, but now it runs your program.
The flash memory is non-volatile like the EEPROM. Your code will run every time the
board is turned on or reset.
The bootloader redirects interrupts to $EF80-$EFFF. The D-BUG12 is not present and
the interrupt vectors of your program are at $EF80-$EFFF. The addresses $EFFE and
$EFFF contains the starting address of your program.
In order to program the MC9S12DG256 flash memory, you must program an even
number of bytes and begin on an even address boundary for each s-record. If any one s-
record in the file contains an odd number of bytes or begins with an odd address, the flash
memory cannot be programmed. If your assembler or compiler cannot generate the even
format, you must use the Freescale s-record conversion utility sreccvt.exe to convert
your odd format to the even format by using the following command line:
Sreccvt –m c0000 fffff 32 –of f0000 –o test.s29 test.s19
It will create a new file named test.s29 that has the even format and can be programmed
into flash memory. For your convenience, the sreccvt.exe is included in the folder named
CDROM\document\Sreccvt-GUI.
25