It is often necessary to reserve code space on a device so that it can be used for some other purpose. EEPROM emulation is a common example. If the linker is allowed to locate code in the area that is used for EEPROM, the code will get erased when the EEPROM area is erased.
You can direct the linker to avoid placing code in particular areas of flash memory by adding particular linker directives.
For example, if I want the linker to avoid placing code between 0x1000 and 0x1FFFF, I can perform the following:
If using the LX51 extended linker, use the linker directive RESERVE:
If using the BL51 linker, use the linker directive CODE. This works in the opposite manner as RESERVE, in that is specifies the area in which the linker can place code.
CODE (0-0x0FFF, 0x2000-0xFFFF)
In Simplicity Studio, these directives can be added to the "Additional Flags" field under [Project]>[Properties]>[C/C++ Build]>[Settings]>[Keil 8051 Linker]>[Miscellaneous]