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.

CGT 7.3.2: minimal RTS?

Hello compiler/c-library experts

Here is our setup:

  • device: C6424
  • CCS  Version: 4.2.4.00033
  • xdctools_3_23_00_32
  • C6000 Code Generation Tools 7.3.2
  • For legacy reasons we are still building for COFF-ABI
  • All code is compiled as C++ (.cpp extension) with minimal C++ constructs - even if instances of "utility objects" exist, they are stack-local...

I'm implementing a bootloader (bare metal, no SYS/BIOS) which is part of a 2-stage chain-load process... and space (internal memory) is at a premium...

Is there a way to shed unused RTS baggage?

Also the following options do not seem to make a difference (unless I''m making a mistake...)

  • --printf_support=minimal
  • --disable_auto_rts

I also found an older thread on the forum: http://e2e.ti.com/support/development_tools/compiler/f/343/t/55673.aspx#199742

But, I could not get much out of it...

-ram

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Linker Cmd File:

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

-c
-heap  0x1000
-stack 0x1000

/* Memory Map: 48-kB */
MEMORY
{
    BOOT:        o = 0x10800000   l = 0x00000060
    L2_RAM:      o = 0x10800060   l = 0x0000BFA0
}

SECTIONS
{
    boot > BOOT
    {
        -lrts64plus.lib<boot.obj>  (.text)
    }
    .text > L2_RAM
    {
        * (.text)
    }
    .stack  > L2_RAM
    .bss    > L2_RAM
    .cinit  > L2_RAM
    .pinit  > L2_RAM
    .cio    > L2_RAM
    .const  > L2_RAM
    .data   > L2_RAM
    .switch > L2_RAM
    .sysmem > L2_RAM
    .far    > L2_RAM
}

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Output Map

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

******************************************************************************
               TMS320C6x Linker PC v7.3.2                      
******************************************************************************
>> Linked Mon Mar 26 16:33:43 2012

OUTPUT FILE NAME:   <--- deleted --->
ENTRY POINT SYMBOL: "_c_int00"  address: 10800000


MEMORY CONFIGURATION

         name            origin    length      used     unused   attr    fill
----------------------  --------  ---------  --------  --------  ----  --------
  BOOT                  10800000   00000060  00000060  00000000  RWIX
  L2_RAM                10800060   0000bfa0  00009db0  000021f0  RWIX


SECTION ALLOCATION MAP

 output                                  attributes/
section   page    origin      length       input sections
--------  ----  ----------  ----------   ----------------
.pinit     0    10800060    00000000     UNINITIALIZED

boot       0    10800000    00000060     
                  10800000    00000060     rts64plus.lib : boot.obj (.text:_c_int00)

