Struct Aligment

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
1,074件の閲覧回数
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 解決策
981件の閲覧回数
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 返答(返信)
981件の閲覧回数
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.

982件の閲覧回数
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 件の賞賛
返信