code size problem cause system crash

Nick Clifton nickc@cambridge.redhat.com
Thu Apr 19 00:25:00 GMT 2001


Hi Jian,

> There is a strange bug in my system. if I compile a single file with a
> library, download and test it, it works fine. If I compile hundreds file
> swith the same library, download it and found out it will generate some
> exception in run time. Those exception is generated inside a ISR. Please
> give me some hint how to debug and solve this kind of bug.

It would help if you could provide some more information.  For
example, what system are you compiling (and linking) these files on ?
What is the target system that you are downloading to ?  How big is
the hundred-file program once it is compiled and linked ?

As for tracking down the bug, there are several approaches that you
could try:

  * Locate which ISR is failing.  This might give you a clue as to what
    is going wrong ?

  * Run the program on a different target.  It may be that there is a
    real bug in the program, not the tools that are used to create
    it.  If the same kind of problem happens with a different target
    this would point to that.

  * Run the program on a simulator.  You might then be able to
    backtrace through the ISR and find out where things start going
    wrong.

  * Try creating a cut down program.  eg Can you create a executable
    with only 50 files, not 100.  If so, does this fail ?  What if you
    change the 50 files that make up the program ?

  * Try creating a circular debug message buffer in the memory of your
    target system.  Create a function call that places a message into
    this buffer, placed after the last message that was inserted.
    Then library sprinkle calls to this debug function throughout your
    code.  When the system crashes, use your monitor to examine the
    circular buffer and work out where things went wrong.

Cheers
        Nick




More information about the Binutils mailing list