Java offers exception and errors. Errors are thrown by the virtual machine and we do not currently use them as we have no virtual machine at all.
Exceptions can be devided into checked and unchecked exceptions. Checked exceptions must be caught by a calling method, which is ensured by the Java compiler. Unchecked exceptions, such as ArrayIndexOutOfBoundsException
or NullPointerException
, must be caught when initializing classes or when calling thread or task methods. Of course, you are free to catch such unchecked methods in your code by yourself.
All unchecked Java exceptions must be caught by the system. In such a case, the type of the exception is written to the System.err stream. Make sure, that you have directed this stream to your System.out
.
System.err = System.out
Obviously you have to put the System.out
onto an existing output stream, e.g. your standard output, see Hello World with System.out.
On the Avnet MicroZed board there is a single user LED on MIO47. On the Digilent Zybo board we use the LED on MIO7.
blinking pattern | state | comment |
---|---|---|
1x every second | code was loaded with error | FCS error in kernel |
1x once | exception thrown in command | unchecked exception caught in Task.loop |
2x once | exception thrown in command | unchecked exception caught in Kernel.loop |
3x once | exception thrown in action method of task | unchecked exception caught in Task.loop or check stack failed in kernel |
5x every second | exception thrown in boot method | unchecked exception caught in kernel |
1x followed by 2x | data abort exception | memory access threw data abort exception |
On the NTB MPC555 Headerboard there is a single LED. On the Freescale MPC5200 module there is no LED, but we use the one on the carrier board (at pin Gpio_Wkup_7).
blinking pattern | state | comment |
---|---|---|
1x every second | code was loaded with error | FCS error in kernel |
1x once | exception thrown in command | unchecked exception caught in Task.loop |
2x once | exception thrown in command | unchecked exception caught in Kernel.loop |
3x once | exception thrown in action method of task command | unchecked exception caught in Task.loop or check stack failed in kernel |
5x every second | exception thrown | unchecked exception caught in kernel |
1x followed by 2x every second | machine check exception | bus error, PPC exception |
1x followed by 3x every second | system call | sc-instruction, PPC exception |
1x followed by 4x every second | floating point unavailable exception | FPU switched off, PPC exception |
The RCPU of the mpc555 has a built-in debug feature. Some of the PPC exceptions can cause the processor to enter debug mode, instead of running the appropriate exception handler. However, this can happen only in case of the processor running out of RAM. If you run the program out of flash, you can never enter debug mode (which wouldn't make sense).
Debug mode is indicated on the MPC555 USB Background Debugging Interface (USB-BDI) with the blue LED.