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
  • Probably would help here, consider investing in the appropriate tools.

    Don't define the 0x10000000..0x100000BF region at all, just define IRAM1 as 0x100000C0..0x10000FFF [Size 0xF40]. The Linker has NO interest in the vector region. Make sure the REMAP code does what it's supposed too, and that ALL active interrupts have defined/functional service routines. Ideally your boot loader shouldn't have left any enabled once it leaves.

Reply
  • Probably would help here, consider investing in the appropriate tools.

    Don't define the 0x10000000..0x100000BF region at all, just define IRAM1 as 0x100000C0..0x10000FFF [Size 0xF40]. The Linker has NO interest in the vector region. Make sure the REMAP code does what it's supposed too, and that ALL active interrupts have defined/functional service routines. Ideally your boot loader shouldn't have left any enabled once it leaves.

Children