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.

[参考译文] TMS320F28388D:CCS 中的 CPP 代码兼容性

Guru**** 2482225 points


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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1447340/tms320f28388d-cpp-code-compatibility-in-ccs

器件型号:TMS320F28388D

工具与软件:

您好!

我目前正在将 CCS 与 F2838x 板配合使用、并探索支持 C++代码(而非 C)的可能性。我将闪烁 LED 示例修改为 C++、编译成功。 不过、我现在正在测试 C++库是否受支持、并了解需要解决的内存限制。

即使将堆栈和堆大小增加到1024、修改后的代码也会遇到内存限制错误。 我应该进行哪些更改才能解决此问题? 此外、如果有任何文档或资源可以帮助我确保 C++与 CCS 兼容、我将不胜感激。

#include <stdio.h>
extern "C"{
#include "driverlib.h"
#include "device.h"
#include "board.h"
#include "c2000ware_libraries.h"
}

class DeviceController {
public:
    //Constructor
    DeviceController() {
        // Initialize device clock and peripherals
        Device_init();

        // Disable pin locks and enable internal pull-ups
        Device_initGPIO();

        // Initialize PIE and clear PIE registers. Disables CPU interrupts
        Interrupt_initModule();

        // Initialize the PIE vector table with pointers to the shell Interrupt Service Routines (ISR)
        Interrupt_initVectorTable();

        // PinMux and Peripheral Initialization
        Board_init();

        // C2000Ware Library initialization
        C2000Ware_libraries_init();

        // Enable Global Interrupt (INTM) and real time interrupt (DBGM)
        EINT;
        ERTM;
    }
 //Method representing background task
    void applicationRun(){
    
        printf("Hello!\n");
     //   fflush(stdout);
        while (true) {
            // Turn on LED
            GPIO_writePin(myBoardLED0_GPIO, 0);

            // Delay for a bit
            DEVICE_DELAY_US(500000);

            // Turn off LED
            GPIO_writePin(myBoardLED0_GPIO, 1);

            // Delay for a bit
            DEVICE_DELAY_US(500000);
        }
    }
};

int main() {
    // Class based definition for DeviceController
    DeviceController controller;
    controller.applicationRun();
    return 0;
}
错误:  
"syscfg/device_cmd.cmd"、第77行:错误#10099-D:程序无法放入可用存储器、或者该段包含的调用站点需要无法为此段生成 trampoline。 针对第0页的".sysmem"段大小0x1024运行对齐/分块放置失败。 可用存储器范围:
RAMLS5大小:0x800未使用:0x143最大空洞:0x143
"syscfg/device_cmd.cmd"、第71行:错误#10099-D:程序无法放入可用存储器、或者该段包含的调用站点需要无法为此段生成 trampoline。 针对第0页的".stack"大小0x1024段运行对齐/分块放置失败。 可用存储器范围:
RAMM1大小:0x3f8未使用:0x3f8最大空洞:0x3f8
"syscfg/device_cmd.cmd"、第68行:错误#10099-D:程序无法放入可用存储器、或者该段包含的调用站点需要无法为此段生成 trampoline。 段".text"大小0x323d 第0页的对齐/分块放置失败。 可用存储器范围:
RAMLS0大小:0x800未使用:0x0最大空洞:0x0
RAMLS1大小:0x800未使用:0x0最大空洞:0x0
RAMLS2大小:0x800未使用:0x0最大空洞:0x0
RAMLS3大小:0x800未使用:0x0最大空洞:0x0
RAMLS4大小:0x800未使用:0x0最大空洞:0x0
错误#10010:链接过程中遇到错误;未构建"led_ex1_blinky.out"
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Asim:

    对于延迟、我们深表歉意。 通常在 C/C++代码优化方面、我们有一个应用手册提供了一些详细/建议: https://www.ti.com/lit/ug/spru514z/spru514z.pdf 

    根据程序存储器错误、这可能需要在链接器命令文件中进行一些修改、因此我将循环邀请正确的专家来提供指导。

    此致、

    Allison

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

    您好、Asim:

    看起来您耗尽了用于分配.sysmem 段、stack、.text 段等的 LSRAM 您可能需要使用另一个 RAM、该 RAM 具有足够的可用存储器来分配这些段。 您可以检查.map 文件以了解哪些 RAM 区域具有未使用的存储器。

    此外、请启用以下标志(如果尚未启用)。 这有助于更好地分配存储器

    此致、

    Veena.