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.

Good math library for C6747 without libc

I want to remove the libc from my C6747 project (such as <stdio.h>, <stdlib.h> etc) because I found libc is a little bit heavier (about 100KB). In addition, libc will introduce labels with same name in the disassemble code, which should be prohibited in my project for some special reasons. However I still need some trigonometric functions like sin(), cos() and tan(). These functions are originally provided by the <math.h> in libc. How can I still use the efficient triangular functions without using the entire libc library?

  • I suggest you create your own custom library out of the standard RTS library provided with the compiler.

    Your link command probably refers to a library named libc.a.  This is not a library of object files but an an index library.  The linker chooses the appropriate RTS library for you based on your build options.  You can see which library is chosen by searching for "rts" in the linker map file.  In this post, I presume you use the library rts6740.lib.

    So, to create your own library of some of the routines from the RTS library... Copy the compiler RTS library into an empty directory, and issue commands similar to these:

    % ar6x -x rts6740.lib cos.obj sin.obj
    % ar6x -r custom_name.lib cos.obj sin.obj
    

    The command ar6x is the archiver utility.  It is part of the compiler toolset.  It can be found in the \bin directory of the compiler installation.  The first command extracts those object modules from the library.  You can see those object file names in the linker map file. The second command creates a new library using only those object modules.

    Thanks and regards,

    -George