Technical information
AN2216/D
10 MC9S12DP256 Software Development Using Metrowerk’s Codewarrior MOTOROLA
CodeWarrior Linker
Linking Compiled
Code Modules
Before presenting an example linker command file for the MC9S12DP256, a
short discussion on memory addresses used by the linker is necessary. The
Codewarrior development tools view the MC9S12DP256’s program memory
expansion space as a logical address space. For non-paged memory, the
logical address corresponds to the physical address. For paged memory, the
logical address is composed of the PPAGE value followed by the page window
address. This simple approach is intuitive and easy to understand.
Figure 9. Logical Address to PPAGE/Window Address Correspondence
The important thing to realise is that Flash address $4000 to $7FFF
corresponds to the same physical memory as $3E8000 to $3EBFFF. Therefore
code cannot be linked to address range $4000 to $7FFF and $3E8000 to
$3EBFFF. Code must be linked to address range $4000 to $7FFF or $3E8000
to $3EBFFF. Due to the necessity to have some code in non-page memory and
the advantage of constant data in non-page memory, $4000 to $7FFF is
usually chosen in preference to $3E8000 to $3EBFFF. Similarly Flash address
PPAGE Value Window Address Logical Address Memory type
N/A $4000 – $7FFF $4000 – $7FFF Flash Block 0, non-paged
N/A $C000 – $FFFF $C000 – $FFFF Flash Block 0, non-paged
$30 $8000 – $BFFF $308000 – $30BFFF Flash Block 3, paged
$31 $8000 – $BFFF $318000 – $31BFFF Flash Block 3, paged
$32 $8000 – $BFFF $328000 – $32BFFF Flash Block 3, paged
$33 $8000 – $BFFF $338000 – $33BFFF Flash Block 3, paged
$34 $8000 – $BFFF $348000 – $34BFFF Flash Block 2, paged
$35 $8000 – $BFFF $358000 – $35BFFF Flash Block 2, paged
$36 $8000 – $BFFF $368000 – $36BFFF Flash Block 2, paged
$37 $8000 – $BFFF $378000 – $37BFFF Flash Block 2, paged
$38 $8000 – $BFFF $388000 – $38BFFF Flash Block 1, paged
$39 $8000 – $BFFF $398000 – $39BFFF Flash Block 1, paged
$3A $8000 – $BFFF $3A8000 – $3ABFFF Flash Block 1, paged
$3B $8000 – $BFFF $3B8000 – $3BBFFF Flash Block 1, paged
$3C $8000 – $BFFF $3C8000 – $3CBFFF Flash Block 0, paged
$3D $8000 – $BFFF $3D8000 – $3DBFFF Flash Block 0, paged
$3E $8000 – $BFFF $3E8000 – $3EBFFF Flash Block 0, paged
$3F $8000 – $BFFF $3F8000 – $3FBFFF Flash Block 0, paged