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.

CCS/TMS320DM6437: How to import a bin file as source in CCS project

Part Number: TMS320DM6437

Tool/software: Code Composer Studio

I want to import a bin file as the source in project.  And don't want to convert it as a C array.  There is any others ways?

In ARM , I know the INCBIN can do. And in DSP, How could I do?

  • Hi,

    CCS does not treat files in raw binary data format as part of the source code. In this case, you will have to forcefully convert it to a "C" array or use one of the console File I/O routines to get it to read from the host PC. Sorry.

    Regards,
    Rafael
  • Enhancement request SDSCM00043204 "Copy user supplied binary file directly into the output executable" was raised in response to the previous thread placing binary resources in the linked executable. However, SDSCM00043204 has not yet been implemented.

  • zhenhong said:
    There is any others ways?

    The GCC objcopy program can can convert a binary file into an ELF object file. I found that the gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-objcopy supplied with CCS 9 can create an object file from a binary file, such that the generated object file is accepted by the TI C6000 linker provided the machine in the generated ELF file is set to that for "TI C6x".

    The command to create an ELF object file from a binary input file is of the the form:

    arm-none-eabi-objcopy --alt-machine-code=140 --input-target=binary --output-target=elf32-little <binary_filename> <object_filename>

    Where the --alt-machine-code value of 140 is that for "TI C6x".

    If your DSP is big-endian use --output-target=elf32-big instead of --output-target=elf32-little

    The binary data can be accessed by a program using the referencing following special symbols which are in the object file:

    _binary_<binary_filename>_start
    _binary_<binary_filename>_end
    _binary_<binary_filename>_size

    The attached example project created using CCS 9 has a pre-build step which use runs arm-none-eabi-objcopy to convert a binary file into an object which is linked into a program for a C66 DSP. For this example the "binary" file is the source file, which displays its contents when run.

    66AK2H14_link_binary_blob.zip