I wrote a software module much like described in "IN-SYSTEM FLASH PROGRAMMING WITH C51", which is an article from the Keil Software Knowledgebase, but when i'm debugging it looks like Keil loses synchonisation completely!! My application software calls a few functions to (in-system) program an external Flash memory. The source code of these functions is stored in the external flash, so I copy this code to a known location in the internal SRAM first(using the macro from SROM.h). My LX51 locate tab looks as below: XDATA (X:0x0-X:0x3000), HDATA (X:0x0-X:0x3000), SROM(C:0x8000-C:0x9000), CODE_FLASHMEM(C:0xF000-C:0xFFFF) [] So the code is STORED at X: 0x3000 and will be EXECUTED from C: 0xF000 Now, when i have downloaded the application and go into debug mode the application single stepping goes fine. Copying the Flash programming functions from Flash to SRAM is not a problem, but problems appear when i step through these copied functions. Keil ignores breakpoints most of the time and just keeps on running, when i stop the processor, the cursor is at a completely (random) wrong line!! Can anyone explain this behaviour or also has encountered this problem?? P.S.: When i use the Flash programming functions in a separate project that is downloaded into SRAM they work properly!! P.S.: uVision2 V2.32 C51 V7.02b A51 V7.02a LX51 3.51p
I saw some pretty strange things when doing this with the C166 processor. I solved my problems by turning off all optimization as suggested by another member of this forum. http://www.keil.com/forum/docs/thread1239.asp Not sure if it will clear up your problems but its worth a try. You can always turn it back on after everything is debugged and working correctly to save some code space. Good luck