not enough code space to debug


I'm using Rowley Associates CrossStudio for ARM v1.7 build 4 (which relies on GCC C++ compiler) to develop a C++ program for an LPC2103. My problem is that I'm running out of code space (flash), mainly because some of the .cpp files I wrote have many class definitions, even though some of those classes are never instantiated from my application. I need to debug, so I need to keep all code optimizations off. Is there any way, keeping optimizations off, to tell the linker NOT to include the code for those classes that are never used by my application?

Thank you. Bill

Reply to
Loading thread data ...

Firstly you would be better off to put each class in a separate file so that other humans can find them then completely unreference files won't contribute to code size. Secondly make sure you don't use exception handling or run-time type info (RTTI) because the take a lot of space. See -fno-rtti -fno-exceptions. Thirdly the compiler and linker can conspire to remove unused, which might not be everything you consider unused, but the object files need to be prepared. See -ffunction-sections -fdata-sections for the compiler and -Wl,--gc-sections for linker.


Reply to
Peter Dickerson


You need to do a "garbage collected build" using gcc options:



and ld options:



Reply to
Andrew Jackson

I found exactly what I needed. In this environment, the option is called "Enable Unused Symbol Removal" (I need to set it to Yes) under "Build Options" of the properties of your solution. I have significantly more free code space now. Using the sept-by-step debugger, I see that some functions of several classes don't take now space in the chip because now I don't see dots (to the left of their lines) where I can put breakpoints.

At the lower level (at the calls to GCC), it must be doing what you guys said. Thank you.

Reply to

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.