Technical information

AN2216/D
CodeWarrior Compiler
MOTOROLA MC9S12DP256 Software Development Using Metrowerk’s Codewarrior 9
shown in Figure 7 is changed to that shown in Figure 8. This change has been
implemented in version 2.0 of the Codewarrior product.
/* Compile with option -DDG128 to activate this code */
#ifdef DG128 /* HC12 DG128 derivative has page register at 0xff and only P page */
#define PPAGE_ADDR (0xFF+REGISTER_BASE)
#ifndef __PPAGE__ /* may be set already by option -CPPPAGE */
#define __PPAGE__
#endif
#elif defined (A4)
/* all setting default to A4 already */
#endif
Figure 7. Code snippet from unmodified datapage.c
/* Compile with option -DHCS12 to activate this code */
#ifdef HCS12 /* HCS12 family has PPAGE register only at 0x30 */
#define PPAGE_ADDR (0x30+REGISTER_BASE)
#ifndef __PPAGE__ /* may be set already by option -CPPPAGE */
#define __PPAGE__
#endif
/* Compile with option -DDG128 to activate this code */
#elif defined DG128 /* HC912DG128 derivative has PPAGE register only at 0xFF */
#define PPAGE_ADDR (0xFF+REGISTER_BASE)
#ifndef __PPAGE__ /* may be set already by option -CPPPAGE */
#define __PPAGE__
#endif
#elif defined (A4)
/* all setting default to A4 already */
#endif
Figure 8. Recommended Code Snippet for datapage.c
Datapage.c should be recompiled with the compiler option -DHCS12 when
paged data will be accessed on the MC9S12DP256. If the registers on the
MC9S12DP256 will be remapped in the application, it will be necessary to
change the defined value of REGISTER_BASE. This value is also defined in
datapage.c.
Datapage.c has already been compiled (without -DHCS12) and is included in
the library 'ansib.lib'. Either the entire ansib.lib library can be rebuilt using the
modified datapage.c and compiler option, or the modified datapage.c can be
included in the Codewarrior project. As long as the modified datapage.c is
above ansib.lib in the project link order list view, the modified datapage.c will
be linked into the project instead of the standard datapage.c in the unmodified
ansib.lib library.