module ti.sysbios.family.arm.exc.Exception

Exception Module

The Exception module is a basic ARM exception handler. When an exception occurs, the execution state is saved into a buffer with a structure of type ExcContext. [ more ... ]
C synopsis target-domain sourced in ti/sysbios/family/arm/exc/Exception.xdc
DETAILS
The Exception module is a basic ARM exception handler. When an exception occurs, the execution state is saved into a buffer with a structure of type ExcContext.
By default, a formatted dump of this structure is also sent to the console using System_printf(). This behavior can be suppressed by setting the enableDecode config parameter to 'false'.
An ROV view of the exception context is provided when attached to the target board with CCS.
NOTES
No attempt is made to return from an exception as these are generally fatal in nature.
When used, the Exception module will override the default exception handlers provided by the current Hwi module.
 
enum Exception_Type
C synopsis target-domain
typedef enum Exception_Type {
    Exception_Type_Supervisor,
    // Supervisor (SWI)
    Exception_Type_PreAbort,
    // Abort exception
    Exception_Type_DataAbort,
    // Abort exception
    Exception_Type_UndefInst
    // Undefined instruction exception
} Exception_Type;
 
 
typedef Exception_ExceptionHookFuncPtr

Exception hook function type definition

C synopsis target-domain
typedef Void (*Exception_ExceptionHookFuncPtr)(Exception_ExcContext*);
 
 
struct Exception_ExcContext

Exception Context - Register contents at the time of an exception

C synopsis target-domain
typedef struct Exception_ExcContext {
    BIOS_ThreadType threadType;
    Ptr threadHandle;
    Ptr threadStack;
    SizeT threadStackSize;
    Exception_Type type;
    Ptr r0;
    Ptr r1;
    Ptr r2;
    Ptr r3;
    Ptr r4;
    Ptr r5;
    Ptr r6;
    Ptr r7;
    Ptr r8;
    Ptr r9;
    Ptr r10;
    Ptr r11;
    Ptr r12;
    Ptr sp;
    Ptr lr;
    Ptr pc;
    Ptr psr;
    Ptr dfsr;
    Ptr ifsr;
    Ptr dfar;
    Ptr ifar;
} Exception_ExcContext;
 
 
config Exception_E_dataAbort  // module-wide

Error raised when an data abort exception occurs

C synopsis target-domain
extern const Error_Id Exception_E_dataAbort;
 
 
config Exception_E_prefetchAbort  // module-wide

Error raised when an prefetch abort exception occurs

C synopsis target-domain
extern const Error_Id Exception_E_prefetchAbort;
 
 
config Exception_E_swi  // module-wide

Error raised when a SWI exception occurs

C synopsis target-domain
extern const Error_Id Exception_E_swi;
 
 
config Exception_E_undefinedInstruction  // module-wide

Error raised when an undefined instruction exception occurs

C synopsis target-domain
extern const Error_Id Exception_E_undefinedInstruction;
 
 
config Exception_enableDecode  // module-wide

Enable full exception decoding, default is true

C synopsis target-domain
extern const Bool Exception_enableDecode;
 
DETAILS
When enabled, the exception handler will fully decode an exception and dump the registers to the system console.
When set to false, only an Error is printed on the console.
In either case, the full exception context is always saved and visible with ROV.
 
config Exception_excHookFunc  // module-wide

User Exception hook function

C synopsis target-domain
extern const Exception_ExceptionHookFuncPtr Exception_excHookFunc;
 
DETAILS
Called just after exception context has been initialized.
NOTE
If running in SMP mode and both excHookFunc and excHookFuncs[0] are set, then excHookFunc is used on Core0.
 
config Exception_excHookFuncs  // module-wide
C synopsis target-domain
extern const Exception_ExceptionHookFuncPtr Exception_excHookFuncs[];
 
Module-Wide Built-Ins

C synopsis target-domain
Types_ModuleId Exception_Module_id();
// Get this module's unique id
 
Bool Exception_Module_startupDone();
// Test if this module has completed startup
 
IHeap_Handle Exception_Module_heap();
// The heap from which this module allocates memory
 
