In my project,
boot loader Flash address: 0x08000000
application Flash address: 0x08004000
Same RAM for boot and app: 0x20000000(IRAM1) and 0x10000000(IRAM2)
Boot Loader and application(Without FreeRTOS) working perfectly.
But if i use freeRTOS in my application with two task (Display and communication) :
jump boot loader -> application
application running -> Initialize all peripherals(GPIO,Display, Eth, GSM,SPI etc)
Create Task1 -> without any Error
Create Task2 -> Without any Error
task1=osCreateTask("Task Display_Data", Task_Display_Data, NULL, 512, 3);//brick
if(task1 == OS_INVALID_HANDLE)
{
//Debug message
TRACE_ERROR("Failed to create task!\r\n");
}
task2=osCreateTask("Communication_Task",Communication_Task, NULL, 512, 1);
if(task2 == OS_INVALID_HANDLE)
{
//Debug message
TRACE_ERROR("Failed to create task!\r\n");
}
vTaskStartScheduler();
while(1);
vTaskStartScheduler -> xPortStartScheduler ->prvStartFirstTask() ->
__asm void prvStartFirstTask( void )
{
PRESERVE8
/* Use the NVIC offset register to locate the stack. */
ldr r0, =0xE000ED08
ldr r0, [r0]
ldr r0, [r0]
/* Set the msp back to the start of the stack. */
msr msp, r0
/* Globally enable interrupts. */
cpsie i
cpsie f
dsb
isb
/* Call SVC to start the first task. */
svc 0 //it's stuck on this line
nop
nop
}
This is my jump code (boot to app)
void INTFLASH_execute_main_app()
{
pFunction Jump_To_Application;
uint32_t JumpAddress;
JumpAddress = *(__IO uint32_t*) (IAP_APP_ADDRESS + 4);
Jump_To_Application = ( pFunction) JumpAddress;
RCC_APB2PeriphResetCmd(RCC_AHB1Periph_GPIOB, ENABLE);
RCC_APB2PeriphResetCmd(RCC_AHB1Periph_GPIOB, DISABLE);
GPIO_DeInit(GPIOB);
SPI_DeInit(SPI2);
RCC_DeInit();
__disable_irq();
__DSB();
__ISB();
SYSCFG->MEMRMP = 0x01;
SCB->VTOR = IAP_APP_ADDRESS;
__set_MSP( *(__IO uint32_t*)IAP_APP_ADDRESS ); // Initialise app's Stack Pointer
__DSB();
SysTick->CTRL &= 0xFFFFFFFE;
SysTick->LOAD = 0;
SysTick->VAL = 0;
Jump_To_Application();
}
User contributions licensed under CC BY-SA 3.0