NetBurner 3.5.6
PDF Version

Vector offset definitions for predefined ColdFire exception and interrupt vectors. More...

Macros

#define CF_ACCESSERROR_VECTOR   2
 Access Error Exception Vector (Vector 2)
 
#define CF_ADDRESSERROR_VECTOR   3
 Address Error Exception Vector (Vector 3)
 
#define CF_ILLEGAL_INSTRUCTION_VECTOR   4
 Illegal Instruction Exception Vector (Vector 4)
 
#define CF_PRIVLEDGE_VIOLATION_VECTOR   8
 Privilege Violation Exception Vector (Vector 8)
 
#define CF_TRACE_VECTOR   9
 Trace Exception Vector (Vector 9)
 
#define CF_UNIMPLMENTED_A_VECTOR   10
 Unimplemented Line-A Opcode Exception Vector (Vector 10)
 
#define CF_UNIMPLMENTED_F_VECTOR   11
 Unimplemented Line-F Opcode Exception Vector (Vector 11)
 
#define CF_DEBUG_INTERRUPT   12
 Debug Interrupt Exception Vector (Vector 12)
 
#define CF_FORMAT_ERR_VECTOR   14
 Format Error Exception Vector (Vector 14)
 
#define CF_UNINITIALIZED_VECTOR   15
 Uninitialized Interrupt Exception Vector (Vector 15)
 
#define CF_SPURIOUS_INT_VECTOR   24
 Spurious Interrupt Exception Vector (Vector 24)
 
#define CF_AUTOVECTOR_IRQ1   25
 Autovector IRQ Level 1 (Vector 25)
 
#define CF_AUTOVECTOR_IRQ2   26
 Autovector IRQ Level 2 (Vector 26)
 
#define CF_AUTOVECTOR_IRQ3   27
 Autovector IRQ Level 3 (Vector 27)
 
#define CF_AUTOVECTOR_IRQ4   28
 Autovector IRQ Level 4 (Vector 28)
 
#define CF_AUTOVECTOR_IRQ5   29
 Autovector IRQ Level 5 (Vector 29)
 
#define CF_AUTOVECTOR_IRQ6   30
 Autovector IRQ Level 6 (Vector 30)
 
#define CF_AUTOVECTOR_IRQ7   31
 Autovector IRQ Level 7 (Vector 31)
 
#define CF_TRAP0_VECTOR   32
 TRAP #0 Instruction Vector (Vector 32)
 
#define CF_TRAP1_VECTOR   33
 TRAP #1 Instruction Vector (Vector 33)
 
#define CF_TRAP2_VECTOR   34
 TRAP #2 Instruction Vector (Vector 34)
 
#define CF_TRAP3_VECTOR   35
 TRAP #3 Instruction Vector (Vector 35)
 
#define CF_TRAP4_VECTOR   36
 TRAP #4 Instruction Vector (Vector 36)
 
#define CF_TRAP5_VECTOR   37
 TRAP #5 Instruction Vector (Vector 37)
 
#define CF_TRAP6_VECTOR   38
 TRAP #6 Instruction Vector (Vector 38)
 
#define CF_TRAP7_VECTOR   39
 TRAP #7 Instruction Vector (Vector 39)
 
#define CF_TRAP8_VECTOR   40
 TRAP #8 Instruction Vector (Vector 40)
 
#define CF_TRAP9_VECTOR   41
 TRAP #9 Instruction Vector (Vector 41)
 
#define CF_TRAP10_VECTOR   42
 TRAP #10 Instruction Vector (Vector 42)
 
#define CF_TRAP11_VECTOR   43
 TRAP #11 Instruction Vector (Vector 43)
 
#define CF_TRAP12_VECTOR   44
 TRAP #12 Instruction Vector (Vector 44)
 
#define CF_TRAP13_VECTOR   45
 TRAP #13 Instruction Vector (Vector 45)
 
#define CF_TRAP14_VECTOR   46
 TRAP #14 Instruction Vector (Vector 46)
 
#define CF_TRAP15_VECTOR   47
 TRAP #15 Instruction Vector (Vector 47)
 
