This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Access a function using address

Since the c51 compiler does not support the recursive call of a function is there any way to find out on which address location the function which is to be called as a recursive is located?

That is, is there any way to implement the recursive call funtion in a similar way of a software reset i.e just call like this ,

((void (code *) (void)) 0x0000) ();

Parents
  • The tools do support recursion. Just declare the function with the reentrant keyword. See the manual for configuring the software stack.

    Note that there is signficant overhead for using this feature. The 8051 architecture is pretty bad at indirect references (such as those needed to use parameters/locaks on a stack) and the compiler doesn't get to do its nifty data overlaying optimizations.

    The name of the function is the address of the start of the function. It's a pointer. I don't think that will really help you, though, unless the body of the function generated by the compiler understands that it can exist multiple times at once and so includes code to look on a stack for parameters, locals, etc.

Reply
  • The tools do support recursion. Just declare the function with the reentrant keyword. See the manual for configuring the software stack.

    Note that there is signficant overhead for using this feature. The 8051 architecture is pretty bad at indirect references (such as those needed to use parameters/locaks on a stack) and the compiler doesn't get to do its nifty data overlaying optimizations.

    The name of the function is the address of the start of the function. It's a pointer. I don't think that will really help you, though, unless the body of the function generated by the compiler understands that it can exist multiple times at once and so includes code to look on a stack for parameters, locals, etc.

Children