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

Recursive functions & XRAM variables

Hi,

how do I programm a recursive function? The compiler always puts variables in registers, therefore the function cannot be called recursivly.

An other question, how do I put variables in XRAM? With IRAM it works because of the iram specifier. Is there something similar for XRAM?

Thanks for help

Bert Weber

  • The compiler always puts variables in registers, therefore the function cannot be called recursivly.

    Wrong. When calling a function, the compiler saves the registers that can be changed by the function on the stack. This way recursion works just fine: the stack grows, local variables don't get overwritten.

    With IRAM it works because of the iram specifier. Is there something similar for XRAM?

    Sort of: sdata may do. Any particular reason why you want variables in XRAM as opposed to other RAM in your system?

    Regards,
    - mike

  • how do I programm a recursive function

    Take a look at the reentrant function specifier.

    Jon