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.

[参考译文] CC1310:Quot;Task_constructure"和"Task_Create "出现问题

Guru**** 2472280 points
Other Parts Discussed in Thread: CC1310

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

https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/1406059/cc1310-problems-with-task_construct-and-task_create

器件型号:CC1310

工具与软件:

您好!  
我目前正在攻读学士学位。 我必须构建一个基于 CC1310的技术演示器。  
我使用示例 CCS-Project 构建我的应用、该示例工程是构建一家其他公司。 我现在的问题是、不能创建除任务之外的其他任务  
附带示例。 LOC_stackTask 是"原始任务"。
这是我的主函数外观。 行25一到达、它就会崩溃。 如果我对该行表示一切正常,或者至少被创建,我不确定我的时钟功能是否真正有效。 对于时钟和信标、我查看了 BIOS_Userguide.pdf 示例3-1时间片调度并对其进行了修改。


这是当我调试代码时在 ROV 中显示的内容。

Error_Block eb;
Board_init();
Power_NotifyObj powerNotify = { 0 };
    Power_registerNotify(&powerNotify, PowerCC26XX_AWAKE_STANDBY,
                         loc_powerNotify, NULL);

    /* Initialize error parameters */
    Error_init(&eb);
// stack Task Params
    Task_Params_init(&gStackTaskParams);
    gStackTaskParams.stackSize = sizeof(gStackTaskStack);
    gStackTaskParams.priority = 2;
    gStackTaskParams.stack = &gStackTaskStack;

    // Display Task Params
    Task_Params_init(&gDisplayTaskParams);
    gDisplayTaskParams.stackSize = 1024;
    gDisplayTaskParams.priority = 3;
    gStackTaskParams.stack = &gDisplayTaskStack;

    /* Initialize tasks */
    Task_construct(&gStackTaskStruct, loc_stackTask, &gStackTaskParams,
    NULL);

    Task_construct(&gDisplayTaskStruct, loc_DisplayTask, &gDisplayTaskParams,
    NULL);
    
     /*==== Create the Semaphores and clocks ====*/

    Clock_Params_init(&myClockParams);
    myClockParams.period = 4000;  // 4 Seconds
    myClockParams.startFlag = true;   // start immediately
    clock_dispHandle = Clock_create((Clock_FuncPtr) clockHandler_disp, 4000,
                                    &myClockParams, &eb);

    Clock_Params_init(&myClockParams);
    myClockParams.period = 10000;  // 10 Seconds
    myClockParams.startFlag = true;   // start immediately
    clock_dispHandle = Clock_create((Clock_FuncPtr) clockHandler_sens, 10000,
                                    &myClockParams, &eb);

    Clock_Params_init(&myClockParams);
    myClockParams.period = 15000;  // 15 Seconds
    myClockParams.startFlag = true;   // start immediately
    clock_dispHandle = Clock_create((Clock_FuncPtr) clockHandler_send, 15000,
                                    &myClockParams, &eb);

    disp_Sem = Semaphore_create(0, NULL, &eb);
    sens_Sem = Semaphore_create(0, NULL, &eb);
    send_Sem = Semaphore_create(0, NULL, &eb);