#define CF_USER_BASE_VECTOR   64
 User-Defined Interrupt Vector Base (Vector 64)
 

Detailed Description

Vector offset definitions for predefined ColdFire exception and interrupt vectors.

These definitions specify the vector table offsets for various ColdFire processor exceptions, traps, and interrupt sources. The vector table is an array of function pointers where each entry corresponds to a specific exception or interrupt handler.

Vector Table Organization

The ColdFire vector table is organized into several regions:

Usage

Vector offsets are used to install interrupt handlers in the vector table:

extern void myHandler();
vectors[CF_AUTOVECTOR_IRQ5] = myHandler;
#define CF_AUTOVECTOR_IRQ5
Autovector IRQ Level 5 (Vector 29)
Definition cfinter.h:773
Note
The actual vector table base address is stored in the Vector Base Register (VBR).
Vectors 0-1 are reserved for the initial stack pointer and program counter.
See also
INTERRUPT

Macro Definition Documentation

◆ CF_ACCESSERROR_VECTOR

#define CF_ACCESSERROR_VECTOR   2

#include <cfinter.h>

Access Error Exception Vector (Vector 2)

Triggered when an illegal memory access occurs, such as:

  • Attempting to write to read-only memory
  • Accessing unmapped memory regions
  • Bus timeout or bus error
  • Memory protection violations
Note
This is a critical exception that typically indicates a hardware fault or programming error such as dereferencing a NULL or invalid pointer.
Warning
If this exception occurs, the system state may be unstable. The handler should log diagnostic information and consider system reset.

Expand for Example Usage

Examples

Example: Installing an access error handler
void AccessErrorHandler() {
// Log error information
printf("FATAL: Access Error Exception\r\n");
printf("PC: 0x%08lX\r\n", GetExceptionPC());
// Optionally reset the system
}
void UserMain(void *pd) {
init();
// Install access error handler
extern void AccessErrorHandler();
vectors[CF_ACCESSERROR_VECTOR] = AccessErrorHandler;
while(1) {
OSTimeDly(TICKS_PER_SECOND);
}
}
#define CF_ACCESSERROR_VECTOR
Access Error Exception Vector (Vector 2)
Definition cfinter.h:563
#define TICKS_PER_SECOND
System clock ticks per second.
Definition constants.h:49
void ForceReboot(bool fromIRQ=false)
Initiates an immediate hardware-level system reset of the NetBurner device.
void init()
System initialization. Ideally called at the beginning of all applications, since the easiest Recover...

◆ CF_ADDRESSERROR_VECTOR

#define CF_ADDRESSERROR_VECTOR   3

#include <cfinter.h>

Address Error Exception Vector (Vector 3)

Triggered when the processor attempts to access a misaligned address or perform an invalid address operation:

  • Word access (16-bit) on odd address
  • Long word access (32-bit) on non-aligned address
  • Invalid instruction fetch address
Note
ColdFire processors require proper data alignment. Word accesses must be word-aligned, and long word accesses must be long-word aligned.
Warning
Address errors often indicate pointer arithmetic errors or structure packing issues. Check your data structure alignment.

◆ CF_AUTOVECTOR_IRQ1

#define CF_AUTOVECTOR_IRQ1   25

#include <cfinter.h>

Autovector IRQ Level 1 (Vector 25)

Autovectored interrupt request level 1 (lowest priority maskable interrupt).

Note
Autovectored interrupts provide automatic vector generation without requiring the interrupting device to supply a vector number.
See also
CF_AUTOVECTOR_IRQ2 through CF_AUTOVECTOR_IRQ7 for higher priority levels

◆ CF_AUTOVECTOR_IRQ2

#define CF_AUTOVECTOR_IRQ2   26

#include <cfinter.h>

Autovector IRQ Level 2 (Vector 26)

Autovectored interrupt request level 2.

◆ CF_AUTOVECTOR_IRQ3

#define CF_AUTOVECTOR_IRQ3   27

#include <cfinter.h>

Autovector IRQ Level 3 (Vector 27)

Autovectored interrupt request level 3.

◆ CF_AUTOVECTOR_IRQ4

