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

Embedded programs stored in FLASH memory run incorrectly. why?

I have problem with global variable, when run with debugger, it can run correctly, but when it loaded into flash it not working. when i change global varibale to local variable, it run correctly in flash.
can anyone tell me why?.

Parents
  • When you change it to local, it's stored in a register or stack. In the debugger it's also RAM. Flash is read only.

    What's the problem exactly? Modifying the variable? Seems like a memory map issue; the global should be stored in (internal) RAM to be writable. Check the map/.m66 file to see where the variable is stored. The variable is stored in a data section. This section should be mapped to (internal) RAM instead of flash.

    It could also be an issue with the initialization/clearing of the variable but that depends on what you're trying to do. See
    www.keil.com/.../c166_ap_specialsections.htm

    --
    Joost Leeuwesteijn

Reply
  • When you change it to local, it's stored in a register or stack. In the debugger it's also RAM. Flash is read only.

    What's the problem exactly? Modifying the variable? Seems like a memory map issue; the global should be stored in (internal) RAM to be writable. Check the map/.m66 file to see where the variable is stored. The variable is stored in a data section. This section should be mapped to (internal) RAM instead of flash.

    It could also be an issue with the initialization/clearing of the variable but that depends on what you're trying to do. See
    www.keil.com/.../c166_ap_specialsections.htm

    --
    Joost Leeuwesteijn

Children
No data