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: CPP Code Compatibility in CCS

Part Number: TMS320F28388D

Tool/software:

Hello,

I am currently using CCS with the F2838x board and exploring the possibility of supporting C++ code instead of C. I modified a blink LED example to C++, and it compiled successfully. However, I am now testing whether C++ libraries are supported and understanding the memory constraints I need to address.

The modified code is encountering memory constraint errors, even though I have increased the stack and heap sizes to 1024. What changes should I make to resolve this issue? Additionally, if there are any documents or resources that could assist me in ensuring C++ compatibility with CCS, I would greatly appreciate it.

#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;
}
Error: <Linking>
"syscfg/device_cmd.cmd", line 77: error #10099-D: program will not fit into available memory, or the section contains a call site that requires a trampoline that can't be generated for this section. run placement with alignment/blocking fails for section ".sysmem" size 0x1024 page 0. Available memory ranges:
RAMLS5 size: 0x800 unused: 0x143 max hole: 0x143
"syscfg/device_cmd.cmd", line 71: error #10099-D: program will not fit into available memory, or the section contains a call site that requires a trampoline that can't be generated for this section. run placement with alignment/blocking fails for section ".stack" size 0x1024 page 0. Available memory ranges:
RAMM1 size: 0x3f8 unused: 0x3f8 max hole: 0x3f8
"syscfg/device_cmd.cmd", line 68: error #10099-D: program will not fit into available memory, or the section contains a call site that requires a trampoline that can't be generated for this section. placement with alignment/blocking fails for section ".text" size 0x323d page 0. Available memory ranges:
RAMLS0 size: 0x800 unused: 0x0 max hole: 0x0
RAMLS1 size: 0x800 unused: 0x0 max hole: 0x0
RAMLS2 size: 0x800 unused: 0x0 max hole: 0x0
RAMLS3 size: 0x800 unused: 0x0 max hole: 0x0
RAMLS4 size: 0x800 unused: 0x0 max hole: 0x0
error #10010: errors encountered during linking; "led_ex1_blinky.out" not built
  • Hello Asim,

    Apologies for the delay. In terms of C/C++ code optimization in general, we do have an app note providing some detail/suggestions: https://www.ti.com/lit/ug/spru514z/spru514z.pdf 

    Based on the program memory errors, this likely requires some modification within your Linker Command file, so I will loop in the correct expert to provide guidance.

    Best Regards,

    Allison

  • Hello Asim,

    Looks like you ran out of the LSRAM which is being used to allocate the section .sysmem, stack,.text etc. You may need to use use a different RAM with sufficient memory available to allocate those sections. You can check the .map file to know which RAM regions have unused memory.

    Also, please enable the following flags, if not already enabled. This helps in better memory allocation

    Regards,

    Veena