This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

uncalled functions

Hi,
I am using C51 version 1x (or 5x). I have some uncalled functions and it seems like they are included in the final binary. Does any one know how to make the linker not include the uncalled funtions?

Thanks for your help,

Michelle

Parents
  • Actually, there is another way.

    You can create a program with several functions that are not invoked. This program MIGHT be a boot loader.

    Then, you can create another program that includes the public symbols only from the absolute object file of the boot loader. The second program could then call the unused functions in the boot loader.

    Refer to the following knowledgebase article for ways you can use the PUBLICSONLY directive to do stuff like this.

    http://www.keil.com/support/docs/2385.htm

    Jon

Reply
  • Actually, there is another way.

    You can create a program with several functions that are not invoked. This program MIGHT be a boot loader.

    Then, you can create another program that includes the public symbols only from the absolute object file of the boot loader. The second program could then call the unused functions in the boot loader.

    Refer to the following knowledgebase article for ways you can use the PUBLICSONLY directive to do stuff like this.

    http://www.keil.com/support/docs/2385.htm

    Jon

Children
  • Thank Jon for an another argument to add to my case. (I used the BL51 so was unaware of this option.)

    You have the ability to automatically remove unused library functions by using the one function per file technique. However to make the a boot loader and have these functions available, the programmer must take extra steps to prevent these functions from disappearing. You could foolishly invoke the "it is not safe in every concivable situation" and not allow this auto removal of unreferenced library functions. Thankfully you did not do this. You actually go the other way and make it even easier to get into this situation, by adding this NOPUBLICS option.

    The bottom line is the [auto remove "unreference/reloacatable" functions] linker option, would be no more unsafe the the [auto remove of "unreferenced/one function per file" library functions]. It is a poor argument to say "it is not safe in every concivable situation" for both cases.