I have the following setup :
AT91SAM7SE32 with a serial DataFlash and SDRAM on the external bus interface.
The startup is as follows:
1 - A BootStrapper written en FreeRTOS in internal Flash/Ram starts up and transfers an image from the serial dataflash to the external RAM. Then it sets the PC to address 0x20000000 which is the start address of the external RAM.
2 - The image loaded in external RAM is a FreeRTOS based BootLoader which starts with the normal boot.s to setup the new stacks etc. It has a file system and connectivity (USART, USB, Ethernet…). When this BootLoader exits it loads the Application Image from the serial flash into another place in external RAM. Right now it just blinks an LED on the evaluation kit.
3 - The application starts and runs from external RAM.
So far I have managed to stop the FreeRTOS like this :
// Stop the PIT
AT91C_BASE_PITC->PITC_PIMR = 0x0000;
// Load address 0x20000000 into the PC
asm volatile ( "LDR PC, =0x20000000");
The BootLoader now starts and runs from RAM BUT when the BootLoader calls taskENTER_CRITICAL()/taskEXIT_CRITICAL() the blinking LEDs now blinks erratically.
Do I need to do something extra before the jump to 0x2000000 in order to make sure that the OS is reset to a known state ?