Software Debugging
Writing software is only the first part of the development process. Next comes testing to verify the program functionality. This requires not just running the application on the target system, but having a means of tracing what is happening should something not function as expected. There are two methods of accessing the S12X/XGATE processors to do debugging. The first is by using the built-in serial monitor programmed into the top 2K of Flash on the Adapt9S12XDP. The second is the use of an external BDM pod. Each method has value and which method is used will depend on the needs of the development process.
Serial Monitor
The serial monitor pre-programmed into the Adapt9S12XDP module is an adaptaption of Freescale's AN2548, originally written for the HCS12 processors. It has been updated to work with the S12X processor operating at 40 MHz, and provides a means to assist in debugging S12X code, among other capabilities. However the serial monitor by itself cannot do anything. It is designed to work with an external program that communicates with it. (See uBug12 below.)
Because of this, the serial monitor has a requirement that an SCI port must be dedicated to its use. Therefore if you use the serial monitor as part of your troubleshooting process, the SCI port can not be used by your application program. The default serial monitor version in the Adapt9S12XDP module Flash is programmed to use the SCI0 port on the board. However, this can be changed by programming a variation into Flash that uses SCI1. If you need to do this, the uBug12 manual has an Appendix that outlines the process to reprogram the serial monitor. It will require the use of a BDM pod.
The best resource to read on the capabilities of the serial monitor is the original AN1248 document from Freescale. This is available at: http://www.freescale.com/files/microcontrollers/doc/app_note/AN2548.pdf?fsrch=1
uBug12 Java Edition
Technological Arts provides a Java based program called uBug12JE, or just uBug12, as a means of interfacing with the serial monitor in Flash. The program allows the user to manage the use of Flash and EEPROM memories, as well as provide standard troubleshooting capabilities such as breakpoints, single step of code, and examination and modification of both CPU registers and memory locations. A separate document on the Technological Arts website describes the installation, functionality, and operation of uBug12. You can read the manual at:
http://www.technologicalarts.ca/shop/documentation/63-debugging-tools/171-ubug12je-user-manual.html
The following topics will be covered in detail in a future revision of this manual:
- using HCS12mem
Located at:
http://sourceforge.net/projects/hcs12mem/
BDM pods:
- using MicroBDM12XG
- using USBDMLT
- third-party BDM pods: P&E Micro's Multilink, TBDML, etc.
noICE12:
URL: http://www.noicedebugger.com/