Hi all,
I'm trying to write a simple ROM CRC routine, but for some reason I'm only able to access up to 16 bit memory addresses.
unsigned long* _far temp_address;
unsigned long value;
temp_address = (unsigned long* _far) 0x088000;
value = *(temp_address);
temp_address is correctly set, however when I attempt to read the value at that address, I'm getting the value from address 0x8000. Any suggestions are appreciated.
MC9S12P128
CodeWarrior Version 5.9
Solved! Go to Solution.
Compiler is using run time library call _LOAD_FAR_16 to load data from banked memory,
For this to work:
1- Make sure to link your application with datapage.c
2- Make sure to place the section NON_BANKED in non banked memory in your .prm file.
For HCS12P family microcontrollers, you need to update datapage.c to specify the appropriate PPAGE register (0x15)
This is done as follows in datapage.c:
/* Compile with option -DHCS12 to activate this code */#if defined(HCS12) || defined(_HCS12) || defined(__HCS12__) /* HCS12 family has PPAGE register only at 0x30 */#if defined (HCS12P) /* HC912P128, HCS12P96, HCS12P64, HCS12P32 derivative has PPAGE register only at 0x15 */#define PPAGE_ADDR (0x15+REGISTER_BASE)#else#define PPAGE_ADDR (0x30+REGISTER_BASE)#endif#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(HC812A4)/* all setting default to A4 already */#endif
Make sure to add the option -DHCS12P when building your project.
CrasyCat
Compiler is using run time library call _LOAD_FAR_16 to load data from banked memory,
For this to work:
1- Make sure to link your application with datapage.c
2- Make sure to place the section NON_BANKED in non banked memory in your .prm file.
For HCS12P family microcontrollers, you need to update datapage.c to specify the appropriate PPAGE register (0x15)
This is done as follows in datapage.c:
/* Compile with option -DHCS12 to activate this code */#if defined(HCS12) || defined(_HCS12) || defined(__HCS12__) /* HCS12 family has PPAGE register only at 0x30 */#if defined (HCS12P) /* HC912P128, HCS12P96, HCS12P64, HCS12P32 derivative has PPAGE register only at 0x15 */#define PPAGE_ADDR (0x15+REGISTER_BASE)#else#define PPAGE_ADDR (0x30+REGISTER_BASE)#endif#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(HC812A4)/* all setting default to A4 already */#endif
Make sure to add the option -DHCS12P when building your project.
CrasyCat
Yes, that did it, thanks very much for your help, it is appreciated!!