2

I write firmware for embedded processors in C and we have limited space for code in the processors flash memory and I'm trying to reduce the amount of space we are using and I've noticed that functions in libraries (which I wrote) that are not being used are still being included in the build. Is there a standard way to exclude library functions that are never referenced from the build without removing those functions from the library?

CHollman82
  • 576
  • 1
  • 8
  • 28
  • That will depend upon the toolset you have available for whatever microprocessor platform you're targeting. Even if there were a standard way, they would need to be compliant with it. – lurker Feb 18 '15 at 13:55

1 Answers1

1

I believe the answer is here: How to remove unused C/C++ symbols with GCC and ld?

Still, if you're not gonna use some functions from library you wrote, maybe the best choice would be to remove them at all?

Community
  • 1
  • 1
Sam Protsenko
  • 14,045
  • 4
  • 59
  • 75
  • Multiple projects use the same library, hence the purpose of using libraries, and some of the projects use the functions and some do not. Unfortunately all of those answers apply to GCC, I am using Texas Instruments proprietary IDE known as Code Composer Studio, thanks anyway, it looks like this is a platform specific problem and I'll try asking again with that specified. – CHollman82 Feb 18 '15 at 14:03
  • 1
    Actually it is compiler which matters, not IDE. As far as I remember, CCS can use GCC toolchain, not only TI compiler (it based on Eclipse so it's very flexible).So as one of options you can consider moving to GCC. If it's not appropriate -- then try to read help for compiler you use and find something similar to GCC flags mentioned at link I provided. – Sam Protsenko Feb 18 '15 at 14:37
  • Is that true with CCS v3? I know their newer versions are based on Eclipse but I thought that started with v4. Anyway, thank you, while moving to GCC is probably not an option at least now I have a lead on finding the answer (looking through the compiler and linker options). – CHollman82 Feb 18 '15 at 15:00