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