#define CF_AUTOVECTOR_IRQ4   28

#include <cfinter.h>

Autovector IRQ Level 4 (Vector 28)

Autovectored interrupt request level 4.

◆ CF_AUTOVECTOR_IRQ5

#define CF_AUTOVECTOR_IRQ5   29

#include <cfinter.h>

Autovector IRQ Level 5 (Vector 29)

Autovectored interrupt request level 5.

◆ CF_AUTOVECTOR_IRQ6

#define CF_AUTOVECTOR_IRQ6   30

#include <cfinter.h>

Autovector IRQ Level 6 (Vector 30)

Autovectored interrupt request level 6.

◆ CF_AUTOVECTOR_IRQ7

#define CF_AUTOVECTOR_IRQ7   31

#include <cfinter.h>

Autovector IRQ Level 7 (Vector 31)

Autovectored interrupt request level 7 (highest priority, non-maskable).

Note
Level 7 interrupts cannot be masked by the interrupt priority mask in the status register and will always be serviced.
Warning
Use level 7 only for critical, non-maskable events such as power failure or critical hardware faults.

◆ CF_DEBUG_INTERRUPT

#define CF_DEBUG_INTERRUPT   12

#include <cfinter.h>

Debug Interrupt Exception Vector (Vector 12)

Triggered by the on-chip debug module for hardware breakpoints and debugging. Used by BDM (Background Debug Mode) and JTAG debuggers.

Note
This vector is typically managed by the debugging tools and should not be modified by application code.

◆ CF_FORMAT_ERR_VECTOR

#define CF_FORMAT_ERR_VECTOR   14

#include <cfinter.h>

Format Error Exception Vector (Vector 14)

Triggered when the processor encounters an invalid stack frame format during an exception return (RTE instruction).

Note
This typically indicates stack corruption or an attempt to return from an exception with an improperly formatted exception frame.
Warning
Often indicates serious stack corruption issues.

◆ CF_ILLEGAL_INSTRUCTION_VECTOR

#define CF_ILLEGAL_INSTRUCTION_VECTOR   4

#include <cfinter.h>

Illegal Instruction Exception Vector (Vector 4)

Triggered when the processor attempts to execute:

  • An undefined or invalid opcode
  • A corrupted instruction
  • Code from a data region
Note
This can occur due to:
  • Executing data as code (bad function pointer)
  • Stack corruption causing return to invalid address
  • Flash memory corruption
Warning
Often indicates serious firmware corruption or programming errors.

◆ CF_PRIVLEDGE_VIOLATION_VECTOR

#define CF_PRIVLEDGE_VIOLATION_VECTOR   8

#include <cfinter.h>

Privilege Violation Exception Vector (Vector 8)

Triggered when user mode code attempts to execute a privileged instruction or access a privileged resource that requires supervisor mode.

Privileged operations include:

  • Modifying the status register (SR)
  • Accessing certain control registers
  • Executing STOP, RESET, or RTE instructions
Note
Most NetBurner applications run in supervisor mode, so this exception is uncommon unless explicitly using user/supervisor mode separation.

◆ CF_SPURIOUS_INT_VECTOR

#define CF_SPURIOUS_INT_VECTOR   24

#include <cfinter.h>

Spurious Interrupt Exception Vector (Vector 24)

Triggered when an interrupt is acknowledged but no interrupt source is found. This can occur due to:

  • Interrupt line noise or glitches
  • Interrupt cleared between assertion and acknowledgment
  • Hardware malfunction
Note
A spurious interrupt handler should simply return without taking action.
Frequent spurious interrupts may indicate hardware problems.

Expand for Example Usage

Examples

Example: Spurious interrupt handler with counter
volatile uint32_t spuriousIntCount = 0;
INTERRUPT(spuriousIntHandler, 0x2000)
{
spuriousIntCount++;
// Just return - no action needed
}
void UserMain(void *pd) {
init();
extern void spuriousIntHandler();
vectors[CF_SPURIOUS_INT_VECTOR] = spuriousIntHandler;
while(1) {
if (spuriousIntCount > 100) {
printf("WARNING: Excessive spurious interrupts: %lu\r\n",
spuriousIntCount);
}
OSTimeDly(TICKS_PER_SECOND);
}
}
#define CF_SPURIOUS_INT_VECTOR
Spurious Interrupt Exception Vector (Vector 24)
Definition cfinter.h:733

