| ??? 04/22/02 17:31 Read: times |
#22050 - RE: Task switching for Keil C51 |
Hmmm. Really high overhead!
Agreed. The '51 architecture isn't particularly well suited for efficient preemptive multitasking and this is why I tend to think that the cooperative model, whether implemented through ad hoc concurrent state machines or a generic multitasking kernel, is usually a better choice. What if I reserve, say 10 bytes (5 nested CALLs), for each task and move SP on each task switching? OK, but... Don't forget to account for stack usage by ISR's. Don't forget to account for C51's PUSH/POP for saving registers temporarily, especially around library calls. Don't forget to account for call nesting within called library functions. You'll likely have to determine this via simulation. If you are implementing a preemptive model, you still have to save the critical registers somewhere. Regards, --Dan Henry |



