I've been trying to troubleshoot a mysterious problem for a few days now, and I hope someone here can give me some ideas. We are using UV3 and C51 (ver 7.50) to develop an application for Cypress FX2 LP which is a 8051 variant with 16KB RAM (which may be shared for code and data). For applications of up to about 11KB in code size, everything works fine. When the program exceeds 11KB, strange problems pop up. Calling some (valid!) functions trigger a system reset. Adding a line to a function that no one ever calls, and the system goes into infinite reboot loop. Adding a dummy file with some uncalled functions, same thing happens. Adding a redundant function call that does nothing and everything goes back no normal, until the next time some other line changes. To make a long story short - total chaos! I can't understand the logic of any of this, and it happens only beyond a certain program size. The program compiles and links with no errors (except "uncalled segment" warning if 'dummy' uncalled functions are inserted). The problem is very distrurbing and very chaotic - the program may run fine up to a certain point, then reboots with no apparent cause at all. Comment out an unused function and all goes well. Another thing I noticed - if I tell the linker to move the program in memory, the fault point shifts randomly to someplace else. We've ruled out a H/W problem or a defective CPU. Has anyone ever encountered something so odd, and can you give me any ideas on how to troubleshoot? Thanks in advance, Ran Shalgi Siano Mobile Silicon
1. Could you please explain what you mean by "Atmoicity problem"? The crash happens simply when function A calls function B. B never gets called and the CPU restarts. Strangely, if I remove code from other areas of the program (which don't get called at all in this scenario), cutting down on program and data size, the problem disappears. 2. The sequence is easily reproducible, but I don't know how to debug it. The application is too big to fit with the back-end monitor of the debugger, and if I trim my application to be small enough, the problem disappears. It does not reproduce on the simulator under any conditions.
Could you please explain what you mean by "Atomicity problem"? If a variable of more than one byte is used at more than one level. the classic example is the global SerialPointer used both in the main and the ISR. Cypress FX2 LP I have never used this chip, but for example for the Philips LPC932 the upper 512 bytes are reserved, are you running into a similar problem? Erik
1. At the crash point, I only have "main" running. All ISRs are disabled. 2. My understanding is that the chip has 256 bytes of internal memory. The lower 128 are directly accessible and the higher 128 are indirectly accessible. Internal data in my application consumes almost all of the lower 128 with the stack immediately following.