Packed Structure size mismatch issue while using Codewarrior and GCC compiler

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

Packed Structure size mismatch issue while using Codewarrior and GCC compiler

523 Views
anand_s
Contributor III

Hi all,

We are using Kinetis K60 controller for our product. Now we are planning to upgrade the controller to K66 because it has more memory. 

For K60 controller we are using Codewarrior 10.4 IDE and MQX 4.0.2 RTOS. We upgraded the IDE to CW11.1 and latest MQX for K66 controller. We are porting the existing code to the latest controller. You know the CW10.4 has codewarrior kinetis compiler where as for the latest version we have to use GCC compiler.

Now we are facing an issue in size mismatch of packed structure in both compiler. We are using bitfilelds and pack(1) in some of the structures, but the size of these structure is different in both compiler. GCC compiler giving exact calculated size but codewarrior compiler padding some bytes. This is causing compatible issues in our system.

Please suggest how can we handle this issue. We have so many structures like this so explicit shift and mask operation is not possible in our case.

Thanks & regards,

Anand.S

Labels (1)
0 Kudos
2 Replies

497 Views
bobpaddock
Senior Contributor III

Not seeing your code you may already be using this:

Will making use of offsetof() from <stdlib.h> help you?

 

 

0 Kudos

502 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Anand:

 

K66 is supported in MQX 5.1. From the release note, I can see the develop tool for MQX 5.1 is Codewarrior 10.6.4.

Please refer to below link for more details

https://www.nxp.com/docs/en/release-note/MQXRN.pdf

I would suggest you use Codewarrior 10.6.4.

 

Regards

Daniel

 

0 Kudos