I am developing a bootloader and want to jump to the application. I am new to this so I am not entirely sure I am doing it right, but as far as I know I have to change the value stored in the VTOR (Vector Table Offset Register) to point to the Vector Table of the application. However when I try to do this I end up in the FaultISR(). In the CFSR (Configurable Fault Status Register) I can see that the IMPRECISERR bit is set. This is the description of that register:

Imprecise data bus error. It is a BusFault, but the Return PC is not related to the causing instruction. This is not a synchronous fault. So, if detected when the priority of the current activation is higher than the Bus Fault, it only pends. Bus fault activates when returning to a lower priority activation. If a precise fault occurs before returning to a lower priority exception, the handler detects both IMPRECISERR set and one of the precise fault status bits set at the same time. BFAR is not written.

The following function is the function I use to try to jump to the application.

void svcallIRQ(void) {
    typedef void (*p_function)(void);
    uint32_t jump_address = *(volatile uint32_t*)(FIRM_OFFSET + 4); // FIRM_OFFSET = 0x2E000
    p_function p_jump_function = (p_function) jump_address;


    uint32_t *vtor = (uint32_t*)CPU_SCS_O_VTOR; // CPU_SCS_O_VTOR = 0x00000D08
    *vtor = ((uint32_t )FIRM_OFFSET); // change vector table offset to first bytes of firmware

    __NOP(); // The error occurs after this NOP


    __set_MSP(*(volatile uint32_t*) FIRM_OFFSET);


This function is a SVCall handler so it should be run in Privileged mode, which according to the documentation of the CC2652 is the mode you have to be in when trying to modify the VTOR.

Can someone tell me what I am doing wrong here?

The paragraph below is taken from the Technical Manual of the CC2652 and explains writing to the VTOR.

On system reset, the vector table is fixed at address 0x00000000. Privileged software can write to the Vector Table Offset register (CPU_SCS:VTOR) to relocate the vector table start address to a different memory location, in the range 0x00000200 to 0x3FFFFE00. When configuring the CPU_SCS:VTOR register, the offset must be aligned on a 512-byte boundary.

  • 1
    \$\begingroup\$ What is the value of FIRM_OFFSET? From your edit, "the offset must be aligned on a 512-byte boundary" - is it? \$\endgroup\$ – Tom Carpenter Mar 24 '20 at 10:08
  • \$\begingroup\$ @TomCarpenter FIRM_OFFSET is 0x2E000, which should be aligned on a 512-byte boundary, right? \$\endgroup\$ – Vincent Kenbeek Mar 24 '20 at 11:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.