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: How do I tell the linker to place one specific object module at a specifice location in my flash.

Tool/software: Code Composer Studio

Assume x.obj is a group of functions that require a 3K space in flash. I want to place his module and all the functions contained in it to exist in this section and starting at for example, address of 0xA000. I don't want any code in this object module to be placed in any other sections or any code that is not in this object file to be placed in the section.  I suspect this is a .cmd file operation with a #pragma reference at the beginning of the specific C module that I want to locate at an absolute address. I believe the linker wants to put the active program code in the .text section. I can add a memory area like the "FLASH" in the .cmd file and add a section My_Area in the sections definition but I don't know where and how to tell the linker to put x.obj in that section. I am also not sure that there is not a better way that I have missed.  In assembly this might be an ORGIN definition but what is the equivalent in 'C'?

  • First, please become familiar with your current linker command file by reading the first half of the wiki article Linker Command File Primer.

    With that understanding now in place, add a line similar to this in your linker command file ...

        output_section_name { x.obj(.text) } > 0xA000

    That creates an output section named output_section_name.  It is made up of one input section, the .text section from the file x.obj.  This output section is allocated to the address 0xA000.

    Thanks and regards,

    -George