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.

Compiler/C6000-CGT: objcopy like tool for C6000

Part Number: C6000-CGT

Tool/software: TI C/C++ Compiler

Hi,

I use Utimaco's CryptoServer (LAN V5) HSM which uses TI's C6000 toolchain for compilation. I have a requirement to modify the generated .out file. I am looking for objcopy like tool to modify one of the sections. Here is a GCC equivalent of what I would like to perform,

$ cat hello.c

#include <stdio.h>

int moduleID __attribute__(( section("edithere") )) = 0;

int main(int argc, char** argv) {

    printf("moduleID is %d\n", moduleID);

    return 0;

}

$ gcc hello.c

$ ./a.out

moduleID is 0

$ objcopy --dump-section edithere=edithere.bin a.out

$ hexdump -C edithere.bin

00000000  00 00 00 00                                       |....|

$ printf "\x7f\x00\x00\x00" > edithere.bin

$ objcopy --update-section edithere=edithere.bin a.out

$ ./a.out

moduleID is 127

I looked into radare2 and surprisingly it doesn't seem to recognize TI COFF2 format. Could you please let me know how can I perform the same using C6000 tools?

Thanks,

Krishnan

  • Unfortunately, there is no objcopy like tool.  

    There is a utility for creating a binary image file named tiobj2bin.  It is part of the Code Generation Tools XML Processing Utilities.  It is similar to this objcopy command ...

    objcopy -O binary ti_executable.out binary_image.bin

    There are two variants of the utility.  tiobj2bin.bat is a Windows batch file.  And tiobj2bin is a bash shell script.  Read through those files to see how they work.  You will see it depends on yet other utilities from TI: ofd6x and hex6x.  These utilities are documented in the C6000 assembly tools manual.

    I'm surprised to see a mention of ...

    Saravanakrishnan Krishnamoorthy1 said:
    TI COFF2 format

    The C6000 compiler tools stopped support for COFF a few years ago.  All recent development uses ELF object file format.

    Thanks and regards,

    -George