This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

run code from xdata (internal ram)

I want to run a short function from internal xdata!

I use the DS80C390, I use the configuration with my internal xdata on 00F000h–00FFFFh and no external xdata. I have 128k code space.

IDM   = b00
P4CNT = b100

I have a byte array which I use to allocate space in the xdata range:

 xdata tyu8 aru8Code[SIZE];

Here I copy my function to xdata:

  tyu8 code* u8CodePtr;
  tyu8 u8Index = 0;

  for
  (
    u8CodePtr = ((tyu8 code*) MyFunc);
    u8CodePtr < ((tyu8 code*) MyFunc+SIZE);
    u8CodePtr++, u8Index++
  )
  {
    aru8Code[u8Index] = *u8CodePtr;
  }

Here I want to call my function in xdata:

((void(*)(void)) aru8Code)();

Somehow it doesn't work, the processor restarts all the time. What am I missing?