Embedded RTOS Design: Insights and Implementation
Book information
Description
Embedded RTOS Design: Insights and Implementation combines explanations of RTOS concepts with detailed, practical implementation. It gives a detailed description of the implementation of a basic real-time kernel designed to be limited in scope and simple to understand, which could be used for a real design of modest complexity. The kernel features upward-compatibility to a commercial real-time operating system: Nucleus RTOS. Code is provided which can be used without restriction. Gain practical information on: Scheduling, preemption, and interrupts Information flow (queues, semaphores, etc.) and how they work Signaling between tasks (signals, events, etc.) Memory management (Where does each task get its stack from? What happens if the stack overflows?) The CPU context: storage and retrieval after a context switch With this book you will be able to: Utilize a basic real-time kernel to develop your own prototype Design RTOS features Understand the facilities of a commercial RTOS Explains the principles of RTOS and shows their practical implementation Demonstrates how to prototype a real-time design Code is fully available for free use Front Cover Embedded RTOS Design Copyright Page Dedication Contents Foreword Preface 1 Program structure and real time Why use an operating system? Software structure Embedded program models What is real time? 2 Multitasking and scheduling Tasks, threads, and processes Schedulers Run to completion scheduler Round robin scheduler Time slice scheduler Priority scheduler Composite scheduler Task states Task suspend Other task states Task identifiers The context switch What is a task? Register set Local data Shared resources Saving context Dynamic task creation Requirements for dynamic task creation Implications of dynamic task creation Interrupts Interrupts and the kernel Context save Interrupts and the scheduler Tick clock 3 RTOS services and facilities Intertask communication services Shared variables or memory areas Signals Event flag groups Semaphores Mailboxes Queues Mutexes Other RTOS services Task control System information Memory allocation Problems with malloc() and free() Memory partitions Time Interrupts, drivers, and input/output Interrupts Drivers Input/output Diagnostics API call parameter checks Stack checking Application diagnostics Beyond the kernel Networking and connectivity Protocol validation Graphics File systems 4 Nucleus SE Nucleus SE target users Design decisions and trade-offs Static configuration Object number Object addressing The scheduler Limited functionality Memory utilization Application program interface implementation Critical sections Scalability Which application program interface? Services Parameter checking Configuration Naming conventions API calls Other functions and variables Configuration symbols Other #define symbols Data structures Key differences from Nucleus RTOS Object data Object number Object names Task blocking mechanism API call timeout Task scheduling Task priorities Interrupt handling Device drivers 5 The scheduler Scheduling in Nucleus RTOS Scheduling in Nucleus SE Scheduler types Run-to-completion scheduler Round robin scheduler Time slice scheduler Priority scheduler Task states Nucleus RTOS task states Nucleus SE task states Thread state Options Task suspend API call blocking Schedule count Initial task state Context saving Global data RAM data Scheduler data footprint Implementing other scheduling schemes Time slice with background Priority and round robin 6 Tasks Configuring tasks Number of tasks API enables Functionality enables Task service calls Task control services Suspending a task Nucleus RTOS API call for task suspend Nucleus SE API call for task suspend Nucleus SE implementation of task suspend Resuming a task Nucleus RTOS API call for task resume Nucleus SE API call for task resume Nucleus SE implementation of task resume Putting a task to sleep Nucleus RTOS API call for task sleep Nucleus SE API call for task sleep Nucleus SE implementation of task sleep Relinquishing the CPU Nucleus RTOS API call for task relinquish Nucleus SE API call for task relinquish Nucleus SE implementation of task relinquish Task utility services Obtaining the current task’s ID Nucleus RTOS API call for current task Nucleus SE API call for current task Nucleus SE implementation of current task Checking available stack space Nucleus RTOS API call for stack space Nucleus SE API call for stack space Nucleus SE implementation of stack space Resetting a task Nucleus RTOS API call for task reset Nucleus SE API call for task reset Nucleus SE implementation of task reset Obtaining task information Nucleus RTOS API call for obtain task information Nucleus SE API call for obtain task information Nucleus SE implementation of obtain task information Obtaining the number of tasks Nucleus RTOS API call for number of tasks Nucleus SE API call for number of tasks Nucleus SE implementation of number of tasks Data structures Kernel RAM data User RAM data ROM data Task data footprint Unimplemented API calls Create task Delete task Change task priority Change task preemption Change task time slice Terminate task Compatibility with Nucleus RTOS Object identifiers Task states Unimplemented API calls 7 Partition memory Using partitions Configuring memory partitions Number of partition pools API enables Partition pool service calls Partition allocation and deallocation services Allocating a partition Nucleus RTOS API call for partition allocation Nucleus SE API call for allocating Nucleus SE implementation of partition allocation Deallocating a partition Nucleus RTOS API call for partition deallocation Nucleus SE API call for partition deallocation Nucleus SE implementation of partition deallocation Partition pool utility services Obtaining partition pool information Nucleus RTOS API call for partition pool information Nucleus SE API call for partition pool information Nucleus SE implementation of partition pool information Obtaining the number of partition pools Nucleus RTOS API call for number of partition pools Nucleus SE API call for number of partition pools Nucleus SE implementation of number of partition pools Data structures Kernel RAM data User RAM ROM data Partition pool data footprint Unimplemented API calls Create partition pool Delete partition pool Partition pool pointers Compatibility with Nucleus RTOS Object identifiers Partition size and number Unimplemented API calls 8 Signals Using signals Configuring signals Application program interface enables Signals service calls Signals send and receive services Sending signals Nucleus RTOS API call for sending signals Nucleus SE API call for sending signals Nucleus SE implementation of sending signals Receiving signals Nucleus RTOS API call for receiving signals Nucleus SE API call for receiving signals Nucleus SE implementation of receiving signals Data structures RAM data ROM data Signal data footprint Unimplemented API calls Register a signal handler Control (enable/disable) signals Compatibility with Nucleus RTOS Signal handlers Signal availability and number Unimplemented API calls 9 Event flag groups Using event flags Configuring event flag groups Number of event flag groups API enables Event flag service calls Event flag group set and retrieve services Setting event flags Nucleus RTOS API call for flag setting Nucleus SE API call for flag setting Nucleus SE implementation of set event flags Retrieving event flags Nucleus RTOS API call for flag retrieving Nucleus SE API call for flag retrieving Nucleus SE implementation of retrieve event flags Event flag group utility services Event flag group information Nucleus RTOS API call for event group information Nucleus SE API call for event group information Nucleus SE implementation of event group information Obtaining the number of event flag groups Nucleus RTOS API call for event flag group count Nucleus SE API call for event flag group count Nucleus SE implementation of event flag group count Data structures RAM data ROM data Event flag group data footprint Unimplemented API calls Create event flag group Delete event flag group Event flag group pointers Compatibility with Nucleus RTOS Object identifiers Number of flags in a group Consume flags option Unimplemented API calls 10 Semaphores Using semaphores Configuring semaphores Number of semaphores API enables Semaphore service calls Semaphore obtain and release services Obtaining a semaphore Nucleus RTOS API call for obtaining a semaphore Nucleus SE API Call for obtaining a semaphore Nucleus SE implementation of obtain semaphore Releasing a semaphore Nucleus RTOS API call for releasing a semaphore Nucleus SE API call for releasing a semaphore Nucleus SE implementation of release semaphore Semaphore utility services Resetting a semaphore Nucleus RTOS API call for resetting a semaphore Nucleus SE API call for resetting a semaphore Nucleus SE implementation of semaphore reset Semaphore information Nucleus RTOS API call for semaphore information Nucleus SE API call for semaphore information Nucleus SE implementation of semaphore information Obtaining the number of semaphores Nucleus RTOS API call for semaphore count Nucleus SE API call for semaphore count Nucleus SE implementation of semaphore count Data structures RAM data ROM data Semaphore data footprint Unimplemented API calls Create semaphore Delete semaphore Semaphore pointers Compatibility with Nucleus RTOS Object identifiers Counter size Unimplemented API calls 11 Mailboxes Using mailboxes Mailboxes and queues Configuring mailboxes Number of mailboxes API enables Mailbox service calls Mailbox write and read services Writing to a mailbox Nucleus RTOS API call for sending to a mailbox Nucleus SE API call for sending to a mailbox Nucleus SE implementation of mailbox send Reading from a mailbox Nucleus RTOS API call for receiving from a mailbox Nucleus SE API call for receiving from a mailbox Nucleus SE implementation of mailbox receive Mailbox utility services Resetting a mailbox Nucleus RTOS API call for resetting a mailbox Nucleus SE API call for resetting a mailbox Nucleus SE implementation of mailbox reset Mailbox information Nucleus RTOS API call for mailbox information Nucleus SE API call for mailbox information Nucleus SE implementation of mailbox information Obtaining the number of mailboxes Nucleus RTOS API call for mailbox count Nucleus SE API call for mailbox count Nucleus SE implementation of mailbox count Data structures RAM data ROM data Mailbox data footprint Unimplemented API calls Create mailbox Delete mailbox Mailbox pointers Broadcast to mailbox Compatibility with Nucleus RTOS Object identifiers Message size and type Unimplemented API calls 12 Queues Using queues Queues and pipes Configuring queues Number of queues API enables Queue service calls Queue write and read services Writing to a queue Nucleus RTOS API call for sending to a queue Nucleus SE API call for sending to a queue Nucleus SE implementation of queue send Reading from a queue Nucleus RTOS API call for receiving from a queue Nucleus SE API call for receiving from a queue Nucleus SE implementation of queue receive Writing to the front of a queue Nucleus RTOS API call for jamming to a queue Nucleus SE API call for jamming to a queue Nucleus SE implementation of jamming to a queue Queue utility services Resetting a queue Nucleus RTOS API call for resetting a queue Nucleus SE API call for resetting a queue Nucleus SE implementation of queue reset Queue information Nucleus RTOS API call for queue information Nucleus SE API call for queue information Nucleus SE implementation of queue information Obtaining the number of queues Nucleus RTOS API call for queue count Nucleus SE API call for queue count Nucleus SE implementation of queue count Data structures Kernel RAM data User RAM ROM data Queue data footprint Unimplemented API calls Create queue Delete queue Queue pointers Broadcast to queue Compatibility with Nucleus RTOS Object identifiers Message size and variability Queue size Unimplemented API calls 13 Pipes Using pipes Pipes and queues Configuring pipes Number of pipes API enables Pipe service calls Pipe write and read services Writing to a pipe Nucleus RTOS API call for sending to a pipe Nucleus SE API Call for sending to a pipe Nucleus SE implementation of pipe send Reading from a pipe Nucleus RTOS API call for receiving from a pipe Nucleus SE API call for receiving from a pipe Nucleus SE implementation of pipe receive Writing to the front of a pipe Nucleus RTOS API call for jamming to a pipe Nucleus SE API call for jamming to a pipe Nucleus SE implementation of jamming to a pipe Pipe utility services Resetting a pipe Nucleus RTOS API call for resetting a pipe Nucleus SE API call for resetting a pipe Nucleus SE implementation of pipe reset Pipe information Nucleus RTOS API call for pipe information Nucleus SE API call for pipe information Nucleus SE implementation of pipe information Obtaining the number of pipes Nucleus RTOS API call for pipe count Nucleus SE API call for pipe count Nucleus SE implementation of pipe count Data structures Kernel RAM data User RAM ROM data Pipe data footprint Unimplemented API calls Create pipe Delete pipe Pipe pointers Broadcast to pipe Compatibility with Nucleus RTOS Object identifiers Message size and variability Pipe size Unimplemented API calls 14 System time Time in an RTOS Clock tick Clock interrupt service routine Timing facilities Accuracy Configuring system time API enables System time service calls System time set and obtain services Setting time Nucleus RTOS API call for setting time Nucleus SE API call for setting time Nucleus SE implementation of setting time Retrieving time Nucleus RTOS API call for retrieving time Nucleus SE API call for retrieving time Nucleus SE implementation of retrieving time Data structures RAM data ROM data System time data footprint Unimplemented API calls Compatibility with Nucleus RTOS 15 Application timers Using timers Configuring timers Number of timers Expiration routine enable API enables Timer service calls Timer services Controlling a timer Nucleus RTOS API call for controlling a timer Nucleus SE API call for controlling a timer Nucleus SE implementation of timer control Reading a timer Nucleus RTOS API call for getting remaining time Nucleus SE API call for getting remaining time Nucleus SE implementation of timer read Timer utility services Resetting a timer Nucleus RTOS API call for resetting a timer Nucleus SE API call for resetting a timer Nucleus SE implementation of timer reset Timer information Nucleus RTOS API call for timer information Nucleus SE API call for timer information Nucleus SE implementation of timer information Obtaining the number of timers Nucleus RTOS API call for timer count Nucleus SE API call for timer count Implementation of timer count Data structures RAM data ROM Data Timer data footprint Unimplemented API calls Create timer Delete timer Timer pointers Compatibility with Nucleus RTOS Object identifiers Timer size Expiration routines Unimplemented API calls 16 Interrupts in Nucleus SE Native and managed interrupts Native interrupts Managed interrupts API calls from interrupt service routines API calls from a native ISR with priority scheduler API calls from a managed ISR or native ISR with nonpriority scheduler Real time clock ISR Real time clock ISR operations Timers System clock Task sleep Time slice scheduling A managed interrupt Nucleus RTOS compatibility Low- and high-level ISRs Low-level ISR High-level ISR Nucleus RTOS interrupt API calls Controlling an interrupt globally Controlling an interrupt locally Set up an interrupt vector Register an LISR interrupt Create an HISR Delete an HISR Activate an HISR Obtain the number of HISRs in a system Obtain pointers to HISR control blocks Obtain a pointer to the current HISR Obtain information about an HISR API calls from ISRs API calls from LISRs API calls from HISRs 17 Nucleus SE initialization and start-up Memory initialization The main() function The NUSE_Init() function Initializing tasks Initializing partition pools Initializing mailboxes Initializing queues Initializing pipes Initializing semaphores Initializing event groups Initializing timers Application code initialization Starting the scheduler 18 Diagnostics and error checking Configuration checks Application program interface parameter checking Task stack checking Version information Nucleus RTOS API call Nucleus SE API call Nucleus SE implementation of release information Compatibility with Nucleus RTOS User diagnostics Application-specific diagnostics Memory checks Peripheral device checks Watchdog servicing Stack overflow checking A supervisor task Tracing and profiling 19 Unimplemented facilities and compatibility The scheduler API calls Common application program interface functions Create and delete Return of object pointers Broadcast data Object-specific application program interface functions Tasks Dynamic memory Signals Interrupts Diagnostics Drivers API call functionality Timeouts Suspend order Object-specific functionality Signal handlers Application timer parameters Event flags Data sizes Mailboxes Queues Pipes Event flag groups Signals Memory partitions Timers 20 Using Nucleus SE What is Nucleus SE? CPU and tool support Configuring a Nucleus SE application Setting up nuse_config.h Object counts API function enables Scheduler selection and settings Other options Setting up nuse_config.c Task data Partition pool data Queue data Pipe data Semaphore data Application timer data Which application program interface? Debugging a Nucleus SE application Using a debugger Task aware breakpoints Kernel object information API call return values Task stack sizing and overflow Nucleus SE configuration checklist 21 Nucleus SE reference information Alphabetic API function list NUSE_Clock_Retrieve() NUSE_Clock_Set() NUSE_Event_Group_Count() NUSE_Event_Group_Information() NUSE_Event_Group_Retrieve() NUSE_Event_Group_Set() NUSE_Mailbox_Count() NUSE_Mailbox_Information() NUSE_Mailbox_Receive() NUSE_Mailbox_Reset() NUSE_Mailbox_Send() NUSE_Partition_Allocate() NUSE_Partition_Deallocate() NUSE_Partition_Pool_Count() NUSE_Partition_Pool_Information() NUSE_Pipe_Count() NUSE_Pipe_Information() NUSE_Pipe_Jam() NUSE_Pipe_Receive() NUSE_Pipe_Reset() NUSE_Pipe_Send() NUSE_Queue_Count() NUSE_Queue_Information() NUSE_Queue_Jam() NUSE_Queue_Receive() NUSE_Queue_Reset() NUSE_Queue_Send() NUSE_Release_Information() NUSE_Semaphore_Count() NUSE_Semaphore_Information() NUSE_Sempahore_Obtain() NUSE_Semaphore_Release() NUSE_Semaphore_Reset() NUSE_Signals_Receive() NUSE_Signals_Send() NUSE_Task_Check_Stack() NUSE_Task_Count() NUSE_Task_Current() NUSE_Task_Information() NUSE_Task_Relinquish() NUSE_Task_Reset() NUSE_Task_Resume() NUSE_Task_Sleep() NUSE_Task_Suspend() NUSE_Timer_Control() NUSE_Timer_Count() NUSE_Timer_Get_Remaining() NUSE_Timer_Information() NUSE_Timer_Reset() Nucleus SE symbols and data structures Naming conventions Constants—#define symbols and macros API functions Status values Miscellaneous symbols System configuration Header file inclusion checks Typedefs Rational data types Kernel object indexes Other data types Global data RAM ROM Kernel object tables Tasks RAM ROM Partition pools RAM ROM Mailboxes RAM ROM Queues RAM ROM Pipes RAM ROM Semaphores RAM ROM Event groups RAM ROM Timers RAM ROM Obtaining Nucleus SE source code Index Back Cover
Similar books
Embedded RTOS Design: Insights and Implementation
2020 · EPUB
Embedded Software: The Works
2005 · PDF
Embedded Software: Know It All
2007 · PDF
Embedded Software: Know It All
2007 · PDF
Embedded Software: The Works
2005 · PDF
MySQL® Notes for Professionals book
2018 · PDF
MrExcel 2022: Boosting Excel
2022 · PDF
MrExcel 2022: Boosting Excel
2022 · PDF