Struct Aligment

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Struct Aligment

跳至解决方案
1,039 次查看
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

标签 (1)
0 项奖励
回复
1 解答
946 次查看
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 项奖励
回复
2 回复数
946 次查看
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.

947 次查看
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 项奖励
回复