EETimes

Embedded Systems September 2000 Vol13_10

Issue link: http://dc.ee.ubm-us.com/i/71837

Contents of this Issue

Navigation

Page 148 of 229

I The power of preemptive multitasking comes at a price. Somewhere in the middle, between a fridge and a desktop PC is a fine line between a "yes we need one, let's get the sales rep" and "no, let's just get a few guy and start coding." Our fridge can become mo re complex because marke tin g now wants a keypad so the use r may man- ually ente r d efrost sch edules. Suddenly, we need to provide a real- time clock, a display, and a keypad. Sin ewe now have a display, it might be wise to provide some cool graph- ics to entertain the users as they fe tch beers from the fridge. Ma rketing also wants to make the softwa re compati- ble with the next generation of voice- activated fr idges. For small to medium embedded products, there is no simple answer to the "yes" or "no" question. The follow- ing drawbacks should be considered if you choose to include an RTOS: } • If you decide to buy a commercial off-the-shelf product, the one-off or per-site royalty costs can be consid- erable • Your RTOS will require extra resources • Time-critical aspects of the system may be negatively affected. For example, inten-upt latencies may make your high-speed comms more difficul t • It i never easy to port an RTOS, no matte r what ads in electronic and softwa re magazin es claim. Take into account the time and effort involved in porting the RTOS you choose • If you choose a pre-emptive RTOS, remembe• - that the power of pre- emptive multi tasking comes at a price. Make sure that all the engi- neers you are about to hire under- stand that a single thread of code may be interrupted and execution Task's event buffer FIGURE 1 Event-driven task: data/event flow diagram~;···., · . · / ( Other task / An event driven task Other task II should never ever get here II can put same error handling here, just in case return ; II will keep most compilers happy } passed to another task, that data shared between tasks must be pro- tected from simultaneous access, and so on • Many in-circuit emula to rs and debuggers refuse to wo rk reliably LISTING 1 int main(void) { Init_}lll 0; for <;;> { IO_ScanO; IO_ProcessOutputs(); KBD_Scan(); PRN_Pri nt 0; LCD_UpdateO; RS232_Receive(); RS232_Send(); TMR_ProcessO; under an RTOS. You should be prepared to calm down angry engineers who are trying to hit an elusive breakpoint while the ke rn el code keeps rescheduling away Embedded Syst ems Programming SEPTEMBER 2ooo 147

Articles in this issue

Archives of this issue

view archives of EETimes - Embedded Systems September 2000 Vol13_10