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

Xhuge Pointer Writing to System Stack in IRAM Area

Hi Everyone,
I'm using xhuge pointers to reprogram the code storage flash devices on my target hardware while it's in operation and have run across something I don't understand. I reviewed Keil appnote 138 and am able to copy the flash programming module (C module not ASM) into XRAM and run that code while erasing and reprogramming the flash. I'm using a xhuge pointer to read/write the flash devices as follows (simplified):


void Write(unsigned long lAdr, unsigned char cData)
  {
  volatile unsigned char xhuge *FlashPointer;

  FlashPointer = &FLASH_STARTB; //Base address
  FlashPointer += lAdr; //Add in write offset
  *FlashPointer = cData; //Write data

  return;
  }

The base address constant is defined using the XVAR macro as:

#define FLASH_STARTB XVAR (unsigned char, 0x000000)

What I found is that when the pointer is set to address's in the 0xFA00 region the system stack data in internal RAM is written to instead of the external XRAM (with the predictable results). I got around the problem by specifying the flash base address as 0x800000 instead of 0x000000 and all works as it should now (A23 is not connected to the flash anyway) but I'd really like to understand why the pointer accessed internal processor RAM space and not XRAM as I intended. Thanks in advance for any (helpfull...)suggestions.

~Tim

Parents Reply Children
No data