Hi,
i ama tring to run application on external ram. wrote a bootloader application that copies bin file from flash to externam sdram. then calling this function.
/* execute the firmware exists in sramx. */
typedef void(*func_0_t)(void);
void app_execute_ram_firmware(void * addr)
{
PRINTF("Function Starts...\n");
uint32_t * vector_table = (uint32_t *)addr;
uint32_t sp_base = vector_table[0];
func_0_t pc_func = (func_0_t)(vector_table[1]);
// func_0_t pc_func = (func_0_t)(addr + 4);
PRINTF("Function Starts... vector_table:%x\n",vector_table);
PRINTF("Function Starts... sp_base:%x\n",sp_base);
PRINTF("Function Starts... pc_func:%x\n",pc_func);
/* set new msp and psp. */
__set_MSP(sp_base);
__set_PSP(sp_base);
#if __VTOR_PRESENT == 1
SCB->VTOR = addr;
#endif
/* jump to application. */
pc_func();
/* the code should never reach here. */
while (1)
{}
}
my program output like this:
EEPROM init is OK.
File size is 16872.
BOOTLOADER file is OK.
Function Starts...
Function Starts... vector_table:a0000000
Function Starts... sp_base:20018000
Function Starts... pc_func:a0000415
but main code can not start.
when i put bootloader code and main code into lpc's internal flash memory. after bootloader , main code is works.
Then i tested second things.
wrote some dummy data to external sd ram into bootloader. then i can read it again into main code.
is there any missing to work code form external sdram?