I am trying to make a SW developped with Metrowerks/Hiware on HC05 to work with 8051. The SW currently needs around 60kb, is very modular and has many options and customizations depending on the customer requirement. In Metrowerks case, the linker has smart linking possibility: The linker file is *.PRM and list the objects files to link. If the object file is followed by a "+", all the functions, constant, variables will be placed and mapped in the MCU. (like KEIL) If there is no "+", the linker will REMOVE automatically functions, rom strings, ram global variables AUTOMATICALLY. The linker tree dependencies can also manage constant function pointers. Is there a way to do something similar and automatic in KEIL environment? Otherwise, the cumbersome way is to wrap all C functions like this: #ifdef My_Function void My_Function(void) { ... } #endif And in the header file, comment out the function declaration.... making the source code less readable. Ideas? Tricks? Thanks!
regarding optimizations, do the two different linker versions LX51 and BL51 make any difference? the LX51 Enhanced Linker overview page gives various improvements over the "classic" BL51, but it does not say much things about code improvement, apart from the "Linker Code Packing" feature. thank you very much in advance, Pascal.
Linker code packing makes a huge difference. It's well worth using if you're short on code space.
There is a (currently undocumented) new directive in LX51: REMOVEUNUSED. It removes unused functions/segments in the generated output file. This feature exists in C51 V7.20 and is currently in evaluation/testing. In case that you find problems email to: support.intl@keil.com