Hi Edward,
First of all I would like to apreciate your fast answer. I think the piece of code you have sent me, can be useful but it gives me a compiling error.
#include "derivative.h"
#define FSTATADR 0xFFFF9825
static volatile unsigned short PGM[] = {
0x117C,0x0080,0x9825, // MOVE.B #0x80, FSTATADR(A0)
// fpgmex1:
0x0828,0x0006,0x9825, // BTST #6, FSTATADR(A0)
0x67F8, // BEQ.B fpgmex1
0x4E75 // RTS
};
char FlashSectorErase(void *sector) {
(void)page;
FSTAT = 0x30;
*(long*)sector = 0; // write any data to long word aligned address
FCMD = 0x40;
asm {
LEA (0), A0
JSR PGM
}
return (char)(FSTAT & 0x30);
}
the label page is not defined. Where must it be defined??