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.

[参考译文] TMS320F2800137:initSysctrl ()函数问题

Guru**** 2959240 points

Other Parts Discussed in Thread: C2000WARE

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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1278019/tms320f2800137-initsysctrl-function-doubt

器件型号:TMS320F2800137
主题中讨论的其他器件:C2000WARE

  我正在使用闪存、我必须将这个函数复制到哪个文件?

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

    Manoj,

    您在片段末尾看到的#pragma 是将其放入 RAM 所需的步骤之一。  其他2个是:

    1)在.cmd 文件内、您应该会看到.TI.ramfunc 被放置为加载/运行段;加载到闪存中、然后从 RAM 运行

    以下是位于以下位置的 GENERAL_FLASH_lnk.cmd 文件的示例:C:\ti\cc2000\C2000Ware_5_00_00_00\device_support\f280013x\common\cmd

    #if defined(__TI_EABI__)
       .TI.ramfunc      : LOAD = FLASH_BANK0_SEC_0_7,
                          RUN = RAMLS0,
                          LOAD_START(RamfuncsLoadStart),
                          LOAD_SIZE(RamfuncsLoadSize),
                          LOAD_END(RamfuncsLoadEnd),
                          RUN_START(RamfuncsRunStart),
                          RUN_SIZE(RamfuncsRunSize),
                          RUN_END(RamfuncsRunEnd),
                          ALIGN(8)
    #else
       .TI.ramfunc      : LOAD = FLASH_BANK0_SEC_0_7,
                          RUN = RAMLS0,
                          LOAD_START(_RamfuncsLoadStart),
                          LOAD_SIZE(_RamfuncsLoadSize),
                          LOAD_END(_RamfuncsLoadEnd),
                          RUN_START(_RamfuncsRunStart),
                          RUN_SIZE(_RamfuncsRunSize),
                          RUN_END(_RamfuncsRunEnd),
                          ALIGN(8)
    #endif
    

    2)在程序中调用 initSysCtrl()之前,需要调用 memcopy 函数。  下面是我们的 sysctrl.c 文件;您会看到用于放置它的预定义"闪存"的编译时间#if、具体取决于编译是否用于闪存构建。  如果您始终计划为闪存构建代码、则可以删除此代码所在的#if。

    oid InitSysCtrl(void)
    {
        //
        // Disable the watchdog
        //
        DisableDog();
    
    #ifdef _FLASH
        //
        // Copy time critical code and Flash setup code to RAM. This includes the
        // following functions: InitFlash()
        //
        // The  RamfuncsLoadStart, RamfuncsLoadSize, and RamfuncsRunStart
        // symbols are created by the linker. Refer to the device .cmd file.
        //
        memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
    
        //
        // Call Flash Initialization to setup flash waitstates. This function must
        // reside in RAM.
        //
        InitFlash();
    #endif

    此致!
    马修

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

    #ifdef _flash
    memcpy (&RamfuncsRunStart、&RamfuncsLoadStart、(size_t)&RamfuncsLoadSize);
    #endif

    在 InitSysCtrl()函数之前添加了此函数。 已对控制器进行编程、断电和开机控制器未返回到运行状态。

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

    你是否也对.cmd 文件进行了更改?  

    可以在连接 CCS/JTAG 的情况下调试引导至闪存;连接后复位器件(Run->Reset)、然后从 Scripts 中选择仿真引导、引导至闪存。  这将模拟闪存引导、您可以看到代码挂起的位置。

    此致!

    马修

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

    是否有任何与此调试过程相关的资源?

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

    Manoj,

    看看这篇文章 https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/618792/tms320f28027-how-does-emulation-boot-mode-is-configured ,在 F280013x 上的实现可能会略有不同,但概念是相同的。  在 CCS 主工具栏的"Scripts"下应该可以一键式地设置此设置。

    器件 TRM 还讨论了 EMUBOOT 流 https://www.ti.com/lit/pdf/spruix1

    此致!
    马修