??? 07/09/08 12:46 Read: times |
#156554 - Finding Cause of Corruption Responding to: ???'s previous message |
Chris:
Have you had some opportunity to try to look at the underlying code produced by your tool set to determine if the stack pointer or 2nd -> 4th register sets are the cause of your corruption? It sounds like you feel reasonably comfortable with the assembler language level look of the 8051. The reason I asked about how you go about debugging was that one strong method to isolate and understand problems like this to look directly at what is writing to the corruption area of the memory. This close look is by nature going to be right at the MCU hardware/architecture level. That is of course going to be in the assembler view at the CPU register level. Now whilst the problem you are encountering may or may not be one of the two scenarios that I had proposed it is still possible that the issue centers not on a fundamental C language mistake but instead on a error in how the C solution maps to the unique characteristics of the 8051 and its hardware architecture. Debugging at the level of the MCU itself is also very good way to gain a thorough understanding of how the C compiler translates the high level code to the target machine environment. The 8051 environment is unique enough that the vendors of the better compilers have gone to great lengths to optimize the translation and mapping process. In the long run you'll be most successful with producing working programs from C if you have a firm grasp on how your particular compiler does these things. Michael Karas |
Topic | Author | Date |
Data Array getting corrupted after init | 01/01/70 00:00 | |
OnePossibleIdea.... | 01/01/70 00:00 | |
I did not do anything with the stack | 01/01/70 00:00 | |
As Michael said.... | 01/01/70 00:00 | |
How do you test and debug code? | 01/01/70 00:00 | |
Keil is the only thing in place | 01/01/70 00:00 | |
'crap'?? | 01/01/70 00:00 | |
Is this the book you refer? | 01/01/70 00:00 | |
nope | 01/01/70 00:00 | |
Erik | 01/01/70 00:00 | |
So where is the code | 01/01/70 00:00 | |
do NOT "put them" | 01/01/70 00:00 | |
Focus | 01/01/70 00:00 | |
Simulator | 01/01/70 00:00 | |
So this is on a simulator? | 01/01/70 00:00 | |
Post your duff code | 01/01/70 00:00 | |
Finding Cause of Corruption | 01/01/70 00:00 | |
Get the C right, then look at the target CPU | 01/01/70 00:00 | |
Optimizing Compilers | 01/01/70 00:00 | |
In my experience..... | 01/01/70 00:00 | |
Keil C 51 Optimizations | 01/01/70 00:00 | |
Use IAR then | 01/01/70 00:00 | |
different approaches | 01/01/70 00:00 | |
sometimes, depends | 01/01/70 00:00 | |
Thanks![]() | 01/01/70 00:00 |