-how do i setup so my flash routines emualte from ram
-someone must have done this recently, any help thanks
-how do i get the linker to build the ram code and load it into ram at startup
-has all this been done before? i need to flash page erase and byte write
flash.c functions are below:
#pragma DATA_SEG _FLASH_TOOL
static void Flash_Erase (unsigned int FlashAddress){
FixedAddres = FlashAddress;
// DataToWrite = 0xFF;
// Ram_Routine[22] = 0x40;
// __asm jsr Ram_Routine;
if(FSTAT & 0x10) FSTAT |= 0x10; //Check to see if FACCERR is set, write a 1 to FACCERR to clear error
*(unsigned char *)FixedAddres = 0xFF; //write anything anywhere in the page to erase
FCMD = 0x40; //load flash command type.
FSTAT |= 0x80; //Put FSTAT/FCBEF = launch a new burst command & wait 4 cycles
_asm NOP;
_asm NOP;
_asm NOP;
_asm NOP;
_asm NOP;
_asm NOP;
_asm NOP;
_asm NOP;
// if (FSTAT&0x30)return; //check to see if FSTAT/FACCERR = an error occuredor FVIOL are set
while (!(FSTAT & 0x40)); //else wait for comand to complete
}//void Flash_Erase (unsign
//************************
//*************>>> stores a byte of data onto the Flash at the given address **************************************
static void Flash_Program(unsigned char data){
//Check to see if FACCERR is set
if (FSTAT & 0x10) FSTAT |= 0x10; //write a 1 to FACCERR to clear
//write to flash
*(unsigned char *)FixedAddres = (unsigned char)data;
FCMD = 0x20; //set command type & launch operation, wait 4 cyc.
FSTAT |= 0x80;
_asm NOP;
_asm NOP;
_asm NOP;
_asm NOP;
_asm NOP;
_asm NOP;
_asm NOP;
_asm NOP;
// if(FSTAT&0x30) return; //check to see if FACCERR or FVIOL are set
while (!(FSTAT & 0x40)); //else wait for comand to complete
}//void Flash_Program(By...
#pragma DATA_SEG DEFAULT
//************************
flash.h
#pragma DATA_SEG _FLASH_TOOL
static void Flash_Erase (unsigned int);
static void Flash_Program(unsigned char);
#pragma CODE_SEG DEFAULT
mylinker.prn
SEGMENTS
Z_RAM = READ_WRITE 0x0046 TO 0x00FF;
RAM = READ_WRITE 0x0100 TO 0x04FF;
PATCH_RAM = READ_WRITE 0x0500 TO 0x06FF;
FLASH_TOOL= READ_WRITE 0x0700 TO 0x07C7;
PLACEMENT
DEFAULT_ROM INTO ROM;
DEFAULT_RAM INTO RAM, RAM2;
_FLASH_TOOL INTO FLASH_TOOL;