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.

C2000WARE: Constant string not generating in from out file to Bin file

Part Number: C2000WARE

Hi ,

 

i am using below command for generating bin file in CCS , Now i need to implement to check bin file inside some constant string to indentify the proper bin file .

#pragma RETAIN(MCU_IDENTIFICATION)
#pragma DATA_SECTION(MCU_IDENTIFICATION, ".mcu_id")
const char MCU_IDENTIFICATION[] = "Main_V1.0_MCU";

using this cmd in main i can able to generate the string in out file but its not generating in bin file using below mentioned commend .

${CCE_INSTALL_ROOT}/utils/tiobj2bin/tiobj2bin.bat ${BuildArtifactFileName} ${BuildArtifactFileBaseName}.bin ${CG_TOOL_ROOT}/bin/ofd2000.exe ${CG_TOOL_ROOT}/bin/hex2000.exe ${CCE_INSTALL_ROOT}/utils/tiobj2bin/mkhex4bin.exe

 

So kindly suggest some method to generate string in bin file .

Regrads,

Subash 

  • Hi Subash,

    Thank you for your patience on this issue and I am sorry for the late reply. 

    The core issue is that even though
    #pragma RETAIN prevents the linker from discarding the section, hex2000 (used internally by tiobj2bin) only converts sections that are explicitly mapped to a memory region in the linker command file (.cmd). If .mcu_id has no memory address assigned, it won't appear in the .bin output. Can you create a dedicated section for .mcu_id and map it to some region in the memory via the .cmd file. Refer below

    MEMORY

    { /* your existing regions ... */

    MCU_ID_MEM : origin = 0x3F8000, length = 0x20 /* Adjust address to fit your device's FLASH */ }

    SECTIONS

    { /* your existing sections ... */

    .mcu_id : > MCU_ID_MEM }

    Choose an origin address that falls within your device's valid FLASH memory range and does not overlap with other sections. Adjust length to fit your string size.

    After building, run this command to confirm the string is embedded:

    # On Windows (PowerShell) Select-String -Path "yourfile.bin" -Pattern "Main_V1.0_MCU" -Encoding Byte # On Linux/Git Bash strings yourfile.bin | grep "Main_V1.0_MCU"

  • Hi Subash,

    Were you able to try this?

    Thanks,

    Ira