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/LAUNCHXL-F28027F: linker garbage collector in CCS ?

Part Number: LAUNCHXL-F28027F
Other Parts Discussed in Thread: TMS320F280200, TMS320F28027F, MOTORWARE, C2000WARE

Tool/software: Code Composer Studio

Hi

I am trying to adapt (Arduino u8g2 library to F28027F)

https://github.com/blotfi/c2000_u8g2

original library : https://github.com/olikraus/u8g2

It compiles, but I run into not enough memory problems ! (look to oled27f.txt)

so, olikraus suggested to use the so called linker garbage collector

https://github.com/olikraus/u8g2/issues/549#issuecomment-385230689

Can you show me this option in CCS

thanks

  • Lotfi said:
    so, olikraus suggested to use the so called linker garbage collector

    The equivalent options under CCS are to set the "Place each function in a separate subsection (--gen_func_subsections,-mo)" and "Place structs and arrays in separate subsections (--gen_data_subsections)" Runtime Model Options to on:

    Lotfi said:
    It compiles, but I run into not enough memory problems ! (look to (Please visit the site to view this file))

    Looking at the linker map file see two problems:

    1. Have selected a TMS320F280200 device (8K word of flash and 3K words of SARAM) which has less memory than the actual TMS320F28027F (64K words of flash and 12K words of SARAM) on the LAUNCHXL-F28027F.

    2. The .ebss.1 section which failed to allocate requires 107274 words of SARAM which is > 8 times the available SARAM on a TMS320F28027F.

    Therefore, either after correcting the device in the CCS project to a TMS320F28027F and enabling the "linker garbage collector" suspect the program won't fit.

  • thanks
    where can I specify in the CCS project 27F ?

    Also the arduino nano

    Flash  32k bytes (of which .5k is used for the bootloader)
    SRAM   2k bytes
    fit a similar program !
    So there is a matter of optimisation somewhere

  • Lotfi said:
    where can I specify in the CCS project 27F ?

    The device is specified on the General CCS properties.

  • I have this

    but it gave the map you saw

  • Also, Olikraus mentioned:

    U8g2 depends a lot on link time optimization. This means, that unused functions and unused data objects are removed. This did not happen during linking with your environment.
    For gcc this is available (so called linker garbage collector) and this is also default for Arduino Environment. 

  • now with optimisation level 4 to size (0) and not speed

    I have better results, it only complies about :

    #10247-D creating output section ".cio" without a SECTIONS specification oled27f C/C++ Problem

    ******************************************************************************
    TMS320C2000 Linker PC v16.9.3
    ******************************************************************************
    >> Linked Sun Apr 29 20:19:26 2018

    OUTPUT FILE NAME: <oled27f.out>
    ENTRY POINT SYMBOL: "_c_int00" address: 003f76cf


    MEMORY CONFIGURATION

    name origin length used unused attr fill
    ---------------------- -------- --------- -------- -------- ---- --------
    PAGE 0:
    RAMM0 00000050 000003b0 00000004 000003ac RWIX
    OTP 003d7800 00000400 00000000 00000400 RWIX
    FLASHB 003f6000 00001000 0000010f 00000ef1 RWIX
    FLASHA 003f7000 00000f80 00000f7e 00000002 RWIX
    CSM_RSVD 003f7f80 00000076 00000000 00000076 RWIX
    BEGIN 003f7ff6 00000002 00000002 00000000 RWIX
    CSM_PWL_P0 003f7ff8 00000008 00000000 00000008 RWIX
    IQTABLES 003fe000 00000b50 00000000 00000b50 RWIX
    IQTABLES2 003feb50 0000008c 00000000 0000008c RWIX
    IQTABLES3 003febdc 000000aa 00000000 000000aa RWIX
    ROM 003ff27c 00000d44 00000000 00000d44 RWIX
    RESET 003fffc0 00000002 00000000 00000002 RWIX
    VECTORS 003fffc2 0000003e 00000000 0000003e RWIX

    PAGE 1:
    BOOT_RSVD 00000000 00000050 00000000 00000050 RWIX
    RAMM1 00000400 00000400 00000400 00000000 RWIX
    DEV_EMU 00000880 00000105 00000004 00000101 RWIX
    SYS_PWR_CTL 00000985 00000003 00000003 00000000 RWIX
    FLASH_REGS 00000a80 00000060 00000008 00000058 RWIX
    CSM 00000ae0 00000010 00000010 00000000 RWIX
    ADC_RESULT 00000b00 00000020 00000020 00000000 RWIX
    CPU_TIMER0 00000c00 00000008 00000008 00000000 RWIX
    CPU_TIMER1 00000c08 00000008 00000008 00000000 RWIX
    CPU_TIMER2 00000c10 00000008 00000008 00000000 RWIX
    PIE_CTRL 00000ce0 00000020 0000001a 00000006 RWIX
    PIE_VECT 00000d00 00000100 00000100 00000000 RWIX
    COMP1 00006400 00000020 00000020 00000000 RWIX
    COMP2 00006420 00000020 00000020 00000000 RWIX
    EPWM1 00006800 00000040 00000040 00000000 RWIX
    EPWM2 00006840 00000040 00000040 00000000 RWIX
    EPWM3 00006880 00000040 00000040 00000000 RWIX
    EPWM4 000068c0 00000040 00000040 00000000 RWIX
    ECAP1 00006a00 00000020 00000020 00000000 RWIX
    GPIOCTRL 00006f80 00000040 00000040 00000000 RWIX
    GPIODAT 00006fc0 00000020 00000020 00000000 RWIX
    GPIOINT 00006fe0 00000020 0000000a 00000016 RWIX
    SYSTEM 00007010 00000020 0000001f 00000001 RWIX
    SPIA 00007040 00000010 00000010 00000000 RWIX
    SCIA 00007050 00000010 00000010 00000000 RWIX
    NMIINTRUPT 00007060 00000010 00000010 00000000 RWIX
    XINTRUPT 00007070 00000010 00000010 00000000 RWIX
    ADC 00007100 00000080 00000051 0000002f RWIX
    I2CA 00007900 00000040 00000022 0000001e RWIX
    RAML0 00008000 00000400 00000400 00000000 RWIX
    PARTID 003d7fff 00000001 00000001 00000000 RWIX
    CSM_PWL 003f7ff8 00000008 00000008 00000000 RWIX


    SECTION ALLOCATION MAP

    output attributes/
    section page origin length input sections
    -------- ---- ---------- ---------- ----------------
    .cio 0 00000000 00000120 FAILED TO ALLOCATE
    .ebss.1 0 00000000 00000120 FAILED TO ALLOCATE
    .econst.1
    * 0 003f6000 00000086
    003f6000 00000035 u8x8_d_ssd1306_128x64_noname.obj (.econst:.string:_u8x8_d_ssd1306_128x64_noname_init_seq$47)
    003f6035 00000001 --HOLE-- [fill = 0]
    003f6036 00000014 u8x8_d_ssd1306_128x64_noname.obj (.econst:_u8x8_ssd1306_128x64_noname_display_info$47)
    003f604a 00000010 <whole-program> (.econst)
    003f605a 0000000b <whole-program> (.econst:.string)
    003f6065 00000007 u8x8_d_ssd1306_128x64_noname.obj (.econst:.string:_u8x8_d_ssd1306_128x64_noname_flip0_seq$47)
    003f606c 00000007 u8x8_d_ssd1306_128x64_noname.obj (.econst:.string:_u8x8_d_ssd1306_128x64_noname_flip1_seq$47)
    003f6073 00000005 u8x8_d_ssd1306_128x64_noname.obj (.econst:.string:_u8x8_d_ssd1306_128x64_noname_powersave0_seq$47)
    003f6078 00000005 u8x8_d_ssd1306_128x64_noname.obj (.econst:.string:_u8x8_d_ssd1306_128x64_noname_powersave1_seq$47)
    003f607d 00000001 --HOLE-- [fill = 0]
    003f607e 00000004 u8g2_setup.obj (.econst:_u8g2_cb_r0)
    003f6082 00000004 rts2800_ml.lib : s_scalbn.obj (.econst)

    .cinit 0 003f6086 00000089
    003f6086 0000006f <whole-program> (.cinit)
    003f60f5 0000000e rts2800_ml.lib : exit.obj (.cinit)
    003f6103 00000005 <whole-program> (.cinit:__lock)
    003f6108 00000005 <whole-program> (.cinit:__unlock)
    003f610d 00000002 --HOLE-- [fill = 0]

    ramfuncs 0 003f7000 00000004 RUN ADDR = 00000050
    003f7000 00000004 f2802x_usdelay.obj (ramfuncs)

    .text 0 003f7004 00000e79
    003f7004 000001a5 rts2800_ml.lib : trgdrv.obj (.text)
    003f71a9 00000107 : ll_div28.obj (.text)
    .......

    )
    003f7cf5 0000000e u8g2_d_setup.obj (.text:_u8g2_Setup_ssd1306_i2c_128x64_noname_1)
    003f7d03 0000000e rts2800_ml.lib : fd_sub28.obj (.text)
    003f7d11 0000000c : epilog28.obj (.text)
    003f7d1d 0000000a u8x8_byte.obj (.text:_u8x8_byte_SendByte)
    003f7d27 00000009 rts2800_ml.lib : fd_neg28.obj (.text)
    003f7d30 00000008 f2802x_sysctrl.obj (.text:_DisableDog)
    003f7d38 00000008 f2802x_codestartbranch.obj (.text)
    003f7d40 00000007 u8x8_byte.obj (.text:_u8x8_byte_EndTransfer)
    003f7d47 00000007 u8x8_byte.obj (.text:_u8x8_byte_StartTransfer)
    003f7d4e 00000006 u8x8_byte.obj (.text:_u8x8_byte_SendBytes)
    003f7d54 00000006 u8x8_cad.obj (.text:_u8x8_cad_EndTransfer)
    003f7d5a 00000006 u8x8_cad.obj (.text:_u8x8_cad_SendArg)
    003f7d60 00000006 u8x8_cad.obj (.text:_u8x8_cad_SendCmd)
    003f7d66 00000006 u8x8_cad.obj (.text:_u8x8_cad_StartTransfer)
    003f7d6c 00000005 f2802x_defaultisr.obj (.text:_ADCINT1_ISR)
    003f7d71 00000005 f2802x_defaultisr.obj (.text:_ADCINT2_ISR)
    003f7d76 00000005 f2802x_defaultisr.obj (.text:_ADCINT3_ISR)
    003f7d7b 00000005 f2802x_defaultisr.obj (.text:_ADCINT4_ISR)
    003f7d80 00000005 f2802x_defaultisr.obj (.text:_ADCINT5_ISR)
    003f7d85 00000005 f2802x_defaultisr.obj (.text:_ADCINT6_ISR)
    003f7d8a 00000005 f2802x_defaultisr.obj (.text:_ADCINT7_ISR)
    003f7d8f 00000005 f2802x_defaultisr.obj (.text:_ADCINT8_ISR)
    003f7d94 00000005 f2802x_defaultisr.obj (.text:_ADCINT9_ISR)
    003f7d99 00000005 f2802x_defaultisr.obj (.text:_DATALOG_ISR)
    003f7d9e 00000005 f2802x_defaultisr.obj (.text:_ECAP1_INT_ISR)
    003f7da3 00000005 f2802x_defaultisr.obj (.text:_EMPTY_ISR)
    003f7da8 00000005 f2802x_defaultisr.obj (.text:_EMUINT_ISR)
    003f7dad 00000005 f2802x_defaultisr.obj (.text:_EPWM1_INT_ISR)
    003f7db2 00000005 f2802x_defaultisr.obj (.text:_EPWM1_TZINT_ISR)
    003f7db7 00000005 f2802x_defaultisr.obj (.text:_EPWM2_INT_ISR)
    003f7dbc 00000005 f2802x_defaultisr.obj (.text:_EPWM2_TZINT_ISR)
    003f7dc1 00000005 f2802x_defaultisr.obj (.text:_EPWM3_INT_ISR)
    003f7dc6 00000005 f2802x_defaultisr.obj (.text:_EPWM3_TZINT_ISR)
    003f7dcb 00000005 f2802x_defaultisr.obj (.text:_EPWM4_INT_ISR)
    003f7dd0 00000005 f2802x_defaultisr.obj (.text:_EPWM4_TZINT_ISR)
    003f7dd5 00000005 f2802x_defaultisr.obj (.text:_I2CINT1A_ISR)
    003f7dda 00000005 f2802x_defaultisr.obj (.text:_I2CINT2A_ISR)
    003f7ddf 00000005 f2802x_defaultisr.obj (.text:_ILLEGAL_ISR)
    003f7de4 00000005 f2802x_defaultisr.obj (.text:_INT13_ISR)
    003f7de9 00000005 f2802x_defaultisr.obj (.text:_INT14_ISR)
    003f7dee 00000005 f2802x_defaultisr.obj (.text:_NMI_ISR)
    003f7df3 00000005 f2802x_defaultisr.obj (.text:_PIE_RESERVED)
    003f7df8 00000005 f2802x_defaultisr.obj (.text:_RTOSINT_ISR)
    003f7dfd 00000005 f2802x_defaultisr.obj (.text:_SCIRXINTA_ISR)
    003f7e02 00000005 f2802x_defaultisr.obj (.text:_SCITXINTA_ISR)
    003f7e07 00000005 f2802x_defaultisr.obj (.text:_SPIRXINTA_ISR)
    003f7e0c 00000005 f2802x_defaultisr.obj (.text:_SPITXINTA_ISR)
    003f7e11 00000005 f2802x_defaultisr.obj (.text:_TINT0_ISR)
    003f7e16 00000005 f2802x_defaultisr.obj (.text:_USER10_ISR)
    003f7e1b 00000005 f2802x_defaultisr.obj (.text:_USER11_ISR)
    003f7e20 00000005 f2802x_defaultisr.obj (.text:_USER12_ISR)
    003f7e25 00000005 f2802x_defaultisr.obj (.text:_USER1_ISR)
    003f7e2a 00000005 f2802x_defaultisr.obj (.text:_USER2_ISR)
    003f7e2f 00000005 f2802x_defaultisr.obj (.text:_USER3_ISR)
    003f7e34 00000005 f2802x_defaultisr.obj (.text:_USER4_ISR)
    003f7e39 00000005 f2802x_defaultisr.obj (.text:_USER5_ISR)
    003f7e3e 00000005 f2802x_defaultisr.obj (.text:_USER6_ISR)
    003f7e43 00000005 f2802x_defaultisr.obj (.text:_USER7_ISR)
    003f7e48 00000005 f2802x_defaultisr.obj (.text:_USER8_ISR)
    003f7e4d 00000005 f2802x_defaultisr.obj (.text:_USER9_ISR)
    003f7e52 00000005 f2802x_defaultisr.obj (.text:_WAKEINT_ISR)
    003f7e57 00000005 f2802x_defaultisr.obj (.text:_XINT1_ISR)
    003f7e5c 00000005 f2802x_defaultisr.obj (.text:_XINT2_ISR)
    003f7e61 00000005 f2802x_defaultisr.obj (.text:_XINT3_ISR)
    003f7e66 00000005 f2802x_defaultisr.obj (.text:_rsvd_ISR)
    003f7e6b 00000005 u8x8_cad.obj (.text:_u8x8_cad_SendData)
    003f7e70 00000005 u8x8_gpio.obj (.text:_u8x8_gpio_call)
    003f7e75 00000002 u8g2_font.obj (.text:_u8g2_font_calc_vref_font)
    003f7e77 00000002 u8x8_setup.obj (.text:_u8x8_dummy_cb)
    003f7e79 00000002 rts2800_ml.lib : pre_init.obj (.text)
    003f7e7b 00000001 : _lock.obj (.text)
    003f7e7c 00000001 : startup.obj (.text)

    .econst.2
    * 0 003f7e7e 00000101
    003f7e7e 00000100 f2802x_pievect.obj (.econst:_PieVectTableInit)
    003f7f7e 00000001 u8x8_cad.obj (.econst)

    codestart
    * 0 003f7ff6 00000002
    003f7ff6 00000002 f2802x_codestartbranch.obj (codestart)

    .stack 1 00000400 00000200 UNINITIALIZED
    00000400 00000200 --HOLE--

    .ebss.2 1 00000600 00000200 UNINITIALIZED
    00000600 00000160 rts2800_ml.lib : defs.obj (.ebss)
    00000760 00000020 oled.obj (.ebss:_buffer$1$2)
    00000780 00000080 u8g2_d_memory.obj (.ebss:_buf$4$8)

    DevEmuRegsFile
    * 1 00000880 00000004 UNINITIALIZED
    00000880 00000004 F2802x_GlobalVariableDefs.obj (DevEmuRegsFile)

    ...............

    ...............

    I2caRegsFile
    * 1 00007900 00000022 UNINITIALIZED
    00007900 00000022 F2802x_GlobalVariableDefs.obj (I2caRegsFile)

    .esysmem 1 00008000 00000400 UNINITIALIZED
    00008000 00000001 rts2800_ml.lib : memory.obj (.esysmem)
    00008001 000003ff --HOLE--

    PartIdRegsFile
    * 1 003d7fff 00000001 UNINITIALIZED
    003d7fff 00000001 F2802x_GlobalVariableDefs.obj (PartIdRegsFile)

    CsmPwlFile
    * 1 003f7ff8 00000008 UNINITIALIZED
    003f7ff8 00000008 F2802x_GlobalVariableDefs.obj (CsmPwlFile)

    .pinit 0 003f7000 00000000 UNINITIALIZED

    .reset 0 003fffc0 00000002 DSECT
    003fffc0 00000002 rts2800_ml.lib : boot28.obj (.reset)

    vectors 0 003fffc2 00000000 DSECT

    MODULE SUMMARY

    Module code initialized data uninitialized data
    ------ ---- ---------------- ------------------
    .\
    F2802x_GlobalVariableDefs.obj 0 0 1052
    f2802x_pievect.obj 17 256 0
    f2802x_defaultisr.obj 255 0 0
    oled.obj 193 0 32
    f2802x_sysctrl.obj 187 0 0
    main.obj 155 0 0
    f2802x_cputimers.obj 105 0 0
    f2802x_piectrl.obj 31 0 0
    f2802x_codestartbranch.obj 10 0 0
    f2802x_usdelay.obj 8 0 0
    +--+----------------------------------------+------+------------------+--------------------+
    Total: 961 256 1084

    .\csrc\
    u8x8_d_ssd1306_128x64_noname.obj 134 97 0
    u8x8_cad.obj 168 1 0
    u8g2_d_memory.obj 0 0 128
    u8g2_hvline.obj 123 0 0
    u8g2_setup.obj 106 4 0
    u8g2_ll_hvline.obj 86 0 0
    u8x8_display.obj 49 0 0
    u8x8_setup.obj 48 0 0
    u8x8_byte.obj 30 0 0
    u8g2_d_setup.obj 14 0 0
    u8x8_gpio.obj 5 0 0
    u8g2_font.obj 2 0 0
    +--+----------------------------------------+------+------------------+--------------------+
    Total: 765 102 128

    C:\Users\baghli\AppData\Local\Temp\
    {3823F456-BC81-40BA-B9B5-5BFE48E0F88E} 0 148 0
    +--+----------------------------------------+------+------------------+--------------------+
    Total: 0 148 0

    E:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.3.LTS/lib/rts2800_ml.lib
    trgdrv.obj 421 0 0
    ...............

  • Lotfi said:

    now with optimisation level 4 to size (0) and not speed I have better results, it only complies about :

    #10247-D creating output section ".cio" without a SECTIONS specification

    It seems that it is still unable to allocate a couple of sections: 

    .cio 0 00000000 00000120 FAILED TO ALLOCATE
    .ebss.1 0 00000000 00000120 FAILED TO ALLOCATE

    You would need to check the linker command file and see if you can move these sections to another memory region that has space available to accommodate it.
    Also check this link for additional tips on addressing this issue. 

    If you are new to TI compiler tools and linker command file syntax, please take a look at this article that provides a great overview of the different sections and what the different allocation syntax means.

  • Lotfi said:
    I have this

    but it gave the map you saw

    OK, the device type listed is correct, but the map file only lists 3K words of SARAM and 8K words of flash.

    Which linker command files (.cmd) are in the project?

    The screen shot of the CCS project options only shows the F2802x_Headers_nonBIOS.cmd linker command file, which I don't think contains the device specific amount of memory.

  • Let me summarise the issue so far:

    The lib U8g2 requires a link garbage collector. It is a standard feature in the Arduino gcc toolchain. we can run U8g2 with lesser than 1K of RAM as explained in

    https://github.com/olikraus/u8g2/issues/549#issuecomment-385230689

    Now I moved from F28027F to  F28069M : same problem

    #Oled69M_V0.2.zip  on 

    https://github.com/blotfi/c2000_u8g2

    yes the main cmd file is : f28069F_ram_lnk.cmd   found in motorware projects

    but I also tried : e:\ti\c2000\C2000Ware_1_00_03_00\device_support\f2806x\common\cmd\f28069M_ram_lnk.cmd

    same issue

    In fact, I don't need more memory or section targets but link garbage collector feature so unused procedures that requires memory are not lonked.

  • Lotfi,

    As mentioned by Chester, the equivalent of the GCC link garbage collector in the TI tools is the --gen_func_subsections and --gen_data_subsections options. If adding that option alone does not still get you the allocation you expect, you may need to do some additional manual tweaking of linker command file (such as to allow sections to fit within their allocated memory regions) and/or code optimization.

  • Chester Gillon said:
    Looking at the linker map file see two problems:

    1. Have selected a TMS320F280200 device (8K word of flash and 3K words of SARAM) which has less memory than the actual TMS320F28027F (64K words of flash and 12K words of SARAM) on the LAUNCHXL-F28027F.

    I downloaded https://github.com/blotfi/c2000_u8g2/blob/master/%23oled27f_V0.2.zip and have identified why the linker map only showed 8K words of flash and 3K words of SARAM. The F2802x_generic_flash.cmd files is linked to the project.

    If you right-click on the linked F2802x_generic_flash.cmd file in the CCS Project Explorer, select the Properties and on the Resource tab select the Link Location.

    On the Exit Link Location change the F2802x_generic_flash.cmd file name:

    To F28027.cmd:

    That will then allow the linker to use the 32K words of flash and 6K words of SARAM in the TMS320F28027F.

  • Thank you Chester

    but I moved to F28069M with proper cmd files, but the problem is the link garbage collector that doesn't exist in CCS or is not activated

    as mentionned in

    https://e2e.ti.com/support/development_tools/code_composer_studio/f/81/p/685102/2525556#2525556

    because de code fits in a small Arduino nano using the GCC link garbage collector but not in the huge memory of 69M...

  • Lotfi said:
    but the problem is the link garbage collector that doesn't exist in CCS or is not activated

    How are you building the u8g2 library?

    The #Oled69M_V0.2.zip and #oled27f_V0.2.zip on your GitHub page seem to have the calls to the u8g2 library commented out.

    I tried with an example project using the TI v16.9.3.LTS C2000 compiler and the setting the "Place each function in a separate subsection (--gen_func_subsections, -mo)" and "Place structs and arrays in separate subsections (--gen_data_subsections)" Runtime Model Options to "on" did allow the linker to remove unused functions and data in object files.