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.

removing HOST functions from project

Looking at my MAP file I see along with the expected library functions like div32u.obj, there's also a bunch of HOST functions.  I gather these are for use with some of the "enhanced" debugger features in CCS.  How do I disable all these features so that the ONLY code generated is library functions I use?  I have many projects where I'm down to a few bytes of FLASH left and the last thing I need is useless functions installed and I have no interest in the "enhanced" debugger.

                  00002100    0000008a     rts430.lib : trgdrv.obj (.text:HOSTlseek)
                  0000218a    0000006a                : trgdrv.obj (.text:HOSTrename)
                  000021f4    00000064                : trgdrv.obj (.text:HOSTopen)
                  00002258    00000060                : trgdrv.obj (.text:HOSTwrite)
                  000022b8    0000005e                : trgdrv.obj (.text:HOSTread)
                  00002316    0000005c                : lsr32.obj (.text:l_lsr_const)
                  00002372    00000058                : div32u.obj (.text)
                  000023ca    0000004c                : lsr16.obj (.text)
                  00002416    00000046                : autoinit.obj (.text:_auto_init)
                  0000245c    00000042                : trgdrv.obj (.text:HOSTclose)
                  0000249e    00000040                : trgdrv.obj (.text:HOSTunlink)
                  000024de    0000003e                : lsl32.obj (.text:l_lsl_const)
                  0000251c    00000030                : boot.obj (.text:_c_int00_noargs)
                  0000254c    0000002e                : trgmsg.obj (.text:writemsg)
                  0000257a    0000002c                : trgmsg.obj (.text:readmsg)
                  000025a6    0000002c                : lsl16.obj (.text)
                  000025d2    0000002a                : exit.obj (.text:exit)

  • Those are the low-level driver functions for C I/O.  They are included because some part of the program calls a function such as printf, clock, time, or getenv.  If you remove all such functions, the HOST functions will go away.  I can't say exactly which function is pulling in the HOST functions without looking at the rest of the map file.

  • Thanks, I found it.   I imported a demo program just to test and get a feel for CCSv4 and one of the header files had debug stuff in it that should be disabled but wasn't.  Wish CCS had a "find in files" function, guess I'll just add that to the list of things I'll have to do without now.

    Since you said printf can pull up the HOST functions, can I still write my own getchar and putchar routines and have printf call them without invoking HOST stuff?  I have no problem not using any of the other functions like clock, time, or getenv.

    I'm also trying to figure out how to change the linker output into something useful like ELF so I can load files into my simulator/debugger.

     

     

  • You can indeed write your own getchar and putchar using whatever mechanism you like to get the I/O out of the CPU.  As long as they don't eventually call one of the seven Unix-inspired low-level I/O functions (open, close, read, write, lseek, remove, rename), you will not get the HOST functions or readmsg and writemsg. 

    Judging by the names of the object files from the library,  you are using MSP430.  ELF (EABI) support will be part of compiler version 4.0.0,  to be released later this year.  There is no way to convert COFF object files to ELF object files.

  • I noticed that including <assert.h> to use assert() in code, cause HOST functions to be linked into final code, so that .bss section size grows up.

    I had the same problem of a big .bss section, and after some time spent browsing the forum and performing some tests, I came out with this solution: removing asserts from code reduces .bss size.

    Cheers,
    Stefano