◆ CF_TRACE_VECTOR

#define CF_TRACE_VECTOR   9

#include <cfinter.h>

Trace Exception Vector (Vector 9)

Triggered after each instruction when trace mode is enabled in the status register. Used for single-stepping through code during debugging.

Note
This is primarily used by debuggers and development tools.
The T0 and T1 bits in the SR control trace mode operation.

◆ CF_TRAP0_VECTOR

#define CF_TRAP0_VECTOR   32

#include <cfinter.h>

TRAP #0 Instruction Vector (Vector 32)

Software interrupt triggered by the TRAP #0 instruction. TRAP instructions provide a mechanism for software-generated exceptions and system calls.

Note
TRAP instructions are often used to implement system call interfaces or breakpoints in debugging.

Expand for Example Usage

Examples

Example: Using TRAP for system calls
// System call handler
INTERRUPT(trap0Handler, 0x2700)
{
// Read D0 register to determine system call number
// Implement system call dispatch logic
HandleSystemCall();
}
void UserMain(void *pd) {
init();
extern void trap0Handler();
vectors[CF_TRAP0_VECTOR] = trap0Handler;
// Application can now use: asm("trap #0");
while(1) {
OSTimeDly(TICKS_PER_SECOND);
}
}
#define CF_TRAP0_VECTOR
TRAP #0 Instruction Vector (Vector 32)
Definition cfinter.h:838

◆ CF_TRAP10_VECTOR

#define CF_TRAP10_VECTOR   42

#include <cfinter.h>

TRAP #10 Instruction Vector (Vector 42)

Software interrupt triggered by the TRAP #10 instruction.

◆ CF_TRAP11_VECTOR

#define CF_TRAP11_VECTOR   43

#include <cfinter.h>

TRAP #11 Instruction Vector (Vector 43)

Software interrupt triggered by the TRAP #11 instruction.

◆ CF_TRAP12_VECTOR

#define CF_TRAP12_VECTOR   44

#include <cfinter.h>

TRAP #12 Instruction Vector (Vector 44)

Software interrupt triggered by the TRAP #12 instruction.

◆ CF_TRAP13_VECTOR

#define CF_TRAP13_VECTOR   45

#include <cfinter.h>

TRAP #13 Instruction Vector (Vector 45)

Software interrupt triggered by the TRAP #13 instruction.

◆ CF_TRAP14_VECTOR

#define CF_TRAP14_VECTOR   46

#include <cfinter.h>

TRAP #14 Instruction Vector (Vector 46)

Software interrupt triggered by the TRAP #14 instruction.

◆ CF_TRAP15_VECTOR

#define CF_TRAP15_VECTOR   47

#include <cfinter.h>

TRAP #15 Instruction Vector (Vector 47)

Software interrupt triggered by the TRAP #15 instruction.

◆ CF_TRAP1_VECTOR

#define CF_TRAP1_VECTOR   33

#include <cfinter.h>

TRAP #1 Instruction Vector (Vector 33)

Software interrupt triggered by the TRAP #1 instruction.

◆ CF_TRAP2_VECTOR

#define CF_TRAP2_VECTOR   34

#include <cfinter.h>

TRAP #2 Instruction Vector (Vector 34)

Software interrupt triggered by the TRAP #2 instruction.

◆ CF_TRAP3_VECTOR

#define CF_TRAP3_VECTOR   35

#include <cfinter.h>

TRAP #3 Instruction Vector (Vector 35)

Software interrupt triggered by the TRAP #3 instruction.

◆ CF_TRAP4_VECTOR

#define CF_TRAP4_VECTOR   36

#include <cfinter.h>

TRAP #4 Instruction Vector (Vector 36)

Software interrupt triggered by the TRAP #4 instruction.

◆ CF_TRAP5_VECTOR

#define CF_TRAP5_VECTOR   37

#include <cfinter.h>

