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

Compiler error "Indirect call: parameters do not fit into registers"

Hi all,

I am new to using KEIL compiler. I am trying to compile a code and got this error. Can anyone explain what this error statement means? Anything to do with code banking?

Thanks alot!

Parents Reply Children
  • Hi Andy, Erik

    Thanks for the articles and advice....

    after much reading, I came to a conclusion what causes the problem. Would like to share here and seek your opinion also.

    In my code,

    unsigned short (*test) (unsigned long A1, unsigned short B1);
    

    From one of the article on "parameters and registers", the first parameter, A1 is passed in registers R4 to R7 while second parameter, B1 is passed in registers R4 & R5. Is this causing the error? Thank you once again.

  • Go back to the original error message, and read it again literally:

    "parameters do not fit into registers"

    What is that telling you?

    Now look at what you just wrote:

    "the first parameter, A1 is passed in registers R4 to R7 while second parameter, B1 is passed in registers R4 & R5."

    How many times have you just said that R4 & R5 are being used?

    Can this possibly work?

    Again, function pointers in C51 need a thorough understanding of the issues - you don't seem to have mastered this yet, so they are probably best avoided for now.

    Or, take Erik's approach: Just avoid them. Period.