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.