Hi, while playing with calling external C functions (with an intention to run larger drivers - fat, tft, etc) I see the rstack of max 256 bytes is not enough. Even a smaller Cfun (with rtc running in intr) consumes ~240bytes of rstack (rstack is used as the Cfun stack afaik).
I did following (I would suggest that for pic24/33 as the default setting, as the current sizing is not sufficient with these parts):
As the rstack (pstack) size is stored as a single byte in Operator_area, I am using N multiplies of 16bytes now.
The change is simple (param stack is not critical, but let us do it consistent):
24/33configs:
----------------
;;; USER AREA sizes for the OPERATOR task
.equ RETURN_STACK_SIZE, 20 ; 320, N*16 cells return stack
.equ PARAMETER_STACK_SIZE, 6 ; 96, N*16 cells parameter stack
ff os .s:
------------------
.equ urbuf, ustart-us0 + UADDSIZE + 2 ; return stack
.equ usbuf, urbuf + (16*RETURN_STACK_SIZE) ; Parameter stack
.equ usbuf0, usbuf - 2
.equ utibbuf, usbuf + (16*PARAMETER_STACK_SIZE) ; Terminal Input buffer
;;; Initial USER area pointer (operator)
.equ u0, ustart-us0
.equ uareasize, -us0+(16*RETURN_STACK_SIZE)+(16*PARAMETER_STACK_SIZE)+TIB_SIZE+HOLD_SIZE+UADDSIZE+2
stack dumps:
-----------------------------
hex r0 @ operator 3 + c@ 16 * dump
hex s0 @ operator 4 + c@ 16 * dump
It works fine here with all my stuff running.
I did not check which words may use the traditional sizes in bytes, but my bet is none :)
So it needs to be reviewed by experts.
Igor
|