1

In my project,

boot loader Flash address: 0x08000000

application Flash address: 0x08004000

Same RAM for boot and app: 0x20000000(IRAM1) and 0x10000000(IRAM2)

  1. Separately boot Loader and Application(With or Without FreeRTOS) working fine.
  2. Boot Loader and application(Without FreeRTOS) working perfectly.

  3. 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();
 }
Malik Ji
  • 339
  • 3
  • 13
  • My guess is your heap is too small or not actually implemented. – Russ Schultz Mar 10 '18 at 14:31
  • @Russ Schultz I already increased both task heap size 256 byte to 512 byte . But it's not working. And another thing is that if I separately run this code it's working fine – Malik Ji Mar 10 '18 at 14:36
  • you increased their STACK size. Where is that stack coming from? I don't see you allocating it anywhere, so it must be coming from the OS HEAP. – Russ Schultz Mar 10 '18 at 16:19
  • @Russ I am using FreeRTOS so, in my code i am using heap_3.c. don't confuse with (custom task)function name. – Malik Ji Mar 10 '18 at 17:15
  • And i already mention in my question if i separately run my application code no error found, it's working fine. I think ,vect table in ram not configure properly – Malik Ji Mar 10 '18 at 17:21
  • Yes i solved it,There is VECT_TABLE_OFFSET problem. Thank you for your reply @RussSchultz – Malik Ji Mar 10 '18 at 17:55
  • @MalikJi , can you provide the solution in detail – Hardik Sanghvi Nov 11 '22 at 04:48

0 Answers0