FreeRTOS Bootloader and external RAM

racemouse wrote on Friday, August 10, 2007:

Ok. This was the theory :

BootStrapper sets up the SWI interrupt vector to swi_handler in internal RAM. When the BootLoader in external ram interrupts it does not vector to the swi_handler in external RAM but to the swi_handler in internal RAM. I therefore needed to setup the correct interrupt vectors. I did it like this:

void main( void )
{
  extern void swi_handler(void);

 
  // Copy contents from Flash address 0x00 to 0x20 to RAM 0x00 to 0x20
  memcpy ((int *)0x00200000, (int *)0x00100000, 128);
 
  // Load the address of interrupt handlers into the correct places
  dest_address = (int*)0x00200020;
  *dest_address = (int*)0x20000034;
  dest_address = (int*)0x00200024;
  *dest_address = &swi_handler;
  dest_address = (int*)0x00200028;
  *dest_address = &Kernel_reboot;
  dest_address = (int*)0x0020002C;
  *dest_address = &Kernel_reboot;
  dest_address = (int*)0x00200030;
  *dest_address = (int*)0x2000004C;

  // Remap so the RAM starts at address 0x00000000
  AT91C_BASE_MC->MC_RCR |= AT91C_MC_RCB;
 
  vMainInit ();
  vTaskStartScheduler ();
}

And now it works as it should :slight_smile:

Thanks for the help to those who helped and I hope someone else can use this.

Cheers
RaceMouse