Struct Aligment

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

Struct Aligment

Jump to solution
583 Views
sebasira
Senior Contributor I

Hello!

 

I'm woring with CW v6.3 and MCF51QE128. I have project that was working fine, and I recently added an SD Card (via SPI) to log data. According to the owner of the SD library, I need to set 'struct aligment' to be byte, else it wouldn't work properly.

 

Now I'm having some bizarre behavior (on other routines not the SD ones)... Could it be related to the struct aligment? What does this setting change?

 

Thanks in advance!

 

SebaS

Labels (1)
0 Kudos
1 Solution
490 Views
sebasira
Senior Contributor I

When I change the option CW force me to re-compile the whole project.

Now I move that option back and I'm having the same problem, so it wasn't related to it. I'm reviewing my code now. Thanks!!!

View solution in original post

0 Kudos
2 Replies
490 Views
JimDon
Senior Contributor III

When structures are compiled, alignment may not be as expected, in that byte may be placed on word boundaries  for example, to optimize performance.

When you specify byte alignment, the structure is "packed" as much as possible. One reason I can think of that other things might not work is that perhap they have not been compiled/re-compiled with that option.

In any event, that should answer your question.

491 Views
sebasira
Senior Contributor I

When I change the option CW force me to re-compile the whole project.

Now I move that option back and I'm having the same problem, so it wasn't related to it. I'm reviewing my code now. Thanks!!!

0 Kudos