µVision2 V2.14 Compiler : C51 V6.14 Target : 87C591 In my software, functions are not called. Which is the option of compilation which allows not to generate code for these functions? Even by using for the optimization of the code the level 1 " Dead codes elimination ", code is generated for the uncalled functions.
"In my software, functions are not called." If the functions are not called, why are they there!? Use conditional compilation directives, or build a Library. See this thread: http://www.keil.com/forum/docs/thread1686.asp "Dead" (or unreachable) code is something different; eg,
if( 1 ) { // This code is always executed } else { // This code is never executed - it would be removed by "Dead Code Elimination" }
Thanks for your answer. ""In my software, functions are not called."" "If the functions are not called, why are they there!?" In fact, it is about a software which we bought. #define allow to configure it. These #define make that certain functions are not called but I do not know which unless analysing all the software.
"software which we bought ... I do not know which unless analysing all the software." If you bought it, the vendor should be able to tell you that...
Also be aware that uncalled functions are essentially new "roots" in the call tree generated during data overlay analysis. This means that the parameter and auto data allocated to them (assuming a non-reentrant model) will not be overlaid -- that is, permanently occupying otherwise unused RAM. This is especially troublesome when using the small memory model.
Unfortunately, a linker option to remove unreference, relocatable code is not available. This is true even though this option is as safe as removing unreferenced, "one function per file" code. That option they do support. By the sheer number of questions on this topic, you would think they would implement it.
". By the sheer number of questions on this topic, you would think they would implement it" On that basis, I think they'd have to allow initialisers with _at_ definitions first... ;-) (although that question hasn't actually been asked for a while now...)
Yes, I agree.
View all questions in Keil forum