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/TMS320F28335: Locating a function interface at fixed address

Part Number: TMS320F28335

Tool/software: TI C/C++ Compiler

Suppose I have the following function:
  #pragma CODE_SECTION(funcA,"funcA_Section")
  int funcA( int k, struct XX *x )
  { /* lots of code */ }

In the linker command file I can create the section, with enough space to hold the function, and all is OK.
But if the size of the function is unknown or likely to grow, I either have to allocate a large amount of memory for the function, or risk having to move it or other code.  

Is there a smart way to a place the interface at a fixed location, but let the linker sort out the body?

This would work, but the double function call is inefficient.
  #pragma CODE_SECTION(funcA,"funcA_Section")
  int funcA( int k, struct XX *x )
  {
     return funcA_2( k, x );
  }

I was wondering about
  #pragma CODE_SECTION(funcA,"funcA_Section")
  int funcA( int k, struct XX *x )
  {
    asm("  LB  funcA_2");
  }
But I can't think how to create funcA_2 in this case.
Any ideas?

Thanks.

  • Please try a technique similar to First Output Section in a Memory Range.  

    Try this in the linker command file, within the SECTIONS directive ...

        funcA_Section > 0x6000 /* or whatever address is desired */

    This says to collect all the input sections named funcA_Section (in this case, there is only one) into an output section that is also named funcA_Section.  Allocate that output section to the hard-coded address 0x6000.  Other output sections get allocated around it.

    Thanks and regards,

    -George