Use the following techniques to debug your minidriver:
- If your startup code is able to print data to a serial port or other debug device, then you can use
kprintf()
to print any variable you wish to see.
For example, in your minidriver code:
kprintf("I am the minidriver!\n");
kprintf("Global variable mcounts=%d\n", mcounts);
For more information, see the Customizing Image Startup Programs chapter of
Building Embedded Systems.
- Include any information that you wish to collect in the data area you allocated for your minidriver.
After the kernel has booted, you can examine the data inside this area.
See the
mini-peeker.c
program for an example of doing this.
- Depending on your hardware, you could use JTAG.
If LEDs or other diagnostics are available, your minidriver
could output values to hardware registers or ports to indicate certain conditions.