TRAP #5 Instruction Vector (Vector 37)

Software interrupt triggered by the TRAP #5 instruction.

◆ CF_TRAP6_VECTOR

#define CF_TRAP6_VECTOR   38

#include <cfinter.h>

TRAP #6 Instruction Vector (Vector 38)

Software interrupt triggered by the TRAP #6 instruction.

◆ CF_TRAP7_VECTOR

#define CF_TRAP7_VECTOR   39

#include <cfinter.h>

TRAP #7 Instruction Vector (Vector 39)

Software interrupt triggered by the TRAP #7 instruction.

◆ CF_TRAP8_VECTOR

#define CF_TRAP8_VECTOR   40

#include <cfinter.h>

TRAP #8 Instruction Vector (Vector 40)

Software interrupt triggered by the TRAP #8 instruction.

◆ CF_TRAP9_VECTOR

#define CF_TRAP9_VECTOR   41

#include <cfinter.h>

TRAP #9 Instruction Vector (Vector 41)

Software interrupt triggered by the TRAP #9 instruction.

◆ CF_UNIMPLMENTED_A_VECTOR

#define CF_UNIMPLMENTED_A_VECTOR   10

#include <cfinter.h>

Unimplemented Line-A Opcode Exception Vector (Vector 10)

Triggered when the processor encounters an instruction with bits 15-12 = 1010 (0xA). These opcodes are reserved and unimplemented on ColdFire processors.

Note
Can be used to implement software emulation of missing instructions or for custom instruction extensions.

◆ CF_UNIMPLMENTED_F_VECTOR

#define CF_UNIMPLMENTED_F_VECTOR   11

#include <cfinter.h>

Unimplemented Line-F Opcode Exception Vector (Vector 11)

Triggered when the processor encounters an instruction with bits 15-12 = 1111 (0xF). These opcodes are reserved and unimplemented on ColdFire processors.

Note
Can be used to implement co-processor emulation or custom extensions.

◆ CF_UNINITIALIZED_VECTOR

#define CF_UNINITIALIZED_VECTOR   15

#include <cfinter.h>

Uninitialized Interrupt Exception Vector (Vector 15)

Triggered when an interrupt occurs but the interrupt controller has not been properly initialized or the interrupt vector has not been programmed.

Note
This can occur during system startup if interrupts are enabled before the vector table is fully initialized.
Warning
All interrupt vectors should be initialized before enabling interrupts to avoid this exception.

◆ CF_USER_BASE_VECTOR

#define CF_USER_BASE_VECTOR   64

#include <cfinter.h>

User-Defined Interrupt Vector Base (Vector 64)

Starting vector number for user-defined peripheral interrupts. Vectors 64 and above are available for assignment to custom interrupt sources such as:

  • Timers
  • UART/Serial ports
  • GPIO interrupts
  • DMA controllers
  • ADC converters
  • Custom peripherals

The actual vector number for a peripheral interrupt is typically: CF_USER_BASE_VECTOR + peripheral_irq_number

Note
The specific IRQ numbers and mappings are platform-dependent. Consult your NetBurner platform documentation for peripheral interrupt assignments.
Vectors 48-63 are reserved by Freescale/NXP and should not be used.

Expand for Example Usage

Examples

Example 1: Installing a timer interrupt handler
#define TIMER0_IRQ 0 // Platform-specific IRQ number
INTERRUPT(timer0Handler, 0x2300)
{
// Timer interrupt service routine
static uint32_t timerTicks = 0;
timerTicks++;
// Clear timer interrupt flag
TIMER0_STATUS_REG |= TIMER_INT_FLAG;
}
void UserMain(void *pd) {
init();
// Install handler at user vector base + IRQ number
extern void timer0Handler();
vectors[CF_USER_BASE_VECTOR + TIMER0_IRQ] = timer0Handler;
// Enable timer interrupt
TIMER0_CONTROL_REG |= TIMER_ENABLE | TIMER_INT_ENABLE;
while(1) {
OSTimeDly(TICKS_PER_SECOND);
}
}
#define CF_USER_BASE_VECTOR
User-Defined Interrupt Vector Base (Vector 64)
Definition cfinter.h:1130
Example 2: Multiple peripheral interrupts
// Platform-specific IRQ assignments
#define UART0_IRQ 0
#define UART1_IRQ 1
#define TIMER0_IRQ 2
#define GPIO_IRQ 3
INTERRUPT(uart0Handler, 0x2300)
{
HandleUART0Interrupt();
}
INTERRUPT(uart1Handler, 0x2300)
{
HandleUART1Interrupt();
}
INTERRUPT(timer0Handler, 0x2400)
{
HandleTimer0Interrupt();
}
INTERRUPT(gpioHandler, 0x2200)
{
HandleGPIOInterrupt();
}
void InitializeInterrupts() {
extern void uart0Handler();
extern void uart1Handler();
extern void timer0Handler();
extern void gpioHandler();
// Install all handlers
vectors[CF_USER_BASE_VECTOR + UART0_IRQ] = uart0Handler;
vectors[CF_USER_BASE_VECTOR + UART1_IRQ] = uart1Handler;
vectors[CF_USER_BASE_VECTOR + TIMER0_IRQ] = timer0Handler;
vectors[CF_USER_BASE_VECTOR + GPIO_IRQ] = gpioHandler;
printf("All interrupt handlers installed\r\n");
}
Example 3: Vector table dump utility
void DumpVectorTable() {
printf("\r\n=== ColdFire Vector Table ===\r\n");
printf("\r\nException Vectors:\r\n");
printf(" Access Error: %d (0x%08lX)\r\n",
printf(" Address Error: %d (0x%08lX)\r\n",
printf(" Illegal Instruction: %d (0x%08lX)\r\n",
printf("\r\nAutovector IRQs:\r\n");
for (int i = 1; i <= 7; i++) {
printf(" IRQ%d: Vector %d (0x%08lX)\r\n",
i, CF_AUTOVECTOR_IRQ1 + (i-1),
(uint32_t)vectors[CF_AUTOVECTOR_IRQ1 + (i-1)]);
}
printf("\r\nTRAP Vectors:\r\n");
for (int i = 0; i <= 15; i++) {
printf(" TRAP #%d: Vector %d (0x%08lX)\r\n",
i, CF_TRAP0_VECTOR + i,
(uint32_t)vectors[CF_TRAP0_VECTOR + i]);
}
printf("\r\nUser Vectors (first 10):\r\n");
for (int i = 0; i < 10; i++) {
printf(" Vector %d: 0x%08lX\r\n",
(uint32_t)vectors[CF_USER_BASE_VECTOR + i]);
}
}
#define CF_AUTOVECTOR_IRQ1
Autovector IRQ Level 1 (Vector 25)
Definition cfinter.h:745
#define CF_ADDRESSERROR_VECTOR
Address Error Exception Vector (Vector 3)
Definition cfinter.h:580
#define CF_ILLEGAL_INSTRUCTION_VECTOR
Illegal Instruction Exception Vector (Vector 4)
Definition cfinter.h:597
Example 4: Safe vector installation with validation
bool InstallUserInterruptHandler(uint8_t irqNum, void (*handler)(),
const char *name)
{
if (handler == NULL) {
printf("Error: NULL handler for %s\r\n", name);
return false;
}
uint32_t vectorNum = CF_USER_BASE_VECTOR + irqNum;
if (vectorNum >= 256) {
printf("Error: Vector %lu out of range for %s\r\n", vectorNum, name);
return false;
}
// Check if vector already assigned
if (vectors[vectorNum] != NULL && vectors[vectorNum] != handler) {
printf("Warning: Vector %lu already assigned for %s\r\n",
vectorNum, name);
}
vectors[vectorNum] = handler;
printf("Installed %s at vector %lu (IRQ %u)\r\n",
name, vectorNum, irqNum);
return true;
}
void UserMain(void *pd) {
init();
extern void timer0Handler();
extern void uart0Handler();
InstallUserInterruptHandler(0, timer0Handler, "Timer0");
InstallUserInterruptHandler(1, uart0Handler, "UART0");
while(1) {
OSTimeDly(TICKS_PER_SECOND);
}
}