也许有人知道为什么会发生这种情况、提前感谢。

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

    更新:我知道无法再创建原始任务。  

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

    尊敬的 GBU:

    您是否还检查过是否有足够的堆栈/堆内存分配给特定任务或应用? 您也可以在 ROV 中访问该数据。

    此致、

    Arthur

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

    嗨、Arthur、
    我已经检查过它。 我也发现了我的问题,但我真的不会低估它。
    我为每个任务使用了不同的 Task_Params 变量、如果我只使用一个、例如 gStackParams、它就会起作用。 但我不知道为什么。

    感谢您的回复和问候。
    GBU

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

    您好!
    我在使用 RTOS 时仍然遇到问题。 时钟没有开始运行、我也不能使用 Task_sleep (xx)。 有时它( Task_Sleep ())完全阻断任务,从不取消阻止它,有时它只是做什么,任务肯定运行。 我也检查了.cfg 文件,但我没有发现任何异常,至少我可以告诉。

    我也得到了这个例外,即使我的 main()几乎是空的,所以没有配置时钟或任务。

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

    尊敬的 GBU:

    您能否分享该项目的"记忆"视图? 同样、堆上的裕度也可能非常小。

    此外、请共享链接器文件(.cmd 文件)。

    此致、

    Arthur

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

    您好、Arthur、抱歉这么晚的回复、
    这是我的.cmd 文件。

    /*
     * Copyright (c) 2015-2016, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR
     * CONTRIBUTORS 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.
     */
    
    /*
     *  ======== CC1310_LAUNCHXL.cmd ========
     */
    
    --stack_size=1024   /* C stack is also used for ISR stack */
    
    HEAPSIZE = 256;  /* Size of heap buffer used by HeapMem */
    
    /* Override default entry point.                                             */
    --entry_point ResetISR
    /* Allow main() to take args                                                 */
    --args 0x8
    /* Suppress warnings and errors:                                             */
    /* - 10063: Warning about entry point not being _c_int00                     */
    /* - 16011, 16012: 8-byte alignment errors. Observed when linking in object  */
    /*   files compiled using Keil (ARM compiler)                                */
    --diag_suppress=10063,16011,16012
    
    /* The starting address of the application.  Normally the interrupt vectors  */
    /* must be located at the beginning of the application.                      */
    #define FLASH_BASE              0x0
    #define FLASH_SIZE              0x20000
    #define RAM_BASE                0x20000000
    #define RAM_SIZE                0x5000
    
    /* System memory map */
    
    MEMORY
    {
        /* Application stored in and executes from internal flash */
        FLASH (RX) : origin = FLASH_BASE, length = FLASH_SIZE
        /* Application uses internal RAM for data */
        SRAM (RWX) : origin = RAM_BASE, length = RAM_SIZE
    }
    
    /* Section allocation in memory */
    
    SECTIONS
    {
        .text           :   >> FLASH
        .TI.ramfunc     : {} load=FLASH, run=SRAM, table(BINIT)
        .const          :   >> FLASH
        .constdata      :   >> FLASH
        .rodata         :   >> FLASH
        .cinit          :   > FLASH
        .pinit          :   > FLASH
        .init_array     :   > FLASH
        .emb_text       :   >> FLASH
        .sf_nvm         :   load = 0x1D000, type = NOLOAD
        .weptech_calib  :   load = 0x1E000, type = NOLOAD
        .ccfg           :   > FLASH (HIGH)
    
        .data           :   > SRAM
        .bss            :   > SRAM
        .sysmem         :   > SRAM
        .nonretenvar    :   > SRAM
    
        /* Heap buffer used by HeapMem */
        .priheap   : {
            __primary_heap_start__ = .;
            . += HEAPSIZE;
            __primary_heap_end__ = .;
        } > SRAM align 8
    
        .stack          :   > SRAM (HIGH)
    }

      这是我当前项目的内存和堆栈视图。 我还注意到、当时钟确实启动时、我只能将2000解析为最高周期时间。 但正如我所说的那样、他们大部分时间都没有开始工作。

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

    尊敬的 GBU:

    不应对每个任务使用相同的任务参数。

    您是否已尝试增加链接器文件中的栈大小以及堆? (例如4096)。 我之所以这么说、是因为我看到您正在将任务初始化、堆栈大小为1024。

    此致、

    Arthur

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

    嗨、Arthur、
    我已经尝试增加堆栈大小、但没有在链接器文件中增加。 我相信,其中一个原因,它有问题是因为该项目是由外部公司原创设置的方式,但我不是被允许分享他们的代码,以帮助进行故障排除。
     所以我 决定改变应用的实施方式、因为在没有工作示例的情况下、我已经投入了大量的时间。 IAM 将使用"超循环"、它将在单个任务内运行。 我也不会使用时钟、而是使用计时器、因为我可以让它以这种方式运行。  

    非常感谢您的帮助(以及您的时间)、但我很紧张、必须决定如何继续、即使此解决方案可能不如使用 RTOS 那么优雅。