Hello compiler/c-library experts
Here is our setup:
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...)
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 2012OUTPUT FILE NAME: <--- deleted --->ENTRY POINT SYMBOL: "_c_int00" address: 10800000MEMORY CONFIGURATION name origin length used unused attr fill---------------------- -------- --------- -------- -------- ---- -------- BOOT 10800000 00000060 00000060 00000000 RWIX L2_RAM 10800060 0000bfa0 00009db0 000021f0 RWIXSECTION ALLOCATION MAP output attributes/section page origin length input sections-------- ---- ---------- ---------- ----------------.pinit 0 10800060 00000000 UNINITIALIZEDboot 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 $bss10800060 .bss10800060 .data10800060 .text10807160 C$$EXIT10806e58 C$$IO$$10804844 _GpioMgr_getPinVal__F10Gpio_PinId10804720 _GpioMgr_setPinDir__F10Gpio_PinId14Gpio_Direction108047d0 _GpioMgr_setPinVal__F10Gpio_PinId13Gpio_PinValue108061e0 _HOSTclose10804d60 _HOSTlseek10805460 _HOSTopen108059a0 _HOSTread108042a0 _HOSTrename10805a60 _HOSTunlink10805b20 _HOSTwrite10809cf4 __CIOBUF_108081a0 __STACK_END00001000 __STACK_SIZE00001000 __SYSMEM_SIZE00000001 __TI_args_main108096c0 ___TI_enable_exit_profile_outputffffffff ___TI_pprof_out_hndlffffffff ___TI_prof_data_sizeffffffff ___TI_prof_data_startffffffff ___binit__10800060 ___bss__ffffffff ___c_args__10809b90 ___cinit__10800060 ___data__10807060 ___default_new_handler__Fv10807080 ___dl__FPv108070a0 ___dla__FPv10800060 ___edata__10800060 ___end__108071a0 ___etext__10806e60 ___isinf10806280 ___nw__FUi108070c0 ___nwa__FUiffffffff ___pinit__10800060 ___text__10806ce0 __abort_msg10803940 __addd10806ee0 __args_main10804e60 __auto_init10805d60 __c6xabi_divu10805be0 __cleanup108096b8 __cleanup_ptr10805540 __cmpd108099d8 __ctypes_10800e60 __divd10806320 __divli10805d60 __divu10804100 __divul10803020 __divull10805e20 __doflush108096bc __dtors_ptr10806960 __fixdi10806500 __fixdli108069e0 __fltlid10803b40 __frcaddd10804f60 __frcmpyd10806f20 __frcmpyd_div108094c0 __ft_end108091a0 __ftable10806a60 __llshl10806f60 __llshru108096c4 __lock10803280 __mpyd10806fa0 __negd108070e0 __negll108095e4 __new_handler10807100 __nop10801820 __printfi10806fe0 __remli10806ae0 __renormd108071a0 __stack10806d40 __subcull10807020 __subd108081a0 __sys_memory10809380 __tmpnams108096c8 __unlock10805160 __wrt_ok10807160 _abort10805620 _atoi10805360 _bootstrap__3LedSFv10800000 _c_int0010805700 _close10806640 _copy_in108057e0 _exit10804c40 _fclose10805260 _fflush10806b60 _fprintf108048a0 _fputc10802260 _fputs10802da0 _free10805ee0 _fseek10805fa0 _lseek10806060 _ltoa108008ac _main10804420 _malloc10806da0 _memccpy10806780 _memcpy108058c0 _memset108048a0 _putc10806be0 _readmsg10807180 _remove108053e0 _set__3LedSFUib108045a0 _setvbuf10806c60 _unlink10806120 _write10806e00 _writemsgffffffff binit10809b90 cinit10800060 edata10800060 end108071a0 etextffffffff pinitGLOBAL SYMBOLS: SORTED BY Symbol Address address name-------- ----00000001 __TI_args_main00001000 __STACK_SIZE00001000 __SYSMEM_SIZE10800000 _c_int0010800060 $bss10800060 .bss10800060 .data10800060 .text10800060 ___bss__10800060 ___data__10800060 ___edata__10800060 ___end__10800060 ___text__10800060 edata10800060 end108008ac _main10800e60 __divd10801820 __printfi10802260 _fputs10802da0 _free10803020 __divull10803280 __mpyd10803940 __addd10803b40 __frcaddd10804100 __divul108042a0 _HOSTrename10804420 _malloc108045a0 _setvbuf10804720 _GpioMgr_setPinDir__F10Gpio_PinId14Gpio_Direction108047d0 _GpioMgr_setPinVal__F10Gpio_PinId13Gpio_PinValue10804844 _GpioMgr_getPinVal__F10Gpio_PinId108048a0 _fputc108048a0 _putc10804c40 _fclose10804d60 _HOSTlseek10804e60 __auto_init10804f60 __frcmpyd10805160 __wrt_ok10805260 _fflush10805360 _bootstrap__3LedSFv108053e0 _set__3LedSFUib10805460 _HOSTopen10805540 __cmpd10805620 _atoi10805700 _close108057e0 _exit108058c0 _memset108059a0 _HOSTread10805a60 _HOSTunlink10805b20 _HOSTwrite10805be0 __cleanup10805d60 __c6xabi_divu10805d60 __divu10805e20 __doflush10805ee0 _fseek10805fa0 _lseek10806060 _ltoa10806120 _write108061e0 _HOSTclose10806280 ___nw__FUi10806320 __divli10806500 __fixdli10806640 _copy_in10806780 _memcpy10806960 __fixdi108069e0 __fltlid10806a60 __llshl10806ae0 __renormd10806b60 _fprintf10806be0 _readmsg10806c60 _unlink10806ce0 __abort_msg10806d40 __subcull10806da0 _memccpy10806e00 _writemsg10806e58 C$$IO$$10806e60 ___isinf10806ee0 __args_main10806f20 __frcmpyd_div10806f60 __llshru10806fa0 __negd10806fe0 __remli10807020 __subd10807060 ___default_new_handler__Fv10807080 ___dl__FPv108070a0 ___dla__FPv108070c0 ___nwa__FUi108070e0 __negll10807100 __nop10807160 C$$EXIT10807160 _abort10807180 _remove108071a0 ___etext__108071a0 __stack108071a0 etext108081a0 __STACK_END108081a0 __sys_memory108091a0 __ftable10809380 __tmpnams108094c0 __ft_end108095e4 __new_handler108096b8 __cleanup_ptr108096bc __dtors_ptr108096c0 ___TI_enable_exit_profile_output108096c4 __lock108096c8 __unlock108099d8 __ctypes_10809b90 ___cinit__10809b90 cinit10809cf4 __CIOBUF_ffffffff ___TI_pprof_out_hndlffffffff ___TI_prof_data_sizeffffffff ___TI_prof_data_startffffffff ___binit__ffffffff ___c_args__ffffffff ___pinit__ffffffff binitffffffff 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.
If a post answers your question please mark it with the "Verify Answer" button
Search the wikis for common questions: CGT, BIOS, CCSv3, CCSv4Track a known bug with SDOWP. Enter the bug id in the "Find Record ID" box
Ram R--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 RI also found an older thread on the forum: http://e2e.ti.com/support/development_tools/compiler/f/343/t/55673.aspx#199742
That is indeed the thread I was thinking of. Nothing was done on the compiler side because we could not reproduce the problem.