This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to read flash in C - c8051F020

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.

Parents Reply Children
  • You're right, but first I need to write a string in rom, and then read one character at a time.
    If I declare "char code string[5]", as instance, I can't write in it, even if I use a xdata pointer.
    So I did this:

    unsigned char xdata vector[10];
    unsigned char code *pflashread;

    unsigned char xdata *pflashwrite;

    pflashread = 0xbbbb;

    pflashwrite = pflashread;

    write_flash(pflashwrite,vector);

    var_2 = pflashread[0]; //here I read directly

    Don't think I haven't try a few things before this.

  • Is that necessarily true?

    Don't these SiLabs chips have the facility to map Flash into XDATA space...?