.text      0    10800060    00007140     
                  10800060    00000880     main.obj (.text)
                  108008e0    00000580     rts64plus.lib : _printfi.obj (.text:__getarg_diouxp)
                  10800e60    00000540                   : divd.obj (.text:__divd)
                  108013a0    00000480                   : _printfi.obj (.text:__setfield)
                  10801820    00000440                   : _printfi.obj (.text:__printfi)
                  10801c60    00000300                   : _printfi.obj (.text:_ecvt)
                  10801f60    00000300                   : _printfi.obj (.text:_fcvt)
                  10802260    00000300                   : fputs.obj (.text:_fputs)
                  10802560    000002e0                   : _printfi.obj (.text:__pproc_fge)
                  10802840    000002c0                   : _printfi.obj (.text:__pproc_fwp)
                  10802b00    000002a0                   : _printfi.obj (.text:__pconv_e)
                  10802da0    00000280                   : memory.obj (.text:_free)
                  10803020    00000260                   : imath64.obj (.text:__divull)
                  10803280    00000260                   : mpyd.obj (.text:__mpyd)
                  108034e0    00000240                   : _printfi.obj (.text:__pproc_diouxp)
                  10803720    00000220                   : _printfi.obj (.text:__pproc_str)
                  10803940    00000200                   : addd.obj (.text:__addd)
                  10803b40    00000200                   : frcaddd.obj (.text:__frcaddd)
                  10803d40    00000200                   : _printfi.obj (.text:__pconv_g)
                  10803f40    000001c0                   : _printfi.obj (.text:__mcpy)
                  10804100    000001a0                   : imath40.obj (.text:__divul)
                  108042a0    00000180                   : trgdrv.obj (.text:_HOSTrename)
                  10804420    00000180                   : memory.obj (.text:_malloc)
                  108045a0    00000180                   : setvbuf.obj (.text:_setvbuf)
                  10804720    00000180     libdevices.a : gpio_simple.obj (.text)
                  108048a0    00000140     rts64plus.lib : fputc.obj (.text:_fputc)
                  108049e0    00000140                   : lowlev.obj (.text:_getdevice)
                  10804b20    00000120                   : _printfi.obj (.text:__pproc_fflags)
                  10804c40    00000120                   : fclose.obj (.text:_fclose)
                  10804d60    00000100                   : trgdrv.obj (.text:_HOSTlseek)
                  10804e60    00000100                   : autoinit.obj (.text:__auto_init)
                  10804f60    00000100                   : frcmpyd.obj (.text:__frcmpyd)
                  10805060    00000100                   : _printfi.obj (.text:__ltostr)
                  10805160    00000100                   : _io_perm.obj (.text:__wrt_ok)
                  10805260    00000100                   : fflush.obj (.text:_fflush)
                  10805360    00000100     libdevices.a : led.obj (.text)
                  10805460    000000e0     rts64plus.lib : trgdrv.obj (.text:_HOSTopen)
                  10805540    000000e0                   : cmpd.obj (.text:__cmpd)
                  10805620    000000e0                   : atoi.obj (.text:_atoi)
                  10805700    000000e0                   : lowlev.obj (.text:_close)
                  108057e0    000000e0                   : exit.obj (.text:_exit)
                  108058c0    000000e0                   : memset.obj (.text:_memset)
                  108059a0    000000c0                   : trgdrv.obj (.text:_HOSTread)
                  10805a60    000000c0                   : trgdrv.obj (.text:_HOSTunlink)
                  10805b20    000000c0                   : trgdrv.obj (.text:_HOSTwrite)
                  10805be0    000000c0                   : fopen.obj (.text:__cleanup)
                  10805ca0    000000c0                   : _printfi.obj (.text:__div)
                  10805d60    000000c0                   : divu.obj (.text:__divu)
                  10805e20    000000c0                   : fflush.obj (.text:__doflush)
                  10805ee0    000000c0                   : fseek.obj (.text:_fseek)
                  10805fa0    000000c0                   : lowlev.obj (.text:_lseek)
                  10806060    000000c0                   : ltoa.obj (.text:_ltoa)
                  10806120    000000c0                   : lowlev.obj (.text:_write)
                  108061e0    000000a0                   : trgdrv.obj (.text:_HOSTclose)
                  10806280    000000a0                   : new_.obj (.text:___nw__FUi)
                  10806320    000000a0                   : imath40.obj (.text:__divli)
                  108063c0    000000a0                   : _printfi.obj (.text:__ecpy)
                  10806460    000000a0                   : _printfi.obj (.text:__fcpy)
                  10806500    000000a0                   : fixdli.obj (.text:__fixdli)
                  108065a0    000000a0                   : _printfi.obj (.text:__pconv_f)
                  10806640    000000a0                   : cpy_tbl.obj (.text:_copy_in)
                  108066e0    000000a0                   : lowlev.obj (.text:_finddevice)
                  10806780    000000a0                   : memcpy64.obj (.text:_memcpy)
                  10806820    000000a0                   : memory.obj (.text:_minsert)
                  108068c0    000000a0                   : memory.obj (.text:_mremove)
                  10806960    00000080                   : fixdi.obj (.text:__fixdi)
                  108069e0    00000080                   : fltlid.obj (.text:__fltlid)
                  10806a60    00000080                   : llshift.obj (.text:__llshl)
                  10806ae0    00000080                   : renormd.obj (.text:__renormd)
                  10806b60    00000080                   : fprintf.obj (.text:_fprintf)
                  10806be0    00000080                   : trgmsg.obj (.text:_readmsg)
                  10806c60    00000080                   : lowlev.obj (.text:_unlink)
                  10806ce0    00000060                   : assert.obj (.text:__abort_msg)
                  10806d40    00000060                   : imath64.obj (.text:__subcull)
                  10806da0    00000060                   : memccpy.obj (.text:_memccpy)
                  10806e00    00000060                   : trgmsg.obj (.text:_writemsg)
                  10806e60    00000040                   : isinf.obj (.text:___isinf)
                  10806ea0    00000040                   : _printfi.obj (.text:___isnan)
                  10806ee0    00000040                   : args_main.obj (.text:__args_main)
                  10806f20    00000040                   : frcmpyd_div.obj (.text:__frcmpyd_div)
                  10806f60    00000040                   : llshift.obj (.text:__llshru)
                  10806fa0    00000040                   : negd.obj (.text:__negd)
                  10806fe0    00000040                   : imath40.obj (.text:__remli)
                  10807020    00000040                   : subd.obj (.text:__subd)
                  10807060    00000020                   : newhandler.obj (.text:___default_new_handler__Fv)
                  10807080    00000020                   : delete.obj (.text:___dl__FPv)
                  108070a0    00000020                   : array_del.obj (.text:___dla__FPv)
                  108070c0    00000020                   : array_new.obj (.text:___nwa__FUi)
                  108070e0    00000020                   : negll.obj (.text:__negll)
                  10807100    00000020                   : _lock.obj (.text:__nop)
                  10807120    00000020                   : fprintf.obj (.text:__outc)
                  10807140    00000020                   : fprintf.obj (.text:__outs)
                  10807160    00000020                   : exit.obj (.text:_abort)
                  10807180    00000020                   : remove.obj (.text:_remove)

