|
|
|
|
Common Area
The common code area may be accessed by all banks. It typically
includes routines and constant data that must always be accessible.
For example:
- Reset vector,
- Interrupt vectors,
- Interrupt service routines,
- String constants,
- Bank switching routines,
- Inter-bank jump table,
- and so on.
The following code sections must always be located in the common
area:
-
Reset and Interrupt Vectors
Reset and interrupt jump
entries must remain in the common area, since the code bank
selected by the hardware at is not known at the time of the CPU
reset or interrupt. The linker locates absolute code segments in
the common area in each case.
-
Code Constants
Constant values (strings, tables,
etc.) which are defined in the code area must be stored in the
common area unless you can guarantee that the code bank containing
the constant data is selected at the time they are accessed by
program code. You can relocate these segments in code banks by
means of control statements.
-
Interrupt Functions
Interrupt code generated by the
Cx51 Compiler must be located in the common area. However,
interrupt functions can call functions in other code banks. The
linker produces a warning when an attempt is made to locate a Cx51
interrupt function in a code bank.
-
Bank Switch Code
The code required for switching code
banks as well as the associated inter-bank jump table are located
in the common area since they are required by all banks. By
default, the linker automatically locates these segments in the
common area. Do not attempt to locate them into bank areas.
-
Library Functions
Intrinsic run-time library
functions used by the Cx51 Compiler or the PL/M-51 Compiler must be
located in the common area. It is likely that the bank switch code
uses the same registers that are used to transfer values to these
library routines. Therefore, the linker always locates runtime
library program sections in the common area. Do not locate these
program sections in other bank areas.
It is difficult to estimate the size of the common area since it
depends on the particular software application and hardware
constraints. If the ROM area that is dedicated as common area is not
large enough to contain the entire common code, the linker duplicates
the remaining part of the common code area into the beginning of each
code bank. This is also the case if your hardware does not provide a
common code area section in the ROM space.
|
|
|