MPC5777C Shared RAM initialization problem (Garbage Value)

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

MPC5777C Shared RAM initialization problem (Garbage Value)

Jump to solution
891 Views
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 Kudos
1 Solution
822 Views
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. 

 

View solution in original post

2 Replies
888 Views
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 Kudos
823 Views
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.