XGate Shared Variables Link Errors (S12XE)

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

XGate Shared Variables Link Errors (S12XE)

Jump to solution
824 Views
rayhall
Contributor V

I am getting link errors and warnings when I make my project. I do not know how to fix them. This shows the errors.  http://www.turbofast.com.au/tfbin/ErrorsCanLogger.png

 

The problem relates to a structure that is defined in the GlobalsShared.h file. I get no errors when I compile the project.

 

I have attached the project files.

 

Ray.

Original Attachment has been moved to: CAN_Logger.zip

Labels (1)
0 Kudos
1 Solution
611 Views
kef2
Senior Contributor IV

XGATE compiler by default word aligns all struct members with sizeof() > 1. So you need to either insert "uint8_t dummy;" below or above unpaired acRequest , or in HC12 sources, which include GlobalsShared.h use pragma align like this

#pragma align on

#include "GlobalsShared.h"

#pragma align off

This will resolve different object size message. And to resolve "object defined twice", you need to insert extern keyword above your struct in *.h file.

Edward

View solution in original post

0 Kudos
2 Replies
612 Views
kef2
Senior Contributor IV

XGATE compiler by default word aligns all struct members with sizeof() > 1. So you need to either insert "uint8_t dummy;" below or above unpaired acRequest , or in HC12 sources, which include GlobalsShared.h use pragma align like this

#pragma align on

#include "GlobalsShared.h"

#pragma align off

This will resolve different object size message. And to resolve "object defined twice", you need to insert extern keyword above your struct in *.h file.

Edward

0 Kudos
611 Views
rayhall
Contributor V

Edward,

Thank you,

Ray.

0 Kudos