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?.
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