Bool Exception_Module_hasMask();
// Test whether this module has a diagnostics mask
 
Bits16 Exception_Module_getMask();
// Returns the diagnostics mask for this module
 
Void Exception_Module_setMask(Bits16 mask);
// Set the diagnostics mask for this module
 
Configuration settings sourced in ti/sysbios/family/arm/exc/Exception.xdc
var Exception = xdc.useModule('ti.sysbios.family.arm.exc.Exception');
module-wide constants & types
    values of type Exception.Type// 
 
        obj.threadType = BIOS.ThreadType  ...
        obj.threadHandle = Ptr  ...
        obj.threadStack = Ptr  ...
        obj.threadStackSize = SizeT  ...
        obj.type = Exception.Type  ...
        obj.r0 = Ptr  ...
        obj.r1 = Ptr  ...
        obj.r2 = Ptr  ...
        obj.r3 = Ptr  ...
        obj.r4 = Ptr  ...
        obj.r5 = Ptr  ...
        obj.r6 = Ptr  ...
        obj.r7 = Ptr  ...
        obj.r8 = Ptr  ...
        obj.r9 = Ptr  ...
        obj.r10 = Ptr  ...
        obj.r11 = Ptr  ...
        obj.r12 = Ptr  ...
        obj.sp = Ptr  ...
        obj.lr = Ptr  ...
        obj.pc = Ptr  ...
        obj.psr = Ptr  ...
        obj.dfsr = Ptr  ...
        obj.ifsr = Ptr  ...
        obj.dfar = Ptr  ...
        obj.ifar = Ptr  ...
module-wide config parameters
        msg: "E_dataAbort: pc = 0x%08x, lr = 0x%08x."
    };
        msg: "E_prefetchAbort: pc = 0x%08x, lr = 0x%08x."
    };
        msg: "E_swi: pc = 0x%08x, lr = 0x%08x."
    };
        msg: "E_undefinedInstruction: pc = 0x%08x, lr = 0x%08x."
    };
 
    Exception.excContextBuffers//  = Ptr[] undefined;
    Exception.excStackBuffers//  = Ptr[] undefined;
 
 
enum Exception.Type
Configuration settings
values of type Exception.Type
    const Exception.Type_Supervisor;
    // Supervisor (SWI)
    const Exception.Type_PreAbort;
    // Abort exception
    const Exception.Type_DataAbort;
    // Abort exception
    const Exception.Type_UndefInst;
    // Undefined instruction exception
 
C SYNOPSIS
 
struct Exception.ExcContext

Exception Context - Register contents at the time of an exception

Configuration settings
var obj = new Exception.ExcContext;
 
    obj.threadType = BIOS.ThreadType  ...
    obj.threadHandle = Ptr  ...
    obj.threadStack = Ptr  ...
    obj.threadStackSize = SizeT  ...
    obj.type = Exception.Type  ...
    obj.r0 = Ptr  ...
    obj.r1 = Ptr  ...
    obj.r2 = Ptr  ...
    obj.r3 = Ptr  ...
    obj.r4 = Ptr  ...
    obj.r5 = Ptr  ...
    obj.r6 = Ptr  ...
    obj.r7 = Ptr  ...
    obj.r8 = Ptr  ...
    obj.r9 = Ptr  ...
    obj.r10 = Ptr  ...
    obj.r11 = Ptr  ...
    obj.r12 = Ptr  ...
    obj.sp = Ptr  ...
    obj.lr = Ptr  ...
    obj.pc = Ptr  ...
    obj.psr = Ptr  ...
    obj.dfsr = Ptr  ...
    obj.ifsr = Ptr  ...
    obj.dfar = Ptr  ...
    obj.ifar = Ptr  ...
 
C SYNOPSIS
 
config Exception.E_dataAbort  // module-wide

Error raised when an data abort exception occurs

Configuration settings
Exception.E_dataAbort = Error.Desc {
    msg: "E_dataAbort: pc = 0x%08x, lr = 0x%08x."
};
 
C SYNOPSIS
 
config Exception.E_prefetchAbort  // module-wide

Error raised when an prefetch abort exception occurs

