This error occurs because the linker does not have enough memory to link your target object. This is not common, but could be triggered for a number of reasons. For example, this may occur when linking very large objects/libraries together, or if you are generating a large amount of debug information, or if you have very large regions defined in your scatter-file. In these cases, your workstation may run out of (virtual) memory. This can also occur because of the use of FIXED in a scatter file. FIXED forces an execution region to become a "root region" in ROM at a fixed address. The linker may need to add padding bytes between the end of the previous execution region and theFIXED one, to generate the ROM image. The linker may run out of memory if huge amounts of padding are added where the FIXED region's address is far away from the end of the execution region. The link step might succeed if the gap is reduced. While the linker can generate images of almost any size, it will require a larger amount of memory in order to run and finish the link. There are several suggestions for improving your performance:
- Shut down all nonessential applications and processes when you are linking
For example, if you are running under CodeWarrior, try running your linker from the command line, or exiting and restarting CodeWarrior between builds. Minimizing the project window will also help.
- Use --no_debug command with your linker
This command will tell the linker to create the object without including any debug information. You cannot carry out source level debugging with that option, however. Note this option is -nodebug for ADS 1.2 and earlier.
- Reduce debug information
If you do not want to use the --no_debug switch (2), there are many ways you can try and reduce debug information:
- Avoid conditional #defines in header files, because the linker will not be able to remove common debug sections if they are not identical.
- Modify the C/C++ sources so that .h files are #included in the same order.
- Partition the header information into smaller blocks. i.e. use more, smaller header files rather than fewer, larger header files. This can help the linker to eliminate more of the common blocks.
- Only #include a header file if it is really needed in the C/C++ source file.
- Guard against multiply-including header files.
For instance, if you have a header file 'foo.h', then add:
#ifndef foo_h #define foo_h : // rest of header file as before : #endif /* foo_h */
Use the compiler option "--remarks" (RVCT) or '-W+g' (ADS) to warn about unguarded header files.
- Compile your code with the "--no_debug_macros" switch (RVCT) or "-gtp" (ADS), to discard preprocessor macro definitions from debug tables.
- Partial linking
You could also use partial linking to split the link stage over a few smaller operations. Doing so will also stop duplication of the object files in memory in the final link.
If you are still experiencing the same problem, it is recommended that you add some more memory to the host computer.
|