Electronic – Basic OS definitions and implementations

armos

The Rowley Crossworks package (includes compiler, IDE, debugging interface, etc.) also includes something called the Crossworks Tasking Library (CTL). From their website:

CrossWorks Tasking Library, known as CTL. CTL is a royalty-free tasking library that provides a multi-priority, pre-emptive, task switching and synchronisation facility. Additionally, the library can also provide timer and interrupt handling support.

I mostly understand the description of the tasking portion from my investigations into task schedulers (with the exception of synchronization… what's that mean?). However, timer and interrupt handling support has me completely thrown for a loop. Isn't that stuff built in the gcc environment (which crossworks uses btw)? Does that mean they use some kind of wrapper for the gcc syntax:

ISR(PORTB_INT0_vect)
{
    int_pin_handler();
}

If so, what advantage does it give to put that in a kernel versus just manually writing to the appropriate ports etc. as one would do in truly bare-metal programming? Finally, is it common for small OSes (I'm thinking FreeRTOS, VxWorks not linux kernels) to do this kind of thing?

Thanks

Best Answer

The point is not attaching an ISR to an interrupt, as you stated most compilers can do that.

The point is what you are allowed to do inside the ISR, especially with the synchronisation and communication primitives (flag, semaphore, queue, mailbox, etc) that the TL provides. This is tricky business, because the TL has no control over when an interrupt occurs (short of disabling interrupts, which affects the maximum interrupt latency, which is a very important figure for a TL). To strike a good balance between increased interrupt latency and forbidding ISRs to do all sorts of TL calls is one of the problems in writing a TL, henec 'support' for interrupts means that they at least have given this some thought.