AnsweredAssumed Answered

problem when access paged ram variable by pointer

Question asked by everk image on May 24, 2020
Latest reply on May 27, 2020 by Edward Karpicz

My mcu is MC9S12XE.

I have defined a variable named such as msg_buffer in the PAGED RAM,and it's actually allocated address is F91000.I want to put data into this buffer using pointer,but doesn't work.Codes look like this:

pbsor = msg;

pbdst = msg_buffer;

for(i = 0; i < size; ++i)

   *pbdst++ = *pbsor++;

But when i defined pbdst with prefix '__far',it works.

 

When i use prefix '__far' in the function which get data from msg buffer,it doesn't work.Codes look like this:

pbsor = msg_buffer;

pbdst = msg;

for(i = 0; i < size; ++i)

   *pbdst++ = *pbsor;

But when i defiend pbsor without prefix '__far',it works.

 

why does it execute like this?By the way,the variable msg allocated in the stack,and stack is allocated in the UNPAGEED RAM(0x2000~0x3FFF).

Outcomes