CodeWarrior Linker Omits Modules

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CodeWarrior Linker Omits Modules

575 Views
davekellogg
Contributor II

Hi All,

I'm using CodeWarrior v5.1, targeting a 9S12XEQ512.  I'm using the command line tools, with a hand-build linker script file.

 

This has been working fine for months.  Last week, I added a dozen more lines of code and a couple more variables, and now it won't link.  At first, I suspected that I'd run out of memory in one page or another.  After studying the maps (both before and after failure) in detail, I observe:

1.  For whatever reason, CodeWarrior omits 3 object modules from the link.  They simply no longer are listed in the FILE SECTION in the map.

2.  The linker issues warnings for several declarations that it thinks I did not supply definitions for.  In reality, the definitions are in the modules that are ommitted.

3.  Every section of memory (.text, .bss, .data, copy down, et al) has more than sufficient space available, usually by a factor of two.  I can't find any placement section overflows anywhere.

 

This does not seem like an especially large project.  I have used space in only 5 flash pages, leaving 11 still unused.  I'm using about 5K of a 12K RAM area.  I do have a lot of global symbols (~1214), but I'd think that CW should be able to handle that.  There are 78 object modules.

 

For what it is worth, some more details:

1.  I'm using the XGATE on the part. The XGATE code, data, verctors, etc occupy about 2.2K, and is in RAM.  The start-up copydown loads the XGATE's RAM.

2.  My three missing modules are three (of four) containing the XGATE code and infrastructure.  At first, I thougth my problem had something to do with the XGATE.  But I have not touched that code in months.  I have good version control, so I would see if there was some inadvertant changes.  My present hypothesis is that the reason for the XGATE modules to be missing (vs something else) is that I alphabetize all of my lists of files.  The XGATE source files have a (helpful) XG prefix, so they are at the end of the file list.

 

At this point, I think I've ruled out a lot of the easy possiblities.

Questions:

========

1.  Has anyone ever run across a similar type of problem?  I don't want to be too quick to blame the tool chain.  However, I'm speculating that perhaps I've over-stressed the linker's internal working pool of memory.  I just can't imagine how else the linker would simply refuse to say anything about the three missing object files.  Maybe the linker tries to open all 78 object files at one time, and runs out of file handles, or or internal buffer space, or something.  BTW, the linker fails identically on both my PC (Win7, 4GB RAM) and my laptop (Win XP).

 

2.  I don't know if this will help, but I'm contemplating replacing my single link with a partial link step, followed by a complete link.  In other words, try to do two smaller links.  Maybe that would reduce the overall demands on the linker.  Any thoughts on how to best approach this?

 

3. If anyone has a similar sized project (or larger), I'd appreciate hearing that it links OK.  I'd be interested in how many object files, rough code and data size, and approximate number of global symbols.

 

4.  Any other suggestions?  I'm rather stuck here.

 

Thanks!!

Dave Kellogg

Labels (1)
0 Kudos
1 Reply

312 Views
kef
Specialist I

Dave,

I don't have good ideas, but

  1. Linker should follow specified link order and not alphabetize modules. Using IDE, link order is specified in link order tab. Using build script, I think it should follow the order in some list of modules.
  2. Since you are speaking about several XGATE files in the same project. I hope you know that

#include <hidef.h>

on top of CW project wizard generated xgate.cxgate file is not optional but mandatory! This line should be present in all XGATE C modules, because hidef.h contains important #pragmas, which let XGATE code, data and consts to be placed into XGATE specific placements.

0 Kudos