Keil Logo

Code Packing

For modules translated with the Compiler directive OBJECTADVANCED, the linker optimizes common code sequences throughout the entire program.

Depending on the optimization level, Linker Code Packing performs the following optimizations:

  • Replace LJMP and LCALL instructions with AJMP and ACALL when possible. Program code segments are arranged to optimize the number of AJMP and ACALL instructions.
  • Reuse of common function entry code when possible. When there are multiple calls to a single function, some of the setup code can be reused, thereby reducing program size.
  • Generate common block subroutines for recurring code sequences. The linker detects recurring instruction sequences across the program modules and converts them into subroutines. For these subroutines, the linker generates segments with the name ?L?COMxxxx (whereby xxxx is a sequence number) in the memory class CODE (for Dallas 390 and SLE7 in ECODE).

Note

  • When using linker code packing, the linker may create additional segments for the common code routines in the memory class CODE. The user must ensure that the memory class CODE is located to valid memory regions that can hold these common code sequences. An error message is generated if the linker cannot locate the common code sequences due to memory restrictions.

Related Knowledgebase Articles

  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.