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.

[参考译文] CCSTUDIO3:printf()停止工作并锁定程序

Guru**** 2535150 points
Other Parts Discussed in Thread: TMS320F28386S, C2000WARE

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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1188122/ccstudio3-printf-stopped-working-and-locks-program

器件型号:CCSTUDIO3
主题中讨论的其他器件:TMS320F28386SC2000WARE

我使用普通 OLE printf()打印到控制台。 现在、它的工作时间更长、并锁定正在进行的程序。 它似乎在  _TI_file_lock (stdout)上停止;

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

    您好!

    请提供以下信息:

    确切的 CCS 版本号

    精确的编译器版本号

    -Target 器件

    主机操作系统

    -(如果可能)可重现的测试案例

    谢谢

    Ki

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

    CCS 版本:11.1.0.00011  

    编译器:V22.6.0.LTS

    器件是 TMS320F28386S。

    主机操作系统:Windows 10 Pro、版本10.0.19044内部版本19044。

    测试案例:

    该工程是 C:\ti\c2000\C2000Ware_4_02_00_00\driverlib\f2838x\examples\C28x_dual\flash_kernel\的导入

    文件为 flash_kernel_C28x_dual_ex1_sci_flash_kernel_cpu1.c

    我添加了第50、70和71行。 启动时锁定。 此外、单步执行也不会从第70行返回。

    //###########################################################################
    //
    // FILE:    flash_kernel_c28x_dual_ex1_sci_flash_kernel_cpu1.c
    //
    // TITLE:   CM kernel main function
    //
    //###########################################################################
    // $Copyright:
    // Copyright (C) 2022 Texas Instruments Incorporated - http://www.ti.com
    //
    // 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.
    // $
    //###########################################################################
    //
    // Included Files
    //
    
    #include <flash_kernel_c28x_dual_ex1_erase_cpu1.h>
    #include <string.h>
    #include "flash_programming_f2838x_c28x.h" // Flash API example header file
    #include "F021_F2838x_C28x.h"
    #include "cpu1bootrom.h"
    #include "device.h"
    #include "stdio.h"
    
    //
    // Function Prototypes
    //
    void exampleError(Fapi_StatusType status);
    void initFlashSectors(void);
    void SeizeFlashPump_kernels(void);
    extern uint32_t sciGetFunction(uint32_t  BootMode);
    extern void sciaFlush(void);
    
    //
    // Main
    //
    uint32_t main(void)
    {
        //
        // flush SCIA TX port by waiting while it is busy, driverlib.
        //
        sciaFlush();
        printf("\r\nConsole test.");
        fflush(stdout);
        //
        // initialize device and GPIO, driverlib.
        //
        Device_init();
        Device_initGPIO();
    
        //
        // init interrupt and vectorTable, drivelib.
        //
        Interrupt_initModule();
        Interrupt_initVectorTable();
    
        //
        // Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
        //
        EINT;
        ERTM;
    
        //
        // At 200MHz, execution wait-states for external oscillator is 3. Modify the
        // wait-states when the system clock frequency is changed.
        //
        Flash_initModule(FLASH0CTRL_BASE, FLASH0ECC_BASE, 3);
    
        Flash_claimPumpSemaphore(FLASH_CPU1_WRAPPER);
    
        //
        // initialize flash_sectors, fapi + driverlib
        //
        initFlashSectors();
    
        uint32_t EntryAddr;
    
        //
        // parameter SCI_BOOT for GPIO28 (RX),29 (TX) is default.
        //
        EntryAddr = sciGetFunction(SCI_BOOT);
        return(EntryAddr);
    }
    
    //
    // Init_Flash_Sectors - Initialize flash API and active flash bank sectors
    //
    void initFlashSectors(void)
    {
        EALLOW;
        Fapi_StatusType oReturnCheck;
    
        oReturnCheck = Fapi_initializeAPI(F021_CPU0_BASE_ADDRESS, 200);
        if(oReturnCheck != Fapi_Status_Success)
        {
            exampleError(oReturnCheck);
        }
    
        oReturnCheck = Fapi_setActiveFlashBank(Fapi_FlashBank0);
        if(oReturnCheck != Fapi_Status_Success)
        {
            exampleError(oReturnCheck);
        }
        EDIS;
    }
    
    
    
    //
    // exampleError - For this example, if an error is found just stop here
    //
    #ifdef __TI_COMPILER_VERSION__
        #if __TI_COMPILER_VERSION__ >= 15009000
            #pragma CODE_SECTION(exampleError,".TI.ramfunc");
        #else
            #pragma CODE_SECTION(exampleError,"ramfuncs");
        #endif
    #endif
    
    void exampleError(Fapi_StatusType status)
    {
        //
        // Error code will be in the status parameter
        //
        __asm("    ESTOP0");
    }
    
    //
    // End of file
    //
    
    

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

    谢谢。

    您之前提到过:

    [引用 userid="152282" URL"~/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1188122/ccstudio3-printf-stopped-working-and-locks-program "]现在它的工作时间更长,可以锁定正在进行中的程序

    看起来 printf 曾经按预期工作过。 这是否具有相同的项目、器件和 CCS 版本? 还是完全不同的环境?

    谢谢

    Ki

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

    都是一样的。

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

    我应该补充的是,其他项目(如 blinky)可以正常运行 printf()。

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

    这可能是特定于项目的问题。 我在论坛中搜索并找到了以下主题:

    https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/968929/ccs-msp430f2418-problems-with-printf-redirected-to-uart-1/3580253#3580253

    BTW -我可以使用相同的示例(+您的修改)重现此问题。 但是、我还没有关于根本原因的解释。

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

    感谢您的调查。

    同时、我有一个权变措施。 创建一个写入例程将消息发送到 SCI B 和 Putty 窗口没有太多工作。

    JH

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    [引用 userid="152282" URL"~/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1188122/ccstudio3-printf-stopped-working-and-locks-program/4480116 #4480116"]Meanwhile 我有权变措施。 创建一个写入例程以将消息发送到 SCI B 和 Putty 窗口没有太多工作。

    感谢您的分享。 由于资源需求较高、我们通常不会在 C2000等 MCU 上看到过多的 printf (通过 JTAG)使用情况。 您所描述的其他方法更为常见。