First, configure the terminal program, in our case minicom,
the following way: 9600 bps, 8 bits, no parity, 1 stop bit and no flow control of any kind.
The serial port in Linux should be /dev/ttyS0
for COM1
,
/dev/ttyS1
for COM2
etc.
Start the target. You should see the vxWorks bootloader on your terminal screen, and should be able to stop the boot sequence by pressing the space bar.
We cannot use the vxWorks bootloader to load a Linux kernel since it looks in the ELF header and loads the image to the address written there. However, the Linux kernel, which uses virtual memory, is linked to a high-memory address, and vxWorks can't handle that.
Once the target is stopped, run the VisionICE software and perform the following steps:
Initialize the target by pressing Target|Initialize
Press File|Load Executable. A dialog box will open,
asking you to choose a file. Please choose your kernel image (vmlinux). Before pressing
Load, don't forget to enter a value in the +/- Bias
field.
The bias field makes it possible to tell ICE to load a certain image in a different
address than what's stated in the ELF binary. We wanted to load the kernel into address
0x300000
, and since the binary was linked to 0xC0000000
, we entered
-0xBFD00000
.
Once the image is loaded succesfully, you can press Run or Step to start executing your kernel.
After pressing the Run button, nothing happened. At that moment, and for some time after, it seemed that nothing was happening and the kernel was stuck. We used ICE to step through the initialization code of the kernel and rule out some potential problems, like virtual memory errors, only to finally discover that the problem was simple: the kernel was indeed booting but since the console (tty) driver had problems, we couldn't see anything!
VisionICE is not the correct tool to use when debugging Linux. ICE doesn't know about virtual memory and protected mode (at least the version we had), and since the Linux kernel turns on virtual memory very early, ICE is only useful for debugging the first assembler statements. After VM is turned on, ICE starts crashing and giving wierd results.