Keil Logo

BL51: Error 121 (Improper Fixup) with ROM(Small)


Information in this article applies to:

  • C51 Version 5.50
  • C51 Version 6.00 Beta
  • C51 Version 6.00

SYMPTOMS

I have a program that compiles and links just fine until I enable a function call to the library routine ceil().

My memory model is small, rom(small).

If I comment out the call to ceil, it's ok. With ceil in, I get linking errors everywhere. They are all 121 - improper fixup errors. They happen at every function call in the program, as well as during references to various code const segments.

CAUSE

You're probably running out of code space. The floating point version of the runtime library uses up most (1304 bytes in version 5.5) of the 2K(0800H) available.

The following simple program causes the same problem:

#include

float
foo(
   float x)
{
   return x;
}

void
main(void)
{
   foo(2.5);
   printf("\n");
   while (1);
}

To verify that this is the cause of the problem, set the linker options to create a map file and look at the sizes of segments in code memory.

For the preceding example:

LINK MAP OF MODULE:  C:\TRY\CODEHOG (CODEHOG)


 TYPE    BASE      LENGTH    RELOCATION   SEGMENT NAME
 -----------------------------------------------------

 * * * * * * *   D A T A   M E M O R Y   * * * * * * *
 REG     0000H     0008H     ABSOLUTE     "REG BANK 0"
         0008H     0018H                  *** GAP ***
 BIT     0020H.0   0001H.1   UNIT         _BIT_GROUP_
         0021H.1   0000H.7                *** GAP ***
 DATA    0022H     001CH     UNIT         _DATA_GROUP_
 IDATA   003EH     0001H     UNIT         ?STACK

 * * * * * * *   C O D E   M E M O R Y   * * * * * * *
 CODE    0000H     0003H     ABSOLUTE
 CODE    0003H     0518H     UNIT         ?C?LIB_CODE
 CODE    051BH     0468H     UNIT         ?PR?PRINTF?PRINTF
 CODE    0983H     0027H     UNIT         ?PR?PUTCHAR?PUTCHAR
 CODE    09AAH     0017H     UNIT         ?PR?MAIN?P3
 CODE    09C1H     000CH     UNIT         ?C_C51STARTUP
 CODE    09CDH     0002H     UNIT         ?CO?P3
 CODE    09CFH     0001H     UNIT         ?PR?_FOO?P3

In this example, the runtime library code plus printf() need 518h + 468h = 980h bytes of code space, but only 800h are available.

RESOLUTION

Change the program to reduce the amount of code space it requires, or use a memory model that allows more code space.

MORE INFORMATION


Last Reviewed: Thursday, February 25, 2021


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.