S912XEP100 xgate share structure

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S912XEP100 xgate share structure

633 Views
dannydeng
Contributor III

Dears,

 

   I am using S912XEP100 xgate share structure, and found these errors, enclosed the source code, would you please kindly help to check it?

 

    L1827: Symbol can0ReceiveBuf has different size in xgate.cxgate.o (320 bytes) and main.c.o (300 bytes)


    L1827: Symbol can1ReceiveBuf has different size in xgate.cxgate.o (320 bytes) and main.c.o (300 bytes)


    L1827: Symbol can2ReceiveBuf has different size in xgate.cxgate.o (1920 bytes) and main.c.o (1800 bytes)


    L1827: Symbol can0ReceiveBuf has different size in All_variable.c.o (300 bytes) and xgate.cxgate.o (320 bytes)


    L1827: Symbol can1ReceiveBuf has different size in All_variable.c.o (300 bytes) and xgate.cxgate.o (320 bytes)


   L1827: Symbol can2ReceiveBuf has different size in All_variable.c.o (1800 bytes) and xgate.cxgate.o (1920 bytes)

 

 

Thanks and Best Regards,

Ray Deng

Original Attachment has been moved to: Project_Structure_B.rar

Labels (1)
0 Kudos
5 Replies

340 Views
RadekS
NXP Employee
NXP Employee

Hi Ray,

As Edward correctly wrote, the XGATE works with 16bit numbers and misaligned operations are not supported.

Your structure contains odd number of bytes

typedef struct

{               

 ulong MessageID;

 uchar FrameType;

 uchar FrameFormat;

 uchar Length;

 uchar Data[8];

} canMsg;

The best way for avoiding such issues is not using byte variables for shared structures.  

 

You may look at some of the application notes about XGATE. I would like to recommend for example older AN2685 How to Configure and Use the XGATE on S12X Devices

http://www.nxp.com/files/microcontrollers/doc/app_note/AN2685.pdf

or AN3224 Tutorial Introducing the XGATE Module to Consumer and Industrial Application Developers

http://www.nxp.com/files/microcontrollers/doc/app_note/AN3224.pdf

I hope it helps you.

Have a great day,
Radek

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

340 Views
dannydeng
Contributor III

Dears, Thanks for your kindly help.

0 Kudos

340 Views
kef2
Senior Contributor IV

Since XGATE is unable access misaligned 16bit words, word alignment is turned on in XGATE compiler. Linker sees the difference in the size of canMsg in XGATE C o-files and S12X o-files. You can either turn on word alignment in S12X compiler or tune your canMsg typedef so that word alignment won't affect struct size:

typedef struct
{               
  ulong MessageID;
 uchar FrameType;
 uchar FrameFormat;
 uchar Length;

     uchar __dummy;
 uchar Data[8];
} canMsg;

340 Views
dannydeng
Contributor III

Hi Edward,

    Thanks for your kindly help, can you help to share the instructions step by step?

0 Kudos

340 Views
kef2
Senior Contributor IV

Hi

What instructions? Don't you know where in your code is canMsg defined? Windows explorer may help. Point at your project folder and type in canMsg into search window. Among other files it should find define.h

Edward

0 Kudos