Stuck on Instruction SVC0 __asm void prvStartFirstTask(void){...};在STM32F4中

时间:2018-03-10 08:56:32

标签: arm microcontroller stm32 freertos stm32f4discovery

在我的项目中,

  

引导加载程序Flash地址:0x08000000

     

应用程序Flash地址:0x08004000

     

启动和应用程序的相同RAM:0x20000000(IRAM1)和0x10000000(IRAM2)

  1. 单独引导加载程序和应用程序(有或没有FreeRTOS)正常工作。
  2. Boot Loader和应用程序(没有FreeRTOS)工作正常。

  3. 但如果我在我的应用程序中使用freeRTOS并执行两项任务(显示和通信):

    跳转启动加载程序 - >申请

    应用程序运行 - >初始化所有外设(GPIO,显示器,Eth,GSM,SPI等)

    创建Task1 - >没有任何错误

    创建Task2 - >没有任何错误

    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. */
    
  4.        svc 0    //it's stuck on this line 
    
           nop
           nop
          }
    

    这是我的跳转代码(启动到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();
     }
    

0 个答案:

没有答案
相关问题