Hallo,
ich möchte den Flash-Speicher eines LPC2387 aus dem Programm heraus
beschreiben.
Hier mein Code:
1 | uint32_t iap_command[5];
|
2 | uint32_t iap_result[3];
|
3 | typedef void (*IAP)(uint32_t [],uint32_t []);
|
4 | static const IAP iap_entry = (IAP)IAP_LOCATION;
|
5 |
|
6 | iap_command[0] = IAP_PREPARE;
|
7 | iap_command[1] = sector;
|
8 | iap_command[2] = sector;
|
9 | iap_entry(iap_command, iap_result); // Prepare the sector(s).
|
10 |
|
11 | iap_command[0] = IAP_COPY; // Copy RAM to flash.
|
12 | iap_command[1] = writeptr; // Destination in flash.
|
13 | iap_command[2] = codebuffer; // Source in RAM.
|
14 | iap_command[3] = ctr; // Size in bytes.
|
15 | iap_command[4] = Fcclk / 1000UL; // System clock in kHz.
|
16 | iap_entry(iap_command, iap_result); // Copy RAM to flash.
|
Nach beiden aufrufen von iap_entry() ist iap_result[0]==0, deswegen gehe
ich davon aus dass beide Befehle erfolgreich ausgeführt wurden.
Wenn ich mir aber die gerade beschriebene Stelle im Flash per JTAG
anschaue, hat sich nichts geändert.
Hat irgendjemand eine Idee, was da noch fehlen könnte? Ich habe mehrere
Beispielcodes gesehen, die jedoch alle genau so aussehen wie meiner.
Danke schon mal im voraus,
Laurenz