Interrupts and TI-RTOS Scheduling
Interrupts and TI-RTOS Scheduling
When embedded systems start to become more complex – that is, when you need to juggle more
than a handful of events – using a Real-Time Operating System (RTOS) can greatly increase
your system’s reliability … while decreasing your time-to-market, frustration and costs.
The Texas Instruments RTOS (TI-RTOS) – also known as SYS/BIOS – provides many functions
that you can use within your program; for example, the TI-RTOS kernel includes: Scheduling,
Instrumentation, and Memory Management. You can choose which parts of TI-RTOS are needed
and discard the rest (to saves memory).
Think of TI-RTOS as a library and toolset to help you build and maintain robust systems. If you’re
doing just “one” thing, it’s probably overkill. As you end up implementing more and more
functionality in your system, though, the tools and code will save you time and headaches.
The only part of TI-RTOS discussed in this chapter is “Scheduling”. We talk about this because it
is very much related to the topics covered throughout this chapter – interrupts and threads. In
many cases, if you’re using an RTOS, it will manage much of the interrupt processing for you; it
will also provide additional options for handling interrupts – such as post-processing of interrupts.
As a final note, we will only touch on the topics of scheduling and RTOS’s. TI provides a 2-day
workshop where you can learn all the details of the TI-RTOS kernel. You can view a video
version of the TI-RTOS course or take one live. Please check out the following wiki page for more
information:
http://processors.wiki.ti.com/index.php/Introduction_to_the_TI-RTOS_Kernel_Workshop
Threads – Foreground and Background
Our quick introduction to TI-RTOS begins with a summary of threads. While we discussed these
concepts earlier in the chapter, they are very important to how a RTOS scheduler works.
What is a Thread?
main() {
init code
}
while(1) {
nonRT Fxn
}
UART ISR
get byte
process
output
Timer ISR
Scan keyboard
We all know what a function() is…
A thread is a function that runs
within a specific context; e.g.
Priority
Registers/CPU state
Stack
To retain a thread’s context,
we must save
then restore it
Most common threads in a system
are hardware interrupts
Foreground
threads
Background
thread
MSP430 Workshop - Interrupts 5 - 31