Thanks a lot
I saw the source code for some inspiration.. but I can't solve my doubts..
I have my app running from 0x00 addres, and it's the secondary bootloader.
I want to save directly one bin image ( saved into one array ) into flash at address 0x3000. So have write the bin hex ( saved directly into code in one array ) into the necessary sectors of flash, with success.
After that, i have tried to jump to the 0x3004 address, reloading vector table address to 0x3000 ( i have enable this function with cortex m0+).
But i have stiil problems with interrupts.. i obtained : <signal handler called>() at 0xfffffff9 ( SIGINT interurpt) and no handler was called...
I don't know if I am wrong with the bin hex file saved into flash.. or with the interrupt vector table manaement..
--- I have generate the .bin file from my second application "blink" without checksum ( i don't wont check in this moment), using lpcxpresso ide. I have take bytes from 0x00 to 0x2000 ( app'size = 6KB) and copied into one uint32_t array in the bootloader that i want to persist in flash ad address 0x000
--- I tried two different ways for interrupt vector table...
1) this will generate the interrupt after jump_to_app()
cleanBoot();
SCB->VTOR = stackPointer;
unsigned * p = (unsigned *) (applicationAddress + 4);
void (*jump_to_app)(void);
jump_to_app = (void *) *p;
jump_to_app();
2) with common_handler in cr_startup....c and the redirect common_handler function. this will generate the interrupt when enter in common_handler, after jump2app();
cleanBoot();
Chip_PMU_WriteGPREG(LPC_PMU, 3, APP_VECTOR_TABLE);
__set_MSP(*(volatile uint32_t*) (APP_VECTOR_TABLE));
__set_PSP(*(volatile uint32_t*) (APP_VECTOR_TABLE));
jump2app = (iapfun) *(uint32_t*) (APP_VECTOR_TABLE + 4);
jump2app();
void Common_Handler(void)
{
typedef void (*pFunction)(void);
pFunction Jump_To_Application;
volatile uint32_t JumpAddress;
volatile uint32_t i;
i = __get_IPSR();
JumpAddress = *(__IO uint32_t *)(Chip_PMU_ReadGPREG(LPC_PMU, 3) + (4 * i));
Jump_To_Application = (pFunction) JumpAddress;
Jump_To_Application();
}