This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] AWRL1432:次级引导加载程序无法在 FreeRTOS 中的任务中执行。

Guru**** 2463330 points
Other Parts Discussed in Thread: UNIFLASH

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/sensors-group/sensors/f/sensors-forum/1476925/awrl1432-secondary-boot-loader-cannot-be-executed-in-a-task-in-freertos

器件型号:AWRL1432
主题中讨论的其他器件:UNIFLASH

工具与软件:

此外、SBL 无法在 FreeRTOS 中的任务中执行? 因为我在测试时无法使用它。

主代码如下所示

/*
* Copyright (C) 2024 Texas Instruments Incorporated
*
* All rights reserved not granted herein.
* Limited License.  
*
* Texas Instruments Incorporated grants a world-wide, royalty-free, 
* non-exclusive license under copyrights and patents it now or hereafter 
* owns or controls to make, have made, use, import, offer to sell and sell ("Utilize")
* this software subject to the terms herein.  With respect to the foregoing patent 
* license, such license is granted  solely to the extent that any such patent is necessary 
* to Utilize the software alone.  The patent license shall not apply to any combinations which 
* include this software, other than combinations with devices manufactured by or for TI ("TI Devices").  
* No hardware patent is licensed hereunder.
*
* Redistributions must preserve existing copyright notices and reproduce this license (including the 
* above copyright notice and the disclaimer and (if applicable) source code license limitations below) 
* in the documentation and/or other materials provided with the distribution
*
* Redistribution and use in binary form, without modification, are permitted provided that the following
* conditions are met:
*
*	* No reverse engineering, decompilation, or disassembly of this software is permitted with respect to any 
*     software provided in binary form.
*	* any redistribution and use are licensed by TI for use only with TI Devices.
*	* Nothing shall obligate TI to provide you with source code for the software licensed and provided to you in object code.
*
* If software source code is provided to you, modification and redistribution of the source code are permitted 
* provided that the following conditions are met:
*
*   * any redistribution and use of the source code, including any resulting derivative works, are licensed by 
*     TI for use only with TI Devices.
*   * any redistribution and use of any object code compiled from the source code and any resulting derivative 
*     works, are licensed by TI for use only with TI Devices.
*
* Neither the name of Texas Instruments Incorporated nor the names of its suppliers may be used to endorse or 
* promote products derived from this software without specific prior written permission.
*
* DISCLAIMER.
*
* THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
* IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
* POSSIBILITY OF SUCH DAMAGE.
*/

#include <stdlib.h>
#include <kernel/dpl/DebugP.h>
#include "ti_drivers_config.h"
#include "ti_board_config.h"
#include "FreeRTOS.h"
#include "task.h"

#define MAIN_TASK_PRI  (configMAX_PRIORITIES-1)

#define MAIN_TASK_SIZE (1024U/sizeof(configSTACK_DEPTH_TYPE))
StackType_t gMainTaskStack[MAIN_TASK_SIZE] __attribute__((aligned(32)));

StaticTask_t gMainTaskObj;
TaskHandle_t gMainTask;

void sbl_main(void *args);

void freertos_main(void *args)
{
    sbl_main(NULL);

    vTaskDelete(NULL);
}


