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.

CL2000 partial linking issue regarding section size

Other Parts Discussed in Thread: CONTROLSUITE

It seems to me there might be a "less-than instead of less-than-or-equal" bug in the linker (cl2000 v6.2.1) when it locates memory and verifies section size. This issue only appears when the doing a partial linking (using option -r) before making the executable.

Simplified example:

In the .cmd file (F2806x_Headers_nonBIOS.cmd) I have:

      SYSTEM      : origin = 0x007010, length = 0x000030     /* System Control Registers */

which is used for memory mapping the struct SysCtrlRegs where sizeof(SysCtrlRegs) = 0x30. So we have a perfect fit (i.e. full usage).

 

Compiling to an object file (-c) and then do the final linking works fine.

Compiling to an object file (-c), do a partial linking (-r) and then do the final linking issues the error (in the final step):

"F2806x_Headers_nonBIOS.cmd", line 159: error:    program will not fit into available memory.  run placement with    alignment/blocking fails for section "SysCtrlRegsFile" size 0x30 page 1.   

Available memory ranges:    SYSTEM       size: 0x30         unused: 0x30         max hole: 0x30

 

The reason why I think it is related to a "less-than" check, is that if I change the line in the command file to this:

      SYSTEM      : origin = 0x007010, length = 0x000031     /* System Control Registers */

(i.e. length is increased by 1), then the final linking work fine.

Hope this example and information will be sufficient to address the issue.

  • I presume the section SysCtrlRegsFile comes from a single source file.  I wonder what happens to that section during the partial link, and whether that might be the cause.  Suppose SysCtrlRegsFile is defined in the source file example.asm, and that the name of the output file created by the partial link is partial.out.  The OFD utility dumps out lots of information about object and out files.  Please run these commands and post the results ...

    % ofd2000 -v example.obj > before.txt
    % ofd2000 -v partial.out > after.txt

    Thanks and regards,

    -George

  • Hi George,

    Thanks for quick reply.

    Some more details: I have reduced my project to two source files. One is dummy.c containing only this:

    int main(int argc, char **argv)
    {
       
    return 0;
    }

    The other is F2806x_GlobalVariableDefs.c included from the support library of Control Suite (c:\ti\controlSUITE\device_support\f2806x\v136\F2806x_headers\source\F2806x_GlobalVariableDefs.c)

    The ofd output from the compiled F2806x_GlobalVariableDefs.c is attached as before.txt.

    I have linked the two object files partially (-r option) like this (stripped paths, though):

     

    cl2000 -v28 -z -r -ml -mt --stack_size=0x300 F2806x_GlobalVariableDefs.o dummy.o -o result.o

     

    The ofd output from result.o is attached as after.txt

    To make the executable I use two example .cmd files also from Control Suite:

    c:\ti\controlSUITE\device_support\f2806x\v136\F2806x_headers\cmd\F2806x_Headers_nonBIOS.cmd

    c:\ti\controlSUITE\device_support\f2806x\v136\F2806x_common\cmd\28069_RAM_lnk.cmd

    and call

    cl2000 -v28 -z -ml -mt --stack_size=0x300 --warn_sections -i c2000_6.1.0/lib  --reread_libs --rom_model -m=final.map 28069_RAM_lnk.cmd F2806x_Headers_nonBIOS.cmd result.o -l libc.a -o final.out

    See the error output in attached file linker-err.txt

    To solve my problem I have skipped the partial link stage and moved forward, so this post is just to inform you of the issue I ran into.

    Best regards,

    Flemming

    6746.before.txt

    0827.after.txt

    <Linking>
    "F2806x_Headers_nonBIOS.cmd", line 159: error:
       program will not fit into available memory.  run placement with
       alignment/blocking fails for section "SysCtrlRegsFile" size 0x30 page 1.
       Available memory ranges:
       SYSTEM       size: 0x30         unused: 0x30         max hole: 0x30
    "F2806x_Headers_nonBIOS.cmd", line 146: error:
       program will not fit into available memory.  run placement with
       alignment/blocking fails for section "ECap2RegsFile" size 0x20 page 1.
       Available memory ranges:
       ECAP2        size: 0x20         unused: 0x20         max hole: 0x20
    "F2806x_Headers_nonBIOS.cmd", line 152: error:
       program will not fit into available memory.  run placement with
       alignment/blocking fails for section "GpioIntRegsFile" size 0x20 page 1.
       Available memory ranges:
       GPIOINT      size: 0x20         unused: 0x20         max hole: 0x20
    "F2806x_Headers_nonBIOS.cmd", line 154: error:
       program will not fit into available memory.  run placement with
       alignment/blocking fails for section "HRCap2RegsFile" size 0x20 page 1.
       Available memory ranges:
       HRCAP2       size: 0x20         unused: 0x20         max hole: 0x20
    "F2806x_Headers_nonBIOS.cmd", line 156: error:
       program will not fit into available memory.  run placement with
       alignment/blocking fails for section "HRCap4RegsFile" size 0x20 page 1.
       Available memory ranges:
       HRCAP4       size: 0x20         unused: 0x20         max hole: 0x20
    "F2806x_Headers_nonBIOS.cmd", line 164: error:
       program will not fit into available memory.  run placement with
       alignment/blocking fails for section "NmiIntruptRegsFile" size 0x10 page 1.
       Available memory ranges:
       NMIINTRUPT   size: 0x10         unused: 0x10         max hole: 0x10
    "F2806x_Headers_nonBIOS.cmd", line 162: error:
       program will not fit into available memory.  run placement with
       alignment/blocking fails for section "SciaRegsFile" size 0x10 page 1.
       Available memory ranges:
       SCIA         size: 0x10         unused: 0x10         max hole: 0x10
    "F2806x_Headers_nonBIOS.cmd", line 163: error:
       program will not fit into available memory.  run placement with
       alignment/blocking fails for section "ScibRegsFile" size 0x10 page 1.
       Available memory ranges:
       SCIB         size: 0x10         unused: 0x10         max hole: 0x10
    "F2806x_Headers_nonBIOS.cmd", line 165: error:
       program will not fit into available memory.  run placement with
       alignment/blocking fails for section "XIntruptRegsFile" size 0x10 page 1.
       Available memory ranges:
       XINTRUPT     size: 0x10         unused: 0x10         max hole: 0x10
    "F2806x_Headers_nonBIOS.cmd", line 133: error:
       program will not fit into available memory.  run placement with
       alignment/blocking fails for section "CpuTimer1RegsFile" size 0x8 page 1.
       Available memory ranges:
       CPU_TIMER1   size: 0x8          unused: 0x8          max hole: 0x8
    "F2806x_Headers_nonBIOS.cmd", line 134: error:
       program will not fit into available memory.  run placement with
       alignment/blocking fails for section "CpuTimer2RegsFile" size 0x8 page 1.
       Available memory ranges:
       CPU_TIMER2   size: 0x8          unused: 0x8          max hole: 0x8
    "F2806x_Headers_nonBIOS.cmd", line 185: error:
       program will not fit into available memory.  run placement with
       alignment/blocking fails for section "CsmPwlFile" size 0x8 page 1.
       Available memory ranges:
       CSM_PWL      size: 0x8          unused: 0x8          max hole: 0x8
    "F2806x_Headers_nonBIOS.cmd", line 128: error:
       program will not fit into available memory.  run placement with
       alignment/blocking fails for section "SysPwrCtrlRegsFile" size 0x3 page 1.
       Available memory ranges:
       SYS_PWR_CTL   size: 0x3          unused: 0x3          max hole: 0x3
    "F2806x_Headers_nonBIOS.cmd", line 135: error:
       program will not fit into available memory.  run placement with
       alignment/blocking fails for section "PieCtrlRegsFile" size 0x1a page 1.
       Available memory ranges:
       PIE_CTRL     size: 0x20         unused: 0x20         max hole: 0x20
    "F2806x_Headers_nonBIOS.cmd", line 171: error:
       program will not fit into available memory.  run placement with
       alignment/blocking fails for section "Comp2RegsFile" size 0x14 page 1.
       Available memory ranges:
       COMP2        size: 0x20         unused: 0x20         max hole: 0x20
    "F2806x_Headers_nonBIOS.cmd", line 130: error:
       program will not fit into available memory.  run placement with
       alignment/blocking fails for section "CsmRegsFile" size 0x10 page 1.
       Available memory ranges:
       CSM          size: 0x20         unused: 0x20         max hole: 0x20
    error: errors encountered during linking;
    

  • You are experiencing a variation of the problem described in this wiki article.  On the first link, everything works fine.  The section SysCtrlRegsFile is blocked with no problems.  But coming out of that link, SysCtrlRegsFile is no longer a blocked section.  Now it is bound to an address, and the alignment is 64 words.  That's how blocking works.  The linker allocates the section such that it crosses no 64-word boundary.  If the section is larger than 64 words, it aligns it to a 64-word boundary.  Once all that is complete, the section is marked for 64 word alignment.  On the second link, SysCtrlRegsFile can only be placed at a 64 word address.  That's why you see the error diagnostic.

    Thanks and regards,

    -George

  • Hi George,

    Again thanks for your feedback.

    I was not aware of the DP and related constraints. If I understand it correctly, operating with sections less than 64 words in the .cmd file is not advisable when using partial linking.

    I will have this in mind when I create my own .cmd file.

    /Flemming