AnsweredAssumed Answered

Need Help Sharing Pointers Between XGATE and S12X

Question asked by David Subert on May 6, 2009
Latest reply on May 17, 2009 by David Subert


I have read the following threads regarding sharing pointers between S12X and XGATE:

I have attempted to implement the method described in the first forum post
. Thus far, I have not had any luck.

I am attempting to create an array of configuration structures that contain pointers to I
/O ports.
For convenience, I want this array to be accessed by both cores and would like to avoid creating two copies of the same array of structures. 
Here are snippets of my first attempt.

Included by XGATE
& S12X source code:
typedef struct

#ifdef CPU12X /*define structure for CPU12X*/
unsigned char driver_type; /* driver type, pwm/onoff*/
unsigned char driver_type_align; /* alignment padding*/
unsigned char port_address_align; /* alignment padding*/
far @gpage unsigned char * port_address; /* port address*/
#else /*structure definition for XGATE::allows sharing of pointers*/
unsigned char driver_type; /* driver type*/
unsigned char driver_type_align; /* alignment padding*/
unsigned char port_address_align; /* alignment padding for port address*/
unsigned char port_address_pg; /*page for global pointer port_address*/
far @gpage unsigned char * port_address /*port address*/


} pulseo_init_port_map_t;

Compiled by S12X compiler
const pulseo_init_port_map_t pulseo_chan_map[] =

/*Init CHANNEL_01*/
far @gpage unsigned char *)&PORTP,


Compiled by XGATE compiler
unsigned char temp;
unsigned char * temp1;
= *(pulseo_chan_map[driver_index].port_address); //deference for test
temp1 = (hal_u08_t*)(pulseo_chan_map[driver_index].port_address); //get address for test

The array address appears correctly to the XGATE, but I am unable to access structure members correctly
.   I find both the pointer address and data value are incorrect. Please note, this is built using the COSMIC S12X and XGATE compilers with the MC9S12XEQ384 controller.

Any advice would be greatly appeciated (except to switch from Cosmic to Codewarrior

Thanks in Advance,