.bss       0    10800060    00000000     UNINITIALIZED

.data      0    10800060    00000000     UNINITIALIZED

.stack     0    108071a0    00001000     UNINITIALIZED
                  108071a0    00000008     rts64plus.lib : boot.obj (.stack)
                  108071a8    00000ff8     --HOLE--

.sysmem    0    108081a0    00001000     UNINITIALIZED
                  108081a0    00000008     rts64plus.lib : memory.obj (.sysmem)
                  108081a8    00000ff8     --HOLE--

.far       0    108091a0    00000534     UNINITIALIZED
                  108091a0    00000324     rts64plus.lib : defs.obj (.far)
                  108094c4    00000004                   : fopen.obj (.far)
                  108094c8    0000011c                   : lowlev.obj (.far)
                  108095e4    00000004                   : vars.obj (.far)
                  108095e8    000000d0                   : trgdrv.obj (.far)
                  108096b8    0000000c                   : exit.obj (.far)
                  108096c4    00000008                   : _lock.obj (.far)
                  108096cc    00000008                   : memory.obj (.far)

.const     0    108096d8    000004b8     
                  108096d8    00000300     main.obj (.const:.string)
                  108099d8    00000101     rts64plus.lib : ctype.obj (.const:__ctypes_)
                  10809ad9    00000003                   : assert.obj (.const:.string)
                  10809adc    00000084     libdevices.a : led.obj (.const:.string)
                  10809b60    00000023     rts64plus.lib : _printfi.obj (.const:.string)
                  10809b83    00000002                   : fputs.obj (.const:.string)
                  10809b85    00000003     --HOLE-- [fill = 0]
                  10809b88    00000008                   : divd.obj (.const:_initial_approx$1)

.cinit     0    10809b90    00000164     
                  10809b90    0000005c     rts64plus.lib : defs.obj (.cinit)
                  10809bec    00000004     --HOLE-- [fill = 0]
                  10809bf0    0000005c                   : lowlev.obj (.cinit)
                  10809c4c    00000004     --HOLE-- [fill = 0]
                  10809c50    0000002c                   : exit.obj (.cinit)
                  10809c7c    00000004     --HOLE-- [fill = 0]
                  10809c80    0000002c                   : memory.obj (.cinit)
                  10809cac    00000004     --HOLE-- [fill = 0]
                  10809cb0    0000001c                   : _lock.obj (.cinit)
                  10809ccc    00000004     --HOLE-- [fill = 0]
                  10809cd0    0000000c                   : fopen.obj (.cinit)
                  10809cdc    00000004     --HOLE-- [fill = 0]
                  10809ce0    0000000c                   : vars.obj (.cinit)
                  10809cec    00000004     --HOLE-- [fill = 0]
                  10809cf0    00000004     (.pad.cinit) [fill = 0]

