Re: >This is exactly the kind of code where you don't want a compiler between you >and the machine. It may be fine to write the application in C on the RTOS, >but I certainly wouldn't want to see critical parts of the RTOS written in >anything but assembler. When you are writing an RTOS, you have to assume >that the task switching code is both speed and space critical. You also >have to perform some fancy stack diddling which would confuse most >compilers. Since you want a pre-emptive RTOS, a lot of the task switching >code will be in the interrupt routine. This is even more reason to write it >in assembler. As a data point, Salvo on a PIC16C77 doing fully priority-and event-based cooperative multitasking context-switches at around 2500 context switches/sec with a 4MHz crystal / 1us instruction cycle. That's written entirely in C. I suspect the performance would improve to about 3000/sec if it were written in assembler. This is Salvo's Demo #1, available in hex form for programming into a PIC16C77 or equivalent in the freeware download from our website. >Are you really sure you need a pre-emptive RTOS? Is it really that hard to >break your tasks into "small" chunks of no-wait code? Pre-emptive can look >like the more elegant solution, but adds more overhead and trouble than you >may realize. The big gotcha is that any thread has to be prepared to be >swapped out at any time. This means you either need to disable task >swithing during critical parts or add interlocks around global state. > >I've done a lot of embedded system designs (It's what I do for a living). >While I have used multiple tasks or pseudo-tasks (can't do real tasks on >PICs other than 18 family, for example) many times, I have never yet needed >to do pre-emptive task swithing on a small resource-limited system. Yes, it's pretty astonishing what you can do in a cooperative system. For highest performance, you do need to perhaps tailor your tasks to ensure minimal latency for higher-priority tasks, but for many PICmicro apps we're seeing, it's not an issue. Check out our website for more info. -- ______________________________________ Andrew E. Kalman, Ph.D. Salvo(TM), The RTOS that runs in tiny places(TM) Pumpkin, Inc. 750 Naples Street San Francisco, CA 94112 tel: (415) 584-6360 fax: (415) 585-7948 web: http://www.pumpkininc.com email: aek@pumpkininc.com -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics