TI DSPs: bootload and interrupt vector table

From DSignT Support Database
Jump to: navigation, search

1 Problem

TI processors: bootload sometimes fails, program does not start. A reset does not help, but board starts after power-cycling.

This issue might be related to the default interrupt vector table which is supplied by TI. If the (custom) bootloader code branches to the reset vector after loading code and data sections is done, a random memory location will be overwritten.

The default interrupt vector table uses the VEC_ENTRY macro:

; This is a macro that instantiates one entry in the interrupt service table.
VEC_ENTRY .macro addr
    STW   B0,*--B15
    MVKL  addr,B0
    MVKH  addr,B0
    B     B0
    LDW   *B15++,B0
    NOP   2
    NOP
    NOP
   .endm

The default vector table looks like this:

_intcVectorTable:
_vector0:   VEC_ENTRY _c_int00      ;RESET
_vector1:   VEC_ENTRY _vec_dummy    ;NMI
...

If the bootloader jumps to the reset vector (_vector0), register B0 is saved on the stack (stackpointer = register B15). Since B15 will be initialized in c_int00, but is not initialized at this time, a random memory location will be overwritten. This will cause unpredictable behaviour or crashes.

2 Solution

Do not use the VEC_ENTRY macro for the reset vector, use it only for the other interrupts. Change the reset vector to

_intcVectorTable:
_vector0:                           ;RESET
    MVKL  _c_int00,B0
    MVKH  _c_int00,B0
    B     B0
    NOP   
    NOP
    NOP
    NOP
    NOP
_vector1:   VEC_ENTRY _vec_dummy    ;NMI
...

3 Additional Tags

startup boot IVT



Contact Post.png Support Tool.png