Keil Logo

C51: COMPILER DIRECTIVE FOR LINKER-LEVEL OPTIMIZATION


Information in this article applies to:

  • C51 Version 6.21 and later
  • CX51 All Versions
  • LX51 All Versions

QUESTION

I would like to use the Advanced Linker Level Optimization available in the LX51 linker. How do I invoke this level of optimization?

ANSWER

The OBJECTADVANCED compiler directive instructs the compiler to include information in the object file for for linker-level optimizations. This directive is used in conjunction with the OPTIMIZE directive to shrink program size and decrease execution speed.

When enabled, the OBJECTADVANCED directive instructs the LX51 linker/locater to perform the following Linker Optimizations:

  • Level 0 - 7 Maximize AJMP / ACALL: The linker rearranges code segments to maximize AJMP and ACALL instructions which are shorter than LJMP and LCALL instructions.
  • Level 8 Reuse of Common Entry Code: Setup code may be reused when multiple calls are made to a single function. Reusing common entry code reduces program size. This optimization is performed on the complete application.
  • Level 9 Common Block Subroutines: Recurring instruction sequences are converted into subroutines. This reduces program size but slightly increases execution speed. This optimization is performed on the complete application.
  • Level 10 Rearrange Code: When detecting common block subroutines, code is rearranged to obtain larger recurring sequences.
  • Level 11 Reuse of Common Exit Code: Indentical exit sequences are reused. This may reduce the size of common block subroutines even further. This optimization level generates the most compact program code possible.

The OBJECTADVANCED requires the extended LX51 linker/locater and cannot be used with the BL51 linker/locater.

µVision Control for OBJECTADVANCED : Project ->C51-> Code optimization -> Linker Code Packing

µVision Control for OPTIMIZE : Options -> C51 ->Code Optimization -> Level 0-9

Note in µVision Control : When the OBJECTADVANCED is enabled after the LX51 linker/locater is enabled when selecting Device, then the OMF2 directive is deleted from the C51 compiler command string. The OBJECTADVANCED enables another format, different from the OMF2 format.

SEE ALSO

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Friday, April 16, 2004


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.