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; }
#define FLASH_STARTB XVAR (unsigned char, 0x000000)
By external XRAM do you mean on-chip XRAM or off-chip external RAM? I can't really see a problem. Addresses around 0x00FA00 correspond to on-chip IRAM, and addresses around 0x80FA00 correspond to whatever there is connected to external bus. External memory area mapped to addresses corresponding to IRAM, SFR, ESFR, X-peripherals is inaccessible through these addresses (see microcontroller manual.) - Mike
Thanks for the reminder Mike, I had forgotten about the internally mapped addresses down there (heat of the battle and all). ~Tim