Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

EEprom with Flash program bug ?

EEprom with Flash program bug ?

2005-10-04 by Bruce Paterson

Hi,
 
I've been attempting to use a variant of the "EEprom" flash simulation
program posted here by Robert.
In ee-write I think I've found a bug, or at least something I don't
understand. Apologies if this has come up before; I haven't noticed it.
 
.....
  location = ee_locate();
.....
  destination = (unsigned int *) ((&ee_buffer[0])+((unsigned
int)location & EE_BUFFER_MASK));
  source = (unsigned int *) command_ee;
  for(i=EE_REC_SIZE/4;i>0;i--) *(destination++) = *(source++);
 
  //prepare sectors from EE_SEC_L to EE_SEC_H for erase
.....
  command_iap[0]=51;     //copy RAM to flash/eeprom
  command_iap[1]=(unsigned int) (location & EE_START_MASK);
  command_iap[2]=(unsigned int) (&ee_buffer[0]);
  command_iap[3]=EE_BUFFER_SIZE;
  command_iap[4]=EE_CCLK;
  iap_entry=(IAP) IAP_LOCATION;
  iap_entry(command_iap,result_iap);

  command_iap[0]=56;     //compare RAM and flash/eeprom
  command_iap[1]=(unsigned int) source;
  command_iap[2]=(unsigned int) destination;
  command_iap[3]=EE_REC_SIZE;
  iap_entry=(IAP) IAP_LOCATION;
  iap_entry(command_iap,result_iap);
 
In above comparison, surely "source" and "destination" are not what we
want to compare.
Firstly, they both point *after* the relevant areas because we
incremented the pointers in the copy earlier, and secondly, they
are both RAM pointers, whereas I thought we wanted to compare ROM and
RAM ?
 
Suspect it should be something like:
 
  source = (unsigned int *) ((&ee_buffer[0])+((unsigned int)location &
EE_BUFFER_MASK));
  command_iap[0]=56;     //compare RAM and flash/eeprom
  command_iap[1]=(unsigned int) source;
  command_iap[2]=(unsigned int) location;
  command_iap[3]=EE_REC_SIZE;
  iap_entry=(IAP) IAP_LOCATION;
  iap_entry(command_iap,result_iap);
  result_ee[0]=result_iap[0];
 
Cheers,
Bruce




[Non-text portions of this message have been removed]

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.