int main()
{
    /* init SOC specific modules */
    System_init();
    Board_init();

    /* This task is created at highest priority, it should create more tasks and then delete itself */
    gMainTask = xTaskCreateStatic( freertos_main,   /* Pointer to the function that implements the task. */
                                  "freertos_main", /* Text name for the task.  This is to facilitate debugging only. */
                                  MAIN_TASK_SIZE,  /* Stack depth in units of StackType_t typically uint32_t on 32b CPUs */
                                  NULL,            /* We are not using the task parameter. */
                                  MAIN_TASK_PRI,   /* task priority, 0 is lowest priority, configMAX_PRIORITIES-1 is highest */
                                  gMainTaskStack,  /* pointer to stack base */
                                  &gMainTaskObj ); /* pointer to statically allocated task object memory */
    configASSERT(gMainTask != NULL);

    /* Start the scheduler to start the tasks executing. */
    vTaskStartScheduler();

    /* The following line should never be reached because vTaskStartScheduler()
    will only return if there was not enough FreeRTOS heap memory available to
    create the Idle and (if configured) Timer tasks.  Heap management, and
    techniques for trapping heap exhaustion, are described in the book text. */
    DebugP_assertNoLog(0);

    return 0;
}

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Johnny:

    感谢您联系我们。 我很乐意提供帮助、但首先需要一些信息、以便我能够缩小可能发生的事情的范围。 请告诉我以下问题的答案。

    • 您在使用哪种 SDK?
    • 您看到了什么故障?
      • 即硬故障在某个位置、跳转到错误的地址等
      • 您是否收到任何错误代码?
      • 它是否在 SBL main 之前、之后、期间发生故障?

    请根据您的了解回答上述问题。  

    此致!

    Vignesh K.

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我可参考"radar_toolbox_2_30_00_12\source\ti\examples\sdk_Access\sbl\kick_to_Open" Automotive_Hands 和"mmwave_L_SDK_05_05_03_00\examples\drivers\boot\sbl"示例代码 Hands_Free_Access。

    并将 SBL 函数添加到 Kick_to_Open 项目中。

    应用程序映像(任何映像)已在分区2中预刻录、当其打开时、日志将显示在终端中。

    如果在主任务中执行以下主代码、则不会切换到分区2进行引导、并且终端中不会显示任何日志。

    /*
    * Copyright (C) 2024 Texas Instruments Incorporated
    *
    * All rights reserved not granted herein.
    * Limited License.  
    *
    * Texas Instruments Incorporated grants a world-wide, royalty-free, 
    * non-exclusive license under copyrights and patents it now or hereafter 
    * owns or controls to make, have made, use, import, offer to sell and sell ("Utilize")
    * this software subject to the terms herein.  With respect to the foregoing patent 
    * license, such license is granted  solely to the extent that any such patent is necessary 
    * to Utilize the software alone.  The patent license shall not apply to any combinations which 
    * include this software, other than combinations with devices manufactured by or for TI ("TI Devices").  
    * No hardware patent is licensed hereunder.
    *
    * Redistributions must preserve existing copyright notices and reproduce this license (including the 
    * above copyright notice and the disclaimer and (if applicable) source code license limitations below) 
    * in the documentation and/or other materials provided with the distribution
    *
    * Redistribution and use in binary form, without modification, are permitted provided that the following
    * conditions are met:
    *
    *	* No reverse engineering, decompilation, or disassembly of this software is permitted with respect to any 
    *     software provided in binary form.
    *	* any redistribution and use are licensed by TI for use only with TI Devices.
    *	* Nothing shall obligate TI to provide you with source code for the software licensed and provided to you in object code.
    *
    * If software source code is provided to you, modification and redistribution of the source code are permitted 
    * provided that the following conditions are met:
    *
    *   * any redistribution and use of the source code, including any resulting derivative works, are licensed by 
    *     TI for use only with TI Devices.
    *   * any redistribution and use of any object code compiled from the source code and any resulting derivative 
    *     works, are licensed by TI for use only with TI Devices.
    *
    * Neither the name of Texas Instruments Incorporated nor the names of its suppliers may be used to endorse or 
    * promote products derived from this software without specific prior written permission.
    *
    * DISCLAIMER.
    *
    * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
    * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
    * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
    * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
    * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
    * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
    * POSSIBILITY OF SUCH DAMAGE.
    */
    
    #include <stdlib.h>
    #include <kernel/dpl/DebugP.h>
    #include "ti_drivers_config.h"
    #include "ti_board_config.h"
    #include "FreeRTOS.h"
    #include "task.h"
    
    #define MAIN_TASK_PRI  (configMAX_PRIORITIES-1)
    
    #define MAIN_TASK_SIZE (1024U/sizeof(configSTACK_DEPTH_TYPE))
    StackType_t gMainTaskStack[MAIN_TASK_SIZE] __attribute__((aligned(32)));
    
    StaticTask_t gMainTaskObj;
    TaskHandle_t gMainTask;
    
    //void gesture_recognition(void *args);
    void sbl_main(void *args);
    
    void freertos_main(void *args)
    {
        //gesture_recognition(NULL);
        sbl_main(NULL);
    
        vTaskDelete(NULL);
    }
    
    
    int main()
    {
        /* init SOC specific modules */
        System_init();
        Board_init();
    #if 0
        sbl_main(NULL);
    #else
        /* This task is created at highest priority, it should create more tasks and then delete itself */
        gMainTask = xTaskCreateStatic( freertos_main,   /* Pointer to the function that implements the task. */
                                      "freertos_main", /* Text name for the task.  This is to facilitate debugging only. */
                                      MAIN_TASK_SIZE,  /* Stack depth in units of StackType_t typically uint32_t on 32b CPUs */
                                      NULL,            /* We are not using the task parameter. */
                                      MAIN_TASK_PRI,   /* task priority, 0 is lowest priority, configMAX_PRIORITIES-1 is highest */
                                      gMainTaskStack,  /* pointer to stack base */
                                      &gMainTaskObj ); /* pointer to statically allocated task object memory */
        configASSERT(gMainTask != NULL);
    
        /* Start the scheduler to start the tasks executing. */
        vTaskStartScheduler();
    
        /* The following line should never be reached because vTaskStartScheduler()
        will only return if there was not enough FreeRTOS heap memory available to
        create the Idle and (if configured) Timer tasks.  Heap management, and
        techniques for trapping heap exhaustion, are described in the book text. */
        DebugP_assertNoLog(0);
    #endif
        return 0;
    }
    

    /**************************************************************************
     *************************** Function Definitions *************************
     **************************************************************************/
    void sbl_main(void *args)
    {
        /* Open drivers for peripherals*/
        Drivers_open();
        Board_driversOpen();
    
        int32_t retVal = MINUS_ONE;
    
        /* Configuring EDMA for Sending data to CRC engine */
        sbl_configureEdmaCrc();
    
        retVal = bootload_qspi(((uint32_t)M_META_SBL + (uint32_t)(0x80000U)));
        if (retVal == 0)
        {
            Board_driversClose();
            Drivers_close();
            Board_deinit();
            System_deinit();
            sbl_switchtoapp();
            while(1)
            {}
        }
    }

    Bootload_QSPI()无法在主任务中执行? 为什么?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我目前没有其他想法来解决这个问题、您还有其他建议吗? 谢谢!

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您是否有任何其他建议或其他方法? 谢谢!

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    嗨、Johnny、

    感谢您的耐心。 您是否可以按照 此处概述的步骤尝试示例? 

    我是否正确理解您是使用 CCS 来实现此目的? 我认为使用 UNIFLASH 可能会更轻松、只需一次性刷写所有正确的映像。

    我将向您介绍 bootload_qSPI 函数为什么不起作用。 我必须进一步研究这一点。

    此致!

    Vignesh K.

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    当前问题如下图所示。 设置"#if 1"可以正常工作、但设置"#if 0"不起作用?

    次级引导加载程序无法在 FreeRTOS 任务中执行?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Johnny:  

    感谢您的答复。 我想更好地了解您的问题、我想知道您为什么要对这个 SBL 映像使用 FreeRTOS。 您是否需要对 SBL 提供 FreeRTOS 支持? 您为什么删除了 sbl_main 的下载部分?  

    我们不支持 FreeRTOS SBL、其原因是在从 SBL 示例切换为兼容 FreeRTOS 时、需要取消初始化和重新初始化大量开销、这最终很难实现。  

    请尝试 按此处所示的方式使用 SBL

    此致!

    Vignesh K.

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    这是标题开头的问题。"次级引导加载程序不能在 FreeRTOS 中的任务中执行。"

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Johnny:

    我们理解您有兴趣将 FreeRTOS 与我们的 SBL 示例配合使用。 但是、如前所述、我们正式不支持次级引导加载程序的 FreeRTOS 实现。 建议 按原样使用 SBL noRTOS 示例。 虽然我们无法为将 FreeRTOS 与 SBL 示例集成提供直接支持、但我们的团队很乐意帮助您解答有关我们官方支持的配置和示例的任何其他疑问或问题。 如果您有任何其他问题、请随时打开新主题帖或与我们联系、否则我将关闭此主题帖。

    此致!

    Vignesh K.