Configuration settings
Exception.E_prefetchAbort = Error.Desc {
    msg: "E_prefetchAbort: pc = 0x%08x, lr = 0x%08x."
};
 
C SYNOPSIS
 
config Exception.E_swi  // module-wide

Error raised when a SWI exception occurs

Configuration settings
Exception.E_swi = Error.Desc {
    msg: "E_swi: pc = 0x%08x, lr = 0x%08x."
};
 
C SYNOPSIS
 
config Exception.E_undefinedInstruction  // module-wide

Error raised when an undefined instruction exception occurs

Configuration settings
Exception.E_undefinedInstruction = Error.Desc {
    msg: "E_undefinedInstruction: pc = 0x%08x, lr = 0x%08x."
};
 
C SYNOPSIS
 
config Exception.enableDecode  // module-wide

Enable full exception decoding, default is true

Configuration settings
Exception.enableDecode = Bool true;
 
DETAILS
When enabled, the exception handler will fully decode an exception and dump the registers to the system console.
When set to false, only an Error is printed on the console.
In either case, the full exception context is always saved and visible with ROV.
C SYNOPSIS
 
config Exception.excHookFunc  // module-wide

User Exception hook function

Configuration settings
Exception.excHookFunc = Void(*)(Exception.ExcContext*) null;
 
DETAILS
Called just after exception context has been initialized.
NOTE
If running in SMP mode and both excHookFunc and excHookFuncs[0] are set, then excHookFunc is used on Core0.
C SYNOPSIS
 
config Exception.excHookFuncs  // module-wide
Configuration settings
Exception.excHookFuncs = Exception.ExceptionHookFuncPtr[] undefined;
 
C SYNOPSIS
 
metaonly config Exception.common$  // module-wide

Common module configuration parameters

Configuration settings
Exception.common$ = Types.Common$ undefined;
 
DETAILS
All modules have this configuration parameter. Its name contains the '$' character to ensure it does not conflict with configuration parameters declared by the module. This allows new configuration parameters to be added in the future without any chance of breaking existing modules.
 
metaonly config Exception.excContextBuffer  // module-wide

User Exception Context Buffer Address

Configuration settings
Exception.excContextBuffer = Ptr undefined;
 
DETAILS
By default, when an exception occurs, an ExcContext structure is allocated on the exception stack and filled in by the exception handler.
If excContextBuffer is initialized by the user, the ExcContext structure will be placed at that address instead.
The buffer must be large enough to contain an ExcContext structure.
NOTE
If running in SMP mode and both excContextBuffer and excContextBuffers[0] are set, then excContextBuffer is used on Core0.
 
metaonly config Exception.excContextBuffers  // module-wide
Configuration settings
Exception.excContextBuffers = Ptr[] undefined;
 
 
metaonly config Exception.excStackBuffer  // module-wide

User Exception Stack Buffer Address

Configuration settings
Exception.excStackBuffer = Ptr undefined;
 
DETAILS
When an exception occurs, a pointer to the base address of the stack being used by the thread causing the exception is stored in the ExcContext buffer.
If excStackBuffer is initialized by the user, the entire contents of that stack will also be copied to the address specified.
The buffer must be large enough to contain the largest task stack or ISR stack defined in the application.
NOTE
If running in SMP mode and both excStackBuffer and excStackBuffers[0] are set, then excStackBuffer is used on Core0.
 
metaonly config Exception.excStackBuffers  // module-wide
Configuration settings
Exception.excStackBuffers = Ptr[] undefined;
 
 
metaonly config Exception.excStackSection  // module-wide

Memory section used for Exception stack. Default is null, which results in the stack being placed in .bss

Configuration settings
Exception.excStackSection = String null;
 
DETAILS
The exception stacks on all cores are placed in this section.
 
metaonly config Exception.excStackSize  // module-wide

Exception stack size in MAUs. Default size is same as Hwi stack size

Configuration settings
Exception.excStackSize = SizeT undefined;
 
DETAILS
If running in SMP mode, the exception stacks on all cores are set to this size.
generated on Tue, 14 Feb 2017 19:59:29 GMT