Initialized variables are put in sbss2 section

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Initialized variables are put in sbss2 section

1,111件の閲覧回数
pierreschmidt
Contributor III

Hello, why are variables declared as:

 

CONST(uint8, SOAD_CONST) SoAd_VSockMultPdus[] =

{

  0x00u,

  0x00u,

  0x00u

};

 

put in sbss2 section?

 

As soon as other values than 0 are used, it is OK: SoAd_VSockMultPdus goes into sdata2.

 

sbss2 is for uninitialized data so there is no reason for CodeWarrior to use this sections, because 00 must be initialized.

 

This causes a bug during execution because SoAd_VSockMultPdus is not 00 (no initialization has been done).

 

So what should be done to have SoAd_VSockMultPdus in sdata2??

 

Thanks.

 

ラベル(1)
タグ(2)
0 件の賞賛
返信
1 返信

723件の閲覧回数
stanish
NXP Employee
NXP Employee

Hello Pierre,

I assume you are targeting PowerPC.

The default build tools settings place the zero constant data into uninitialized const section. In fact it in case sbss2 section is located in RAM it should work fine (all bss sections are zeroed by the startup copydown routine) but if it's in Flash the problem you describe may occur.

I'd recommend you to add the pragma below into your project (e.g. add into prefix file) as a workaround:


#pragma explicit_zero_data on

by default this pragma is off.

Regards

Stan

0 件の賞賛
返信