S32R274 copy to ram issues

cancel
Showing results for 
Search instead for 
Did you mean: 

S32R274 copy to ram issues

Jump to solution
199 Views
makouda
Contributor I
Hello 
working on  S32R274. I noticed strange behavior with copying data from ROM to RAM
I can see that only chunks of code are copied to RAM. Other RAM areas are just ?????
this behavior happens even if I run step by step
board powered at 12V output up to 3.5A
 
makouda_0-1631790833325.png

 

 
0 Kudos
1 Solution
186 Views
makouda
Contributor I

well, resolved by adding RAM init assembly code

___asm(ramStart = 0x40000000                    ;/* RAM start address*/)
___asm(ramSize = 0x180000                       ;/* RAM size - System RAM only (384K)*/)
___asm(ramCount =  ramSize/64                   ; /*calculate count variable*/)
__as1( e_lis       r2, ramCount@ha              ; /*Loop counter to get all of L2SRAM*/)
__as2( e_add16i    r2, r2, ramCount@l           
___asm( se_mtctr    r2                          ; /*Store in count register*/)
__as1( e_lis       r1, ramStart@ha              ; /*r1 holds base address of the L2SRAM, 64-bit word aligned*/)
__as2( e_add16i    r1, r1, ramStart@l           ; /*Add low address*/)
___asm(_init_l2ram_loop:)
__as1( e_stmw      r16,0(r1)                    ; /*Write values of GPR 17-32 at once, these still contain the init pattern all 0*/)
__as2( e_addi      r1,r1,64                     ; /*Increment write address*/)
___asm( e_bdnz      _init_l2ram_loop            ; /*Decrement count register and jump*/)

View solution in original post

0 Kudos
1 Reply
187 Views
makouda
Contributor I

well, resolved by adding RAM init assembly code

___asm(ramStart = 0x40000000                    ;/* RAM start address*/)
___asm(ramSize = 0x180000                       ;/* RAM size - System RAM only (384K)*/)
___asm(ramCount =  ramSize/64                   ; /*calculate count variable*/)
__as1( e_lis       r2, ramCount@ha              ; /*Loop counter to get all of L2SRAM*/)
__as2( e_add16i    r2, r2, ramCount@l           
___asm( se_mtctr    r2                          ; /*Store in count register*/)
__as1( e_lis       r1, ramStart@ha              ; /*r1 holds base address of the L2SRAM, 64-bit word aligned*/)
__as2( e_add16i    r1, r1, ramStart@l           ; /*Add low address*/)
___asm(_init_l2ram_loop:)
__as1( e_stmw      r16,0(r1)                    ; /*Write values of GPR 17-32 at once, these still contain the init pattern all 0*/)
__as2( e_addi      r1,r1,64                     ; /*Increment write address*/)
___asm( e_bdnz      _init_l2ram_loop            ; /*Decrement count register and jump*/)
0 Kudos