Jump to content

Can't Fit Avoid Boundary Code

Recommended Posts

Is a way to calculate how much availability Sys_Yiels / Sys_Sleep I have, Before compiler message "Can't fit Avoid boundary code in function .... "?

Yes, Pavel or Dave could give you a mathematical formula to calculate an exact answer. :-)

As an ordinary user, I have a more pragmatic approach.

If you build the project and open the .lst file, then search for 'AVOID CODE PAGE BOUNDARY BEGIN' (without the quotes), you will see the return point table in question. For my PIC16 NOVO test program, it has 4 instructions used at the start plus one goto instruction per function return point. On a PIC16 this would allow 252 return points. One is used per task and one per yield point. Take a look for yourself at your PIC18 .lst file


I believe that due to the nature of a software call stack based RTOS that can work on midrange PICs, it must preserve the hardware stack between yield points - otherwise one task could 'return' to an address in another task. I haven't investigated this further but I would expect that if you bury the yield point deeper in the call tree, functions above the yield point use this table instead of the hardware stack. This would be consistent with your experiences with trying to combine yield points by writing a function for each task that did all the yielding. Remember, this is an unconfirmed guess based on my understanding of cooperative multitasking in general and the PIC architecture.


In any case, FOR A PARTICULAR PROGRAM, the length of this table should give you a fairly good idea of how many more yield points you can use.

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...