We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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
"when run with debugger"
Presumably, you mean the Simulator?
"it not working"
In what way, precisely, is it "not working"?
"can anyone tell me why?"
Not on the scant inofrmation you've provided! Your question is a bit like, "my car won't work - what's wrong with it"
You need to do some more investigation to determine exactly what it is that is "not working".
Given that it "works" in the Simulator, a primary suspect must be your target hardware: Are you sure that your target hardware is working properly? In particular, its memory system. How have you proved it?
Is your target hardware correctly configured - memory controllers, etc?
Are you sure that your software is correctly configured for your target hardware? ie, not trying to access memory that doesn't exist...
i have try with keil example blinky, the program not working when load into flash memory, it ok when load into RAM. What should i configured?.
Does the target hardware actually work at all?
yes, LED is running when load into RAM. what should i do?
i also try to program ather example like "measure". it also same problem, not working when load into flash, i just used defaut setting in the example.
Have you clearly defined the memory map? Meaning you don't have any volatile variables located in the Flash?
all varibale defined like this
unsigned int sdata i; unsigned int sdata j;
i'm still not sure where it is locatated.
anyone have the working example project for board MCB167-NET, can share with me. send to my mail gogainet@yahoo.com.