Keil Logo

BL51: AVOIDING FUNCTION POINTER PROBLEMS WITH NOOVERLAY


Information in this article applies to:

  • C51 Version 5.50 and later

QUESTION

I read Application Note 129 dealing with function pointers and have a question that is not explicitly answered within the app note.

All of the problems that are associated with function pointers seem to do with the data overlaying techniques used by the linker and the way arguments are passed. The app note states several times that the overlay directive may be used to "fix" the call tree that may not be correct when function pointers are used. If we use the NOOVERLAY directive, will all of these problems go away?

We are using the large memory model and have a relative overabundance of RAM. With RAM usage being a non-issue for us, and function pointers being of great importance, we are inclined to use the NOOVERLAY directive. We ran several test that indicate that this will work, but would like confirmation that there are not other side effects to disabling data overlaying.

ANSWER

There are no side effects from using NOOVERLAY and this will take care of the call tree analysis problem.

However, accessing variables in xdata is around 7 times slower than accessing variables in data memory. In addition, using the large memory model increases the size of your code and slows down execution. So the ideal solution is to use the small memory model, locate specific variables in xdata and fix the call tree for your indirect function calls.

MORE INFORMATION

SEE ALSO

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Friday, July 15, 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.