This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LPC812 bootloader

I'm using a lpc812 to make a bootloader.
The boot design is mapped 0x0000 to 0x1000 flash.
The application is mapped 0x1000 to 0x3FFC flash.

I program the application and boot with the Flash magic, but when jumping for the same application does not run.
I read the lpc812 with Flash magic, hex is correct in the mapped positions.

#define XBOOT_APP_ADDR          0x00001000
#define XBOOT_APP_SIZE          0x3000
#define XBOOT_APP_VERSION_ADDR  (XBOOT_APP_ADDR + XBOOT_APP_SIZE - 4)

void XBoot_RunApp(void) {
        XBootEntryPtr appEntry;
        appEntry = (XBootEntryPtr)*((uint32_t*)XBOOT_APP_ADDR);
        (appEntry)();
}

My application only flashes a led without interruption.

static const uint32_t AppVersion __attribute__((at(XBOOT_APP_VERSION_ADDR))) = 0x00000012;

int main(void) {
        SystemCoreClockUpdate();

        /* Matrix clock */
        LPC_SYSCON->SYSAHBCLKCTRL |= (1UL << 7);
        /* Reset pin */
        LPC_SWM->PINENABLE0 &= (1UL << 6);

        /* Led */
        LPC_GPIO_PORT->DIR0 |= (1UL << LED_PIN);
        LPC_GPIO_PORT->B0[LED_PIN] = LED_ON;

        //SysTick_Config((SystemCoreClock / 1000) - 1);

        while (1) {
                if (++LEDCount > 0xFFFF) {
                        LEDCount = 0;
                        if (LPC_GPIO_PORT->B0[LED_PIN] == LED_ON)
                                LPC_GPIO_PORT->B0[LED_PIN] = !LED_ON;
                        else
                                LPC_GPIO_PORT->B0[LED_PIN] = LED_ON;
                }
        }
}

Can anyone help me?

Parents
  • What about

    void XBoot_RunApp(void) {
            XBootEntryPtr appEntry;
            appEntry = (XBootEntryPtr)*((uint32_t*)(XBOOT_APP_ADDR + 4));
            (appEntry)();
    }
    

    Print out the value ascribed to addEntry and confirm it is that of your ResetHandler.

    Life would be much easier if you could use a debugger instead of using valueless terms like "doesn't work" or "will not work". Inspect WHAT is going on, determine WHY it is happening.

Reply
  • What about

    void XBoot_RunApp(void) {
            XBootEntryPtr appEntry;
            appEntry = (XBootEntryPtr)*((uint32_t*)(XBOOT_APP_ADDR + 4));
            (appEntry)();
    }
    

    Print out the value ascribed to addEntry and confirm it is that of your ResetHandler.

    Life would be much easier if you could use a debugger instead of using valueless terms like "doesn't work" or "will not work". Inspect WHAT is going on, determine WHY it is happening.

Children