My application jumps to __unknown_exception_occurred. What causes this and how do I resolve it?
When an application jumps to '__unknown_exception_occurred', it is likely that an unhandled hardware event has occurred. When a hardware event occurs, the processor vectors (jumps) to the address that is stored in the Event Vector Table (EVT), saving the address it was at in a register.
On startup, all the entries in the Event Vector Table are set to point to __unknown_exception_occurred, which means that if any event occurs (except for an emulation event, a Reset event, or an IVG15 event), the processor will jump to __unknown_exception_occurred (or 'do_not_know_what_to_do') when the IDDE halts at the automatic breakpoint at this location.
When the processor jumps to an interrupt, it will store the current Program Counter address to a register so that processing can continue from that location in the code once the interrupt has been handled. Which register is used depends on the type of event that occurred:
RETI - RETurn from Interrupt address
RETX - RETurn from eXception address
RETN - RETurn from Non-maskable interrupt
You can see the contents of these registers in the IDDE by going to Register->Core->Sequencer. You'll also see the registers:
RETS - RETurn from Subroutine address (set by the CALL x instruction)
RETE - RETurn from Emulation Event (used by the emulator)
It is most likely that a hardware exception has occurred - unless you have a source of external interrupts or non-maskable interrupts (which you would likely be aware of if you did). The causes of Hardware Exceptions are described in the sequencer section of the ADSP-BF53x/56x Blackfin Processor Programming Reference Manual (PRM), and the likely causes include misaligned accesses to external memory, accessing an MMR while in user mode, accessing an MMR by the incorrect width, etc.
To find what line of assembly caused the hardware exception, you should examine the RETX register. This will give you the assembly line that the hardware exception occurred at. To view the assembly line, you can type the address (or '$RETX') into the address box in the disassembly window.
To find out what the hardware exception was, you should view the sequencer status register (Register->Core->Status->Sequencer Status). The EXCAUSE bits identify the cause of the exception. The easiest way to find the cause definition is to search for 'EXCAUSE' within the documentation. You can do this either from within the IDDE via Help->Search, or simply within Windows via Start->Programs->Analog Devices->VisualDSP++ 5.0->VisualDSP++ Documentation->Search
Additionally, you can reference Table 4.11 in the PRM.
For more information on handling events, see the Blackfin Compiler Manual (Interrupt Handler Support).
All Blackfin Manuals can be found on our website here.
This FAQ was generated from the following thread: How do I resolve __unknown_exception_occurred?