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?
I found a JTAG! The value of appEntry == 0x1004.. When I call (appEntry)() is generated HardFault_Handler()..