.cio       0    10809cf4    00000120     UNINITIALIZED
                  10809cf4    00000120     rts64plus.lib : trgmsg.obj (.cio)


GLOBAL SYMBOLS: SORTED ALPHABETICALLY BY Name

address    name
--------   ----
10800060   $bss
10800060   .bss
10800060   .data
10800060   .text
10807160   C$$EXIT
10806e58   C$$IO$$
10804844   _GpioMgr_getPinVal__F10Gpio_PinId
10804720   _GpioMgr_setPinDir__F10Gpio_PinId14Gpio_Direction
108047d0   _GpioMgr_setPinVal__F10Gpio_PinId13Gpio_PinValue
108061e0   _HOSTclose
10804d60   _HOSTlseek
10805460   _HOSTopen
108059a0   _HOSTread
108042a0   _HOSTrename
10805a60   _HOSTunlink
10805b20   _HOSTwrite
10809cf4   __CIOBUF_
108081a0   __STACK_END
00001000   __STACK_SIZE
00001000   __SYSMEM_SIZE
00000001   __TI_args_main
108096c0   ___TI_enable_exit_profile_output
ffffffff   ___TI_pprof_out_hndl
ffffffff   ___TI_prof_data_size
ffffffff   ___TI_prof_data_start
ffffffff   ___binit__
10800060   ___bss__
ffffffff   ___c_args__
10809b90   ___cinit__
10800060   ___data__
10807060   ___default_new_handler__Fv
10807080   ___dl__FPv
108070a0   ___dla__FPv
10800060   ___edata__
10800060   ___end__
108071a0   ___etext__
10806e60   ___isinf
10806280   ___nw__FUi
108070c0   ___nwa__FUi
ffffffff   ___pinit__
10800060   ___text__
10806ce0   __abort_msg
10803940   __addd
10806ee0   __args_main
10804e60   __auto_init
10805d60   __c6xabi_divu
10805be0   __cleanup
108096b8   __cleanup_ptr
10805540   __cmpd
108099d8   __ctypes_
10800e60   __divd
10806320   __divli
10805d60   __divu
10804100   __divul
10803020   __divull
10805e20   __doflush
108096bc   __dtors_ptr
10806960   __fixdi
10806500   __fixdli
108069e0   __fltlid
10803b40   __frcaddd
10804f60   __frcmpyd
10806f20   __frcmpyd_div
108094c0   __ft_end
108091a0   __ftable
10806a60   __llshl
10806f60   __llshru
108096c4   __lock
10803280   __mpyd
10806fa0   __negd
108070e0   __negll
108095e4   __new_handler
10807100   __nop
10801820   __printfi
10806fe0   __remli
10806ae0   __renormd
108071a0   __stack
10806d40   __subcull
10807020   __subd
108081a0   __sys_memory
10809380   __tmpnams
108096c8   __unlock
10805160   __wrt_ok
10807160   _abort
10805620   _atoi
10805360   _bootstrap__3LedSFv
10800000   _c_int00
10805700   _close
10806640   _copy_in
108057e0   _exit
10804c40   _fclose
10805260   _fflush
10806b60   _fprintf
108048a0   _fputc
10802260   _fputs
10802da0   _free
10805ee0   _fseek
10805fa0   _lseek
10806060   _ltoa
108008ac   _main
10804420   _malloc
10806da0   _memccpy
10806780   _memcpy
108058c0   _memset
108048a0   _putc
10806be0   _readmsg
10807180   _remove
108053e0   _set__3LedSFUib
108045a0   _setvbuf
10806c60   _unlink
10806120   _write
10806e00   _writemsg
ffffffff   binit
10809b90   cinit
10800060   edata
10800060   end
108071a0   etext
ffffffff   pinit


GLOBAL SYMBOLS: SORTED BY Symbol Address

address    name
--------   ----
00000001   __TI_args_main
00001000   __STACK_SIZE
00001000   __SYSMEM_SIZE
10800000   _c_int00
10800060   $bss
10800060   .bss
10800060   .data
10800060   .text
10800060   ___bss__
10800060   ___data__
10800060   ___edata__
10800060   ___end__
10800060   ___text__
10800060   edata
10800060   end
108008ac   _main
10800e60   __divd
10801820   __printfi
10802260   _fputs
10802da0   _free
10803020   __divull
10803280   __mpyd
10803940   __addd
10803b40   __frcaddd
10804100   __divul
108042a0   _HOSTrename
10804420   _malloc
108045a0   _setvbuf
10804720   _GpioMgr_setPinDir__F10Gpio_PinId14Gpio_Direction
108047d0   _GpioMgr_setPinVal__F10Gpio_PinId13Gpio_PinValue
10804844   _GpioMgr_getPinVal__F10Gpio_PinId
108048a0   _fputc
108048a0   _putc
10804c40   _fclose
10804d60   _HOSTlseek
10804e60   __auto_init
10804f60   __frcmpyd
10805160   __wrt_ok
10805260   _fflush
10805360   _bootstrap__3LedSFv
108053e0   _set__3LedSFUib
10805460   _HOSTopen
10805540   __cmpd
10805620   _atoi
10805700   _close
108057e0   _exit
108058c0   _memset
108059a0   _HOSTread
10805a60   _HOSTunlink
10805b20   _HOSTwrite
10805be0   __cleanup
10805d60   __c6xabi_divu
10805d60   __divu
10805e20   __doflush
10805ee0   _fseek
10805fa0   _lseek
10806060   _ltoa
10806120   _write
108061e0   _HOSTclose
10806280   ___nw__FUi
10806320   __divli
10806500   __fixdli
10806640   _copy_in
10806780   _memcpy
10806960   __fixdi
108069e0   __fltlid
10806a60   __llshl
10806ae0   __renormd
10806b60   _fprintf
10806be0   _readmsg
10806c60   _unlink
10806ce0   __abort_msg
10806d40   __subcull
10806da0   _memccpy
10806e00   _writemsg
10806e58   C$$IO$$
10806e60   ___isinf
10806ee0   __args_main
10806f20   __frcmpyd_div
10806f60   __llshru
10806fa0   __negd
10806fe0   __remli
10807020   __subd
10807060   ___default_new_handler__Fv
10807080   ___dl__FPv
108070a0   ___dla__FPv
108070c0   ___nwa__FUi
108070e0   __negll
10807100   __nop
10807160   C$$EXIT
10807160   _abort
10807180   _remove
108071a0   ___etext__
108071a0   __stack
108071a0   etext
108081a0   __STACK_END
108081a0   __sys_memory
108091a0   __ftable
10809380   __tmpnams
108094c0   __ft_end
108095e4   __new_handler
108096b8   __cleanup_ptr
108096bc   __dtors_ptr
108096c0   ___TI_enable_exit_profile_output
108096c4   __lock
108096c8   __unlock
108099d8   __ctypes_
10809b90   ___cinit__
10809b90   cinit
10809cf4   __CIOBUF_
ffffffff   ___TI_pprof_out_hndl
ffffffff   ___TI_prof_data_size
ffffffff   ___TI_prof_data_start
ffffffff   ___binit__
ffffffff   ___c_args__
ffffffff   ___pinit__
ffffffff   binit
ffffffff   pinit

[118 symbols]


--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

  • Ram,

    By default the linker will only pull in functions from the runtime library that are "referenced". You may not be calling all the runtime functions listed in the link map file directly, but even if you call one, that one in turn can call other functions, which would then also get linked in.

  • Ram R said:
    --disable_auto_rts

    That option has nothing to do with library size.  You probably should not use it.

    I see that the linker map file shows that some part of the program calls new.  I think that deep in the implementation of new, there is a call to printf for an exceptional condition.   This call will cause the bulk of the C I/O support to be dragged in, and it's a lot.  This is a the subject of another thread, but I can't quickly find it.  I don't recall what the resolution of that thread was, or if there was an enhancement report submitted against it.  I'll see if I can dig it up.  You might want to try checking the compiler's assembly ouput for your function to verify there are calls to operator new.  You may need to pass it through dem6x to be able to identify the mangled name of operator new.

  • Ram R said:

    That is indeed the thread I was thinking of.  Nothing was done on the compiler side because we could not reproduce the problem.