# Background Debugger

The Motorola Background Debugger is a tool for hardware debugging the 68332 from a PC. On the 68332 side, the software is on the chip, the software for the PC is available free from Motorola.

Install the background debugger on the PC (Windows) and connect the debugger cable on the EyeBot. Then start the debugger:

    bd32

- hardware requirements: background debugger cable to interface EyeBot to PC parallel port
- make sure the PC parallel port is set to "EPP" mode. You can change/verify the port setting by entering the system setup when booting the PC (usually by pressing the "Del" key during bootup)
- only needed for changing the "Robios" operating system, residing on the EyeBot's Flash-ROM
- for detailed information see Motorola db32 Debugger.
- for working with assembler files see debugger with assembly description.

The BDM is mainly used for two purposes:

- debugging an assembly program
- re-writing the Flash-ROM for a new ROM or if RoBIOS is corrupted (otherwise use download)

## Debugging an Assembly Program

Switch on EyeBot and load a user program, but do not press the "Run" button. On the PC start "bd32", then enter:

    stop

The user program is now located at $20000 (hex) and can be viewed with the dis-assemble debugger command:

    dasm $20000

Further helpful commands are:

    window on

to show all registers, memory contents and debugger commands.

    br $20a44

for settting breakpoints at a certain address

    s

for single-stepping through the program

For detailed information see debugger description.

## Re-Writing the Flash-ROM

Switch on EyeBot and start "bd32" on PC. Then enter debug command

    stop

[In case the EyeBot does not stop, you'll have to press the reset button on the board.]
The screen should now show that the board is halted (bottom line of the screen).
Then initialize the 68332 registers:

    do mapcs

Now you can use all debugger commands, e.g. breakpoints, single step, memory display and memory modify. The command "window on" allows to see registers, memory contents, and commands all at once.

## Flash-ROM (512K)

The system flash-ROM is divided into two partitions: a large partition for the RoBIOS operating system and all system routines, and a small partition for the hardware description table (HDT). This allows a separate flashing of the HDT in case new hardware componentes are added or deleted, so the RoBIOS does not need to be changed.

There is additional space to save up to 3 user programs in ROM. These can be saved and loaded from the "USR"/"ROM" menu.

To erase and rewrite the Flash-ROM for RoBIOS and HDT:
(xxxx stands for a specific name, e.g. vehi for vehicle)

    flash 11000000 robios.hex 0
    flash 00000000 hdtxxxx.hex $1c000

The file 'robios.hex' will be flashed with offset zero. Currently used is a 29F040 chip, which means 8 segments of 64 kB each. The first string of 8 "1"s or "0" determines how many segments are erased.

On the PC screen you will see one digit printed for every record being stored in the flash-ROM, e.g.:

    3333333333333333333333333333333333333333333333333333333333333333333
    3333333333333333333333333333333333333333333333333333333333333333333
    ...

Please note: DO NOT PRESS RESET during the flashing procedure, as this may damage the CPU!!

To update the HDT only, simply download the HDT or:
(xxxx stand for a specific name, e.g. vehi for vehicle)

    flash 00110000 hdtxxxx.hex $20000

The HDT will be copied into its original place upon restart of the system. This will erase any user program stored in the first ROM slot.

If everything worked properly, you should see the type of the flash-ROM on the screen and the programming should start (you will be able to see the progress). Depending on the system you are using, this takes a few seconds to a few minutes.

Thomas Bräunl, 2004