This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Class method in RAM problem

I'm getting different assembly on my F28069 (non BIOS/DSP), depending on whether it's run in RAM or flash. If run in ram, the program counter goes off into the function in memory before it (due to the SB -47, NOV). The case in particular, I'm calling FindPosition with parameters passed by value, and initially in the function this happens:

008132: 9211 MOV AL, @0x11
008133: 0B60 DEC *-SP[32]
008134: 0536 ADD ACC, @0x36 << 16
008135: 6AD1 SB -47, NOV
008136: 0718 ADDL ACC, @0x18
008137: 9831 OR @0x31, AL
008138: 4CE0 TBIT *+XAR0[4], #0xc
008139: 775F NOP *-SP[31]

As opposed to running in flash:

3f1424: FE18 ADDB SP, #24
3f1425: E203024A MOV32 *-SP[10], R2H
3f1427: E2030148 MOV32 *-SP[8], R1H
3f1429: E2030046 MOV32 *-SP[6], R0H
3f142b: A844 MOVL *-SP[4], XAR4


Here's the two entries in the map for ram:

name origin length used unused attr fill
---------------------- -------- --------- -------- -------- ---- --------

PAGE 0:
RAML0 00008000 00000800 00000208 000005f8 RWIX

...

00008012 _CheckPosition1__8MotorSetFi12u_HallSensor

00008132 _FindPosition__5TableFfN21


The flash version runs with no problems. Any guidance?


-Kirby

  • Well, it was a stupid mistake on my part. I had the wrong parameters in memcpy. I unknowingly used some of the same parameters as MemCopy, so the wrong code was being copied from flash to ram.

    It's supposed to memcpy(runstart, loadstart, (uint32_t)loadsize)