Hi, the problem is that the compiler uses MOVX instead of MOVC when I'm reading the rom, of course it doesn't work. There's no problem to write the flash. I don't want to add an assembly routine. Is there any other solution? I'm using Silabs C8051F020.
Thanks.
" ... so you have to initialize the code variable with 0xff"
Eh?!
If writing can only clear bits (as, indeed, is usually the case with flash), then how can you initialise the variable to 0xFF other than by erasing?!
You do it by originally storing the value 0xff in the variables while flashing the program. Then the program may replace these 0xff with other values.