When I remove a little piece of code, what has no issue with the working of my program, the program doesn't work at all. Also I've got 2 function that aren't used at all, but when I remove them, my program won't work to. With not working I mean: it will compile and the program also starts but some program parts don't work. I've got ADuC842 uVision 3.30a I first thought it would be that I used up to much memory, but after removing unused code it also (doesn't) work(s). I have no idea where to look to solve this problem, if you have any ideas I'm happy to hear them.
Please provide more information. Any attempt to figure out what is causing your problem from the marginal information in your posting can safely be labeled as pure guesswork. When I remove a little piece of code, ... and how is anyone else supposed to know what this "little piece of code" is ? In any of my programs, I can pick a line of code that, when removed, will screw up the program completely. the program doesn't work at all. This lacks any useful information. What are the symptoms of "the program doesn't work at all." ? I've got 2 function that aren't used at all, Great. We haven't got those 2 functions and no clue whatsoever what code they contain. it will compile What about error messages or warnings ? the program also starts but some program parts don't work. This also lacks any information useful for diagnosis of the problem. if you have any ideas I could give you roughly 500 wild guesses, but I believe they would not get you any closer to a solution. So. Please provide more information.
When I remove a little piece of code it doesn't matter, it could be i=i; I've got 2 function that aren't used at all Well the function aren't used. So what does it matter what the function contain for code? but here's one...
/** * Saves settings to flash memory. * @param rwmath Pointer to rwmath ADT. */ void saveSettings(tRWMath *rwmath) { flashBytes(0x0, rwmath->VDRatioNominator, rwmath->VDRatioDenominator, 0x0, 0x0); }
it doesn't matter, it could be i=i; How do you know it does not matter ? Even seemlingy innocent code could cause timing issues. And even i = i; can matter a lot (if i is volatile or a register). Well the function aren't used. So what does it matter what the function contain for code? I assume you have read the appropriate chapters in the C51 and BL/LX51 documentation about uncalled functions and data overlaying ? The compiler and the linker have no way of knowing that a function is not used. They must assume that it is called somehow (for example by using a function pointer) in the course of the program, with all the implications this has on memory usage and overlaying. So what could happen ? Maybe the stack pointer is not initialized correctly and the stack moves into the RAM range used by your functions, but you never found out about it until now because the stack only overwrote the memory that is used by the two "unimportant" functions. Of course, you would never make such an obvious mistake, but without more information about the program, this guess is as good as any other. *** WARNING L16: UNCALLED FUNCTION, IGNORED FOR OVERLAY PROCESS NAME: ?CO?MAIN Hm, finally we're getting somewhere. The error message does look odd, though - it does not refer to an uncalled function, but to what looks like unused (and constant) data in code memory.