lpcware

Problems with VTOR on LPC11U68

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by valenti on Fri Jan 09 04:51:45 MST 2015
I have a firmware with two modules (projects):
1- own Bootlader module
2- main Application module
The Bootloader checks for valid Application and if correct changes Vector Table with VTOR register and jumps to this module.
This mecanism work fine with a similar firmware for LPC1758 (based on CMSIS 2.0) but with an LPC11U68 (based on LPCOpen v2.06) seems to hang. To achieve this I have modified the cmsis.h with a patch found in another topic for LPC8xx (another Cortex-M0+):
- replacing
    #define __CM0_REV                 0x0000/*!< Cortex-M0 Core Revision                          */
  with
    #define __CM0PLUS_REV             0x0001/*!< Cortex-M0+ Core Revision                         */
- adding
    #define __VTOR_PRESENT            1/*!< VTOR is present in this implementation           */

Is this changes on LPCOpen enough to use VTOR register?
Does anyone know if LPC11U68 really accepts the VTOR register? (According their User Manual seems it should)

This is the code used for BootLoader to jump to the Application:

void execute_code(unsigned addr)
{   void (*user_code_entry)(void);
    unsigned *p;    // used for loading address of reset handler from user flash

    // Change the Vector Table to the addr (if user application uses interrupts)
    SCB->VTOR = (addr & 0x1FFFFF80);

    // Load contents of second word of user flash - the reset handler address
    // in the applications vector table
    p = (unsigned *)(addr +4);

    // Set user_code_entry to be the address contained in that second word of user flash
    user_code_entry = (void *) *p;

    // Jump to user application
    user_code_entry();
}

Please help me!!!
Thanks in advance.

Outcomes