Gast
#558091
Hi,
ich versuche auf dem lpc2148 ein paar Varriablen im Flash abzulegen.
Das schreiben ins Flash wollte ich folgendermassen realisieren:
Header:
/* IAP commands and varriables for flash programming */
// IAP start location on flash
#define IAP_LOCATION 0x7FFFFFF1
// contains parameters for IAP command
unsigned long iap_command[5];
// contains results, returned by "Blankcheck sector(s)"
unsigned long iap_result[2];
// typedefinition for IAP entry function
typedef void (*IAP) (unsigned long[],unsigned long[]);
IAP IAP_Entry;
.c File:
void IAP_Write (void)
{
// setting function pointer
IAP_Entry = (IAP) IAP_LOCATION;
// IAP write command for prepare sectors for write
// set command code
iap_command[0] = 0x5010;
// set start sector number
iap_command[1] = 0x00070000;
// set stop sector number
iap_command[2] = 0x00070001;
// these parameters not in use
iap_command[3] = 0;
iap_command[4] = 0;
// prepare sectors for write
IAP_Entry(iap_command,iap_result);
// Copy RAM to Flash
// set command code
iap_command[0] = 0x5110;
// destination flash where data byte to be written
iap_command[1] = 0x00070000;
// source RAM address where data bytes are to be read
iap_command[2] = (unsigned long)&test;
// number of bytes to be written
iap_command[3] = 256;
// set system clock frequency, unit kHz
iap_command[4] = 60000;
// prepare sectors for write
IAP_Entry(iap_command,iap_result);
}
Wobei ich die Varriable unsigned char test im Falsh ablegen wollte.
Ausser stillzustehn macht das Programm allerdings nichtsmehr.
Kann mich jmd auf meine groben Denkfeheler hinweisen und/oder mir einen
Beispiel code posten?!?
mfg
Marco