Keil Logo

GENERAL: PROGRAM FAILS AFTER ADDING CODE


Information in this article applies to:

  • C166 Version 3.12
  • C166 Version 4.10a
  • C251 Version 1.24
  • C251 Version 2.14
  • C251 Version 3.00
  • C51 Version 5.50a
  • C51 Version 6.10a

QUESTION

I have written a program that seems to work just fine. Now, I've added a few new features to my program and it no longer works. What suggestions do you have?

ANSWER

There are any number of reasons why a program stops working when you add new code:

  • The new code may have fatal bugs
  • You may have run out of CODE memory
  • You may have run out of DATA or XDATA memory
  • Your program may be overwriting the STACK
  • Your program may be overwriting its variables

The following suggestions may help:

  1. Go back to the version of the software that worked.
  2. Generate a MAP file from the linker and save it or print it out.
  3. Start adding modules one-by-one until the program fails.
  4. Print out the MAP file for this version and compare it to the first.

Here are a few things to look for:

  • The total program code going past the end of your ROM (or EPROM)
  • The total program data (or XDATA) going past the end of RAM
  • A variable or something like it that should not be where it is
  • Check that you have the highest error/warning level turned on and correct ALL compiler and linker errors and warnings
  • Use PC-Lint to check your C source code

Last Reviewed: Saturday, July 9, 2005


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.