DMA can't copy code to PSPR memory location in which existed already code

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User18223
Level 1
Level 1
Hello,

i'm using TC275,
i'm using DMA to copy code from PFlash0 to PSPR. i noticed that DMA was not able to overwrite a memory region in which exists already some code. is it normal or i need to do some config to permit the overwrite.

below a part of code that i'm using, the DMA was not able to copy m() [ located at 0x80008800 ] to 0x701001b0 in which there is already f() code.

i compiled f() and m() with -mcode-pic option.

// f()
RESETANDSTARTPERFCOUNTER0(IfxCpu_CounterMode_normal);

SRC_DST_SIZE_SPEC0((uint32)0x80003800 ,(uint32) 0x701001b0 ,(uint16)40);
dma_transfer_launch0();

fperf = IfxCpu_stopCounters();
f_DMA_cycles = fperf.clock.counter;


RESETANDSTARTPERFCOUNTER0(IfxCpu_CounterMode_normal);

((functiontype0)0xC00001b0)();

fperf = IfxCpu_stopCounters();
f_cycles = fperf.clock.counter;

// m()
RESETANDSTARTPERFCOUNTER0(IfxCpu_CounterMode_normal);

SRC_DST_SIZE_SPEC0((uint32)0x80008800 ,(uint32) 0x701001b0 ,(uint16)8);
dma_transfer_launch0();

fperf = IfxCpu_stopCounters();
m_DMA_cycles = fperf.clock.counter;


RESETANDSTARTPERFCOUNTER0(IfxCpu_CounterMode_normal);

((functiontype0)0xC00001b0)();

fperf = IfxCpu_stopCounters();

m_cycles = fperf.clock.counter;



Thank you
0 Likes
1 Reply
MoD
Employee
Employee
50 likes received 500 replies posted 100 solutions authored
There is no limitation to do this except that your software configure any memory protection which don't allow the copy.
The code above will be work only on CPU0 because the call to function is to a local address.
Is there any error message from the DMA? DAM is triggered correct?
0 Likes