I defined a reentrant function with 4 long arguments like this (excerpt from the lst)
21 unsigned long func0(unsigned long a, unsigned long b, unsigned long c, unsigned long d) large reentrant 22 { 23 1 printf("--- Now in func 0 Calling bank A\n"); 24 1 func5A(a,b,c,d); 25 1 printf("--- Calling bank B\n"); 26 1 func8B(d,c,b,a); 27 1 return a+b+c+d; 28 1 }
Did you setup the reentrant stack pointer in the startup code? http://www.keil.com/support/docs/671.htm Jon
Thanks for answering. It works fine now.
Another problem arose. What is the stack pointer of the reentrant functions and how to set it in the program, in C or ASM?
I found the ?C_XBP is the reentrant stack pointer. Is there any way to locate it to a fixed address? I mean, I want to fix it at, say, D:0x08, and nowhere else. Thanks!
I found the answer in http://www.keil.com/support/docs/1431.htm. Thanks anyway :)