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.

CC2640R2F: simple_peripheral_oad_onchip example linker error (program will not fit)

Part Number: CC2640R2F
Other Parts Discussed in Thread: SYSBIOS

Hello,

i am trying to build the oad_target_cc2640r2lp_app project from the simple_peripheral_oad_onchip example. The linker gives the error "C:/ti/simplelink_cc2640r2_sdk_1_30_00_25/source/ti/blestack/common/cc26xx/ccs/cc26xx_app_oad_onchip.cmd", line 255: error #10099-D: program will not fit into available memory.  placement with alignment fails for section ".text" size 0x5b36 "

My setup:

Fresh installed CCS 7.1.0.00015 and simplelink_cc2640r2_sdk_1_30_00_25 SDK.
TI ARM Compiler 16.9.0
XDC Tools 3.50.00.10

For testing i have increased the size for the image A in cc26xx_app_oad_onchip.cmd to 8 flash pages:

#define FLASH_IMG_A_END          (FLASH_START + (PAGE_SIZE * 8))

Now the build succeeds. Looking at the map file i see

.
.
00001328    00001328    00000004   00000004    r-- .const:ti_sysbios_rom_ROM_xdc_runtime_System_SupportProxy_abort__E
0000132c    0000132c    00000004   00000004    r-- .const:ti_sysbios_rom_ROM_xdc_runtime_System_SupportProxy_exit__E
00001330    00001330    00005cf8   00005cf8    r-x .text

So the .text section starts at 1330 and ends at 7028 which is 29 bytes over the original limit of 7 flash pages.

One strange thing is that at the beginning of the map file i see:

00000010    00000010    00000704   00000704    r--
  00000010    00000010    0000003c   0000003c    r-- .resetVecs
  0000004c    0000004c    0000037c   0000037c    r-- .const
  000003c8    000003c8    0000034c   0000034c    r-- .cinit
00001000    00001000    00006028   00006028    r-x
  00001000    00001000    00000028   00000028    r-- .const:ti_sysbios_heaps_HeapMem_Module__FXNS__C
  00001028    00001028    00000024   00000024    r-- .const:ti_sysbios_gates_GateHwi_Module__FXNS__C

There is an unused hole between .cinit and ti_sysbios_heaps_HeapMem_Module__FXNS__C. It looks like the ti_sysbios_heaps_HeapMem_Module__FXNS__C is aligned to a flash boundery but i can not find where this is commanded.

Any ideas what goes wrong?

Please find build log and map file attached.0167.build.logoad_target_cc2640r2lp_app_map.txt

  • Hi Christian,

    Looks like this issue is due to the linker command file telling the linker to only place the .text in a contiguous space that can contain all of it.

    This is why it completely ignore the space you pointed out (among other gaps)

    The work around for this is to modify the linker command file to tell the linker that it's ok to break up the .text block to make it fit:

    This means changing:

    .text : > FLASH

    to

    .text : >> FLASH

    Hope this helps,
    Rebel
  • Hi Rebel,

    yes changing the command file solved the problem. Thanks!

    Shouldn't this work out of the box? This is an unmodified TI example!

    Best regards

    Christian

  • Yeah! It should, it seems the original intent was to use the default linker command file for cc2640r2 apps, which does include '>>' for .text section.

    Either way, I'll be adding this to the wiki/guide.

    Thanks!
    Rebel