MPC5777C Shared RAM initialization problem (Garbage Value)

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

MPC5777C Shared RAM initialization problem (Garbage Value)

ソリューションへジャンプ
1,322件の閲覧回数
egeonurg
Contributor III

Hey there, 

I have the MPC5777C project, in which I've modified the linker script of the project. 

 

egeonurg_0-1654666451945.png

my sections can be shown above. I have configured linker scripts of the core projects as follows to create a 32KB x 2 shared RAM area and 256 K Calibration Area. 

egeonurg_1-1654666587331.png

 

Then I've created a structure which is placed in the s_ram1 section as follows for both projects.

As expected, the structure is in the same place for both projects. 

egeonurg_2-1654666656004.png

After those operations, I see some garbage value inside of the created structure, in my debugger for both projects. 

egeonurg_3-1654666805638.png

 

Probably I am missing something related to the initialization. Is there any other force way to zero init ram variables via GCC or somewhat? 

 

Best Wishes

Ege

 

 

0 件の賞賛
返信
1 解決策
1,253件の閲覧回数
jiri_kral
NXP Employee
NXP Employee

Hi, 

 

the dafault way how is RAM inicialized is by writting content of registers in a loop:

;# Fill SRAM with writes of 32GPRs

sram_loop:
e_stmw r0,0(r5) # Write all 32 registers to SRAM
e_addi r5,r5,128 # Increment the RAM pointer to next 128bytes
e_bdnz sram_loop # Loop for all of SRAM

 

and some registers contains different value than 0. You need to perform for example memset(...) on your structure prior to using it. Or you can modify the RAM init. 

 

元の投稿で解決策を見る

2 返答(返信)
1,319件の閲覧回数
egeonurg
Contributor III

Update: 

After I have removed the NOLOAD option for those sections 

egeonurg_0-1654667433432.png

 

result have not been changed too 

 

egeonurg_1-1654667447812.png

 

Best Regards

Ege

0 件の賞賛
返信
1,254件の閲覧回数
jiri_kral
NXP Employee
NXP Employee

Hi, 

 

the dafault way how is RAM inicialized is by writting content of registers in a loop:

;# Fill SRAM with writes of 32GPRs

sram_loop:
e_stmw r0,0(r5) # Write all 32 registers to SRAM
e_addi r5,r5,128 # Increment the RAM pointer to next 128bytes
e_bdnz sram_loop # Loop for all of SRAM

 

and some registers contains different value than 0. You need to perform for example memset(...) on your structure prior to using it. Or you can modify the RAM init.