Just a beginner with SDCC for MCS51. Have successfully ported code from Hi-Tech C to SDCC, target chip is SiLabs C8051F120. Using SiLabs IDE to invloke the compiler. Using approx 39K of the first 64K page of program Flash available on this chip.
Now when I try and add a few more lines of code the compiler stops and I get a message "Error - no more memory". Tried a few different variations in my code structure, get other errors like "Assertion failed DBUF->BUF != NULL…", or "Caught signal 22: SIGABRT".
Not finding any helpful information to debug these problems. Wondering if perhaps my PC that is doing the compiling is running out of RAM (Intel quad core, 4GB RAM)? Or at some stage in the compiling process the code produced is in a non-optimised state and hitting a 64K boundary? Any ideas?
Is that during compilation or while linking? I assume the first.
Do you have really big source files or just many?
It seems it is not the 64k mcu boundary, but the 4G pc limit.
Yes, the problems occur during the compile stage. I have fairly large files (the primary and largest .c file is 135KB or nearly 4000 lines of code inlcuding comments), only 5 x .c source files and 5 x .h header files in the project.
My desktop PC is running Windows 7 64 bit. Attempted to increase RAM from 4GB but to 8GB only to
discover 4GB is the limit for this motherboard :-( Increased Windows virtual memory settings from system managed 4096MB, to manual setting of min 8192MB & max 16384MB, error persists. Also configured windows ReadyBoost to use 4094MB of USB Flash drive to incease system performance, error persists.
To compare with another PC/operating system I installed SDCC and SiLabs IDE on my laptop (Intel Core 2 Duo, 2GHz, Win XP Pro, only 1GB RAM). Project compiles further than with above PC, why? Compile time is approx 15 minutes, vs 45 seconds on my desktop PC. Only crashes out on laptop with "error - no more memory" if I add in the final 4 lines of code that I need, a simple additonal if else condition to a series of 10 consecutive if else statements.
I guess you ran into the same problem as reported in bug 2855887:
As a work-around my advice is to split the code up into a few more source files.
You can also open a new bug and attach your sources (zipped) for us to reproduce the problem.
I have done the suggested work around now - by moving some of the code (800+ lines) that was in the source file containing main() to a new source file the project now compiles and runs ok. It now also comiles a little quicker (30s vs 45s). Thanks for your help~!