SlideShare a Scribd company logo
Real Time Operating System For Embedded Systems
Rajan Singh
M.E EXTC Sem1(2015-2017)
kumar.rajan1812@gmail.com
Abstract— An embedded system is a special-purpose computer
system designed to perform one or a few dedicated functions,
often with real-time computing constraints. Embedded systems
contain a processor, software and Memory and The processor
may be 8051 micro-controller or a Pentium-IV processor,
Memory ROM and RAM respectively Memory Input Processor
Output.
Index Terms— freeRTOS, ARM LPC2148X, Task, Scheduling,
Semaphore, mutex .
INTRODUCTION (RTOS)
An RTOS is an OS for response time-controlled and event-
controlled processes. It is very essential for large scale
embedded systems. RTOS occupy little space from 10 KB to
100KB The main task of a RTOS is to manage the resources
of the computer such that a particular operation executes in
precisely the same amount of time every time it occur.
When RTOS is not necessary?
For small-scaled systems, RTOS’s function can be replaced by C.
For example, instead of the memory allocation and de-allocation
functions of RTOS, the C function , 'melloc' and 'free' can be used.
Software can directly handle inter-process communication.
3. When RTOS is necessary?
However, RTOS is essential when… A common and effective way
of handling of the hardware source calls from the interrupts I/O
management with devices, files, mailboxes becomes simple using an
RTOS Effectively scheduling and running and blocking of the tasks
in cases of many tasks and many more….. In conclusion, an RTOS
may not be necessary in a small-scaled embedded system. An RTOS
is necessary when scheduling of multiple processes and devices is
important.
THEORY
Hard Real time system: Failure to meet such a dead line is
considered to be a fatal fault and will lead to disastrous consequences
e.g. Response of the break system of a speeding Train approaching a
Red Signal to the stop command must come before the train crosses
the Red signal.
Soft Real time system : Failure to miss a Soft Deadline is
undesirable but a few misses does no serious harm like occasional
delay in an on line trading of stocks. However the system’s overall
performance becomes poorer and poorer as more and more jobs starts
missing the deadline.
The most important component of RTOS is its kernel (Monolithic &
Microkernel). BSP or Board Support Package makes an RTOS
target-specific (It’s a processor specific code onto (processor) which
we like to have our RTOS running).
RTOS Kernel Functions:
1. Task Management2. Intertask Communication & Synchronization
3. Dynamic Memory Allocation 4. Timers5. Devices I/O Supervisor*
Task States of RTOS :--
WORKING
Task Management:
Set of services used to allow application software developers to
design their software as a number of separate chunks of software
each handling a distinct topic, a distinct goal, and sometimes its own
real-time deadline. Main service offered is Task Scheduling controls
the execution of application software tasks  can make them run in a
very timely and responsive fashion.
RTOS perform priority-based pre emptive task scheduling. Basic
rules for priority based pre emptive task scheduling  The Highest
Priority Task that is Ready to Run, will be the Task that Must be
Running.
Priority based Preemptive Task Scheduling: Every Task in a software
application is assigned a priority. Higher Priority = Higher Need for
Quick Response.
Nested Preemption Timeline for Priority-based Preemptive
Scheduling.
Inter task Communication &Synchronization These services makes
it possible to pass information from one task to another without
information ever being damaged. Makes it possible for tasks to
coordinate & productively cooperate with each other.
Inter-Task communication &Synchronization The most important
communication b/w tasks in an OS is the passing of data from one
task to another. Message Producer Task Receiver Task If messages
are sent more quickly than they can be handled, the OS provides
message queues for holding the messages until they can be
processed.
Message passing in RTOS In RTOS, the OS copies a pointer to the
message, delivers the pointer to the message-receiver task, and then
deletes the copy of the pointer with message-sender task. Message
Sender RAM Task Message Message Message
Example of Rtos:-
freeTOS, VxWorks, pSOS OS QNX •ETLinux • VRTX •uCLinux •uCOS
•uLinux (muLinux) SymbianOS distro fits on a single floppy
Mutexes :
Mutex means mutual exclusion A mutex is a synchronization object that
can have only two states. They are not-owned and owned. Two operations
are defined for mutexes
Lock: This operation attempts to take ownership of a mutex, if the mutex
is already owned by another thread then the invoking thread is queued.
Unlock: This operation relinquishes ownership of a mutex. If there are
queued threads then a thread is removed from the queue and resumed,
ownership is implicitly assigned to the thread.
Interrupt processing using Semaphore mutex
Priority-ceiling mutex locking and unlocking
uint8_t SST_mutexLock(uint8_t
prioCeiling) {
uint8_t p;
SST_INT_LOCK();
p = S_currPrio_; /* save
the original SST priority to return */
if (prioCeiling > SST_currPrio_) {
SST_currPrio_ = prioCeiling; /*
set the SST priority to the ceiling */
}
SST_INT_UNLOCK();
return p;
}
/*.........................................
.................................*/
void SST_mutexUnlock(uint8_t orgPrio) {
SST_INT_LOCK();
if (orgPrio < SST_currPrio_) {
SST_currPrio_ = orgPrio; /*
restore the saved priority to unlock */
SST_schedule_(); /* the
scheduler unlocks the interrupts internally
*/
}
SST_INT_UNLOCK();
}
Unlike the simple INT_LOCK macros, the SST mutex interface
allows locks to be nested, because the original SST priority is
preserved on the stack. Above example shows how the mutex is
used in the SST example to protect the non-reentrant DOS
random number generator calls inside the clock-tick
tasks tickTaskA() and tickTaskB().
Priority Inversion Problem In any real time embedded system ,if
a high priority task is blocked or waiting and a low priority task is
running or under execution ,this situation is called Priority
Inversion. This priority Inversion is shown in the diagram below.
In Scheduling, priority inversion is the scenario where a low priority
Task holds a shared resource that is required by a high priority task.
This causes the execution of the high priority task to be blocked
until the low priority task releases the resource, effectively
“inverting” the relative priorities of the two tasks.
Suppose some other medium priority task, one that does not depend
on the shared resource, attempts to run in the interim, it will take
precedence over both the low priority task and the high priority task.
The consequences of the priority Inversion are
(i) Reduce the performance of the system (ii) May reduce the
system responsiveness
which leads to the violation of response time guarantees (iii) Create
problems in real-time systems.
There are two types of priority inversions.(i) Bounded and
(ii).Unbounded.
The Priority Inversion is avoided by using two protocolas.,namely
(i).Priority Inheritance Protocol (PIP)
(ii) Priority Ceiling Protocol(PCP).
APPLICATION
Creating Three Tasks :-
1. Blinking LED 2. Print on USART1 3. Print on USART2
void blinkyLed_task()
{
while(1)
{ // Set PORTC.8
GPIOC->BSRR = (1 << 8);
vTaskDelay(200);
// Reset PORTC.8
GPIOC->BRR = (1 << 8);
vTaskDelay(500);
}
}
void usart_task1()
{ while(1)
{
if(xSemaphoreTake( mutex, ( TickType_t ) 0 )
== pdTRUE )
{ usart1_puts("HOD of EXTC Department ");
xSemaphoreGive(mutex);
vTaskDelay(1000);
} } }
void usart_task2()
{ while(1)
{
if(xSemaphoreTake( mutex, ( TickType_t ) 0 )
== pdTRUE )
{
usart1_puts("Y . S . RAO Sir ");
xSemaphoreGive(mutex);
vTaskDelay(1000);
} }}
Calling Tasks inside main( ) :
int main(void)
{
RCC->AHBENR |= RCC_AHBENR_GPIOCEN;
// enable the clock to GPIOC
RCC->AHBENR |= RCC_AHBENR_GPIOAEN;
// enable the clock to GPIOA
// Put PORTC.8 in output mode
GPIOC->MODER |= (1 << 16);
// Put PORTC.9 in output mode
GPIOC->MODER |= (1 << 18);
// Put PORTA.0 in input mode
GPIOA->MODER &= ~(3 << 0);
usart1_init();
mutex = xSemaphoreCreateMutex();
xTaskCreate(usart_task1,
(const char *)"blinkyLed_task",
configMINIMAL_STACK_SIZE,
NULL, /* pvParameters */
tskIDLE_PRIORITY + 1, /* uxPriority */
NULL /* pvCreatedTask */);
xTaskCreate(usart_task1,
(const char *)"usart_task2",
configMINIMAL_STACK_SIZE,
NULL, /* pvParameters */
tskIDLE_PRIORITY + 2, /* uxPriority */
NULL /* pvCreatedTask */);
xTaskCreate(usart_task2,
(const char *)"usart_task3",
configMINIMAL_STACK_SIZE,
NULL, /* pvParameters */
tskIDLE_PRIORITY + 3, /* uxPriority */
NULL /* pvCreatedTask */);
vTaskStartScheduler();
while(1); }
RESULT
After successful compilation of program .hex file will be
generated. we used to connect the ARM board kit via
Universal serial bus for debugging purpose to see Blinking
LED.
For debugging purpose openOCD.bin file is used. it provides
Real time interfacing of ARM LPC2148X to the code i.e
RTOS.
Procedure to see the USART output on
Minicom screen:---
rajan@Rajan:~$ sudo minicom
Welcome to minicom 2.7
OPTIONS: I18n
Compiled on Jan 1 2014, 17:13:19.
Port /dev/ttySNX0, 19:59:10
Press CTRL-A Z for help on special keys
+-----[configuration]------+
| Filenames and paths |
| File transfer protocols |
| Serial port setup |
| Modem and dialing |
| Screen and keyboard |
| Save setup as dfl |
| Save setup as.. |
| Exit |
+--------------------------+
CTRL-A Z for help | 9600 8N1 | NOR | Minicom 2.7 | VT102 |
Offline | ttySNX0
After setting the serial usb port and Baud rate we will start
getting the output on the Minicom screen as shown below:--
If Tasks have equal priority then use of Semaphore is essential.
It is better shown in the output on Minicom window.
1. With Mutex (i.e Output device is locked for a single Task)
Task 1: Display the task1 output at USART1 ( Embedded GURU of
SPIT )
Task 2: Display the task2 output at USART2 ( Y . S . RAO Sir )
OUTPUT : HOD of EXTC Department Y . S . RAO Sir HOD of
EXTC Department Y . S . RAO Sir HOD of EXTC Department
Y . S . RAO Sir HOD of EXTC Department Y . S . RAO Sir
HOD of EXTC Department Y . S . RAO Sir HOD of EXTC
Department Y . S . RAO Sir .........
2. Without Mutex (i.e Output device is used Task)
OUTPUT : HOD of EXTC Department Y . S . RAO Sir HO Y .
D .S o. FRA EXO STC irDe HOpar D otm f EXenTCt S o. FRA
EXO STC irDe HOpar D otm f EXenTCt S o. FRA EXO STC
irDe HOpar D otm f EXenTCt S o. FRA EXO STC irDe HOpar
D otm f ExenTCt...........................
References:
1.Embedded/Real Time Systems : Concepts,Design
&Programming –Dr.K.V.K.K Prasad : Dreamtech Publs
2. Embedded & Real Time Systems Notes - Mr. Suman
Kalyan Oduri
3.www.freertos.org
RTOS implementation

More Related Content

PDF
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed
PPTX
PDF
Interrupts in CPU
PPTX
Real time Operating System
PPT
Programmable Timer 8253/8254
PPTX
Real time operating systems (rtos) concepts 9
DOCX
RTOS APPLICATIONS
PDF
Linux scheduler
The 8051 microcontroller and embedded systems using assembly and c 2nd-ed
Interrupts in CPU
Real time Operating System
Programmable Timer 8253/8254
Real time operating systems (rtos) concepts 9
RTOS APPLICATIONS
Linux scheduler

What's hot (20)

PPTX
Linux Network Stack
PDF
Introduction to arm architecture
PPTX
Interrupts and types of interrupts
DOC
Real time operating-systems
PPT
Uart
PPTX
FreeRTOS
PPTX
Microcontroller overview 1
PPT
Rtos Concepts
PPTX
PART-2 : Mastering RTOS FreeRTOS and STM32Fx with Debugging
PDF
Interrupts
PPTX
REAL TIME OPERATING SYSTEM
PPTX
Embedded linux
PPTX
services and system calls of operating system
PDF
Introduction to FreeRTOS
 
PPTX
Real time operating systems (rtos) concepts 1
PPTX
Rtos concepts
PDF
Testing real-time Linux. What to test and how
PPTX
I2c protocol - Inter–Integrated Circuit Communication Protocol
PPTX
Linux Network Stack
Introduction to arm architecture
Interrupts and types of interrupts
Real time operating-systems
Uart
FreeRTOS
Microcontroller overview 1
Rtos Concepts
PART-2 : Mastering RTOS FreeRTOS and STM32Fx with Debugging
Interrupts
REAL TIME OPERATING SYSTEM
Embedded linux
services and system calls of operating system
Introduction to FreeRTOS
 
Real time operating systems (rtos) concepts 1
Rtos concepts
Testing real-time Linux. What to test and how
I2c protocol - Inter–Integrated Circuit Communication Protocol
Ad

Viewers also liked (9)

PPT
PDF
Ecs new scheme vtu syllabus
PPTX
Rtos by shibu
PDF
Real Time Operating System Concepts
PDF
Unit 4 Real Time Operating System
PPSX
Real Time Operating System
PDF
RTOS - Real Time Operating Systems
PPTX
Real Time OS For Embedded Systems
PPT
RTOS Basic Concepts
Ecs new scheme vtu syllabus
Rtos by shibu
Real Time Operating System Concepts
Unit 4 Real Time Operating System
Real Time Operating System
RTOS - Real Time Operating Systems
Real Time OS For Embedded Systems
RTOS Basic Concepts
Ad

Similar to RTOS implementation (20)

PPT
1230 Rtf Final
PPTX
Embedded os
PDF
PPT
Rtos
PPT
ghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjjjjjjjjjjjjjjj
PPTX
OVERVIEW OF RTOS
PPTX
UNIT II PPT.pptx
PPT
PPT
PPT
Os Concepts
PPT
21-Classification of Real time system-12-02-2025.ppt
PPT
Real-Time Operating Systems Real-Time Operating Systems RTOS .ppt
PPT
PDF
Intro To RTOS by Silicon labs covering fundamentals
PPTX
Real Time Operating Systems
PPT
rtos.ppt
PPT
Real Time Operating System
PPTX
Embtjhofigkjgzyuibchvjkheddejfjhgjhjgkmd system-3.pptx
PPTX
FreeRTOS basics (Real time Operating System)
1230 Rtf Final
Embedded os
Rtos
ghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhjjjjjjjjjjjjjjj
OVERVIEW OF RTOS
UNIT II PPT.pptx
Os Concepts
21-Classification of Real time system-12-02-2025.ppt
Real-Time Operating Systems Real-Time Operating Systems RTOS .ppt
Intro To RTOS by Silicon labs covering fundamentals
Real Time Operating Systems
rtos.ppt
Real Time Operating System
Embtjhofigkjgzyuibchvjkheddejfjhgjhjgkmd system-3.pptx
FreeRTOS basics (Real time Operating System)

Recently uploaded (20)

PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
PPT on Performance Review to get promotions
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PPTX
Geodesy 1.pptx...............................................
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
Well-logging-methods_new................
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
Welding lecture in detail for understanding
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
composite construction of structures.pdf
PPTX
Strings in CPP - Strings in C++ are sequences of characters used to store and...
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Operating System & Kernel Study Guide-1 - converted.pdf
PPT on Performance Review to get promotions
Lesson 3_Tessellation.pptx finite Mathematics
Geodesy 1.pptx...............................................
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
bas. eng. economics group 4 presentation 1.pptx
Foundation to blockchain - A guide to Blockchain Tech
CYBER-CRIMES AND SECURITY A guide to understanding
Well-logging-methods_new................
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
UNIT 4 Total Quality Management .pptx
Welding lecture in detail for understanding
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
composite construction of structures.pdf
Strings in CPP - Strings in C++ are sequences of characters used to store and...
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
CH1 Production IntroductoryConcepts.pptx
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx

RTOS implementation

  • 1. Real Time Operating System For Embedded Systems Rajan Singh M.E EXTC Sem1(2015-2017) kumar.rajan1812@gmail.com Abstract— An embedded system is a special-purpose computer system designed to perform one or a few dedicated functions, often with real-time computing constraints. Embedded systems contain a processor, software and Memory and The processor may be 8051 micro-controller or a Pentium-IV processor, Memory ROM and RAM respectively Memory Input Processor Output. Index Terms— freeRTOS, ARM LPC2148X, Task, Scheduling, Semaphore, mutex . INTRODUCTION (RTOS) An RTOS is an OS for response time-controlled and event- controlled processes. It is very essential for large scale embedded systems. RTOS occupy little space from 10 KB to 100KB The main task of a RTOS is to manage the resources of the computer such that a particular operation executes in precisely the same amount of time every time it occur. When RTOS is not necessary? For small-scaled systems, RTOS’s function can be replaced by C. For example, instead of the memory allocation and de-allocation functions of RTOS, the C function , 'melloc' and 'free' can be used. Software can directly handle inter-process communication. 3. When RTOS is necessary? However, RTOS is essential when… A common and effective way of handling of the hardware source calls from the interrupts I/O management with devices, files, mailboxes becomes simple using an RTOS Effectively scheduling and running and blocking of the tasks in cases of many tasks and many more….. In conclusion, an RTOS may not be necessary in a small-scaled embedded system. An RTOS is necessary when scheduling of multiple processes and devices is important. THEORY Hard Real time system: Failure to meet such a dead line is considered to be a fatal fault and will lead to disastrous consequences e.g. Response of the break system of a speeding Train approaching a Red Signal to the stop command must come before the train crosses the Red signal. Soft Real time system : Failure to miss a Soft Deadline is undesirable but a few misses does no serious harm like occasional delay in an on line trading of stocks. However the system’s overall performance becomes poorer and poorer as more and more jobs starts missing the deadline. The most important component of RTOS is its kernel (Monolithic & Microkernel). BSP or Board Support Package makes an RTOS target-specific (It’s a processor specific code onto (processor) which we like to have our RTOS running). RTOS Kernel Functions: 1. Task Management2. Intertask Communication & Synchronization 3. Dynamic Memory Allocation 4. Timers5. Devices I/O Supervisor* Task States of RTOS :-- WORKING Task Management: Set of services used to allow application software developers to design their software as a number of separate chunks of software each handling a distinct topic, a distinct goal, and sometimes its own real-time deadline. Main service offered is Task Scheduling controls the execution of application software tasks  can make them run in a very timely and responsive fashion. RTOS perform priority-based pre emptive task scheduling. Basic rules for priority based pre emptive task scheduling  The Highest Priority Task that is Ready to Run, will be the Task that Must be Running.
  • 2. Priority based Preemptive Task Scheduling: Every Task in a software application is assigned a priority. Higher Priority = Higher Need for Quick Response. Nested Preemption Timeline for Priority-based Preemptive Scheduling. Inter task Communication &Synchronization These services makes it possible to pass information from one task to another without information ever being damaged. Makes it possible for tasks to coordinate & productively cooperate with each other. Inter-Task communication &Synchronization The most important communication b/w tasks in an OS is the passing of data from one task to another. Message Producer Task Receiver Task If messages are sent more quickly than they can be handled, the OS provides message queues for holding the messages until they can be processed. Message passing in RTOS In RTOS, the OS copies a pointer to the message, delivers the pointer to the message-receiver task, and then deletes the copy of the pointer with message-sender task. Message Sender RAM Task Message Message Message Example of Rtos:- freeTOS, VxWorks, pSOS OS QNX •ETLinux • VRTX •uCLinux •uCOS •uLinux (muLinux) SymbianOS distro fits on a single floppy Mutexes : Mutex means mutual exclusion A mutex is a synchronization object that can have only two states. They are not-owned and owned. Two operations are defined for mutexes Lock: This operation attempts to take ownership of a mutex, if the mutex is already owned by another thread then the invoking thread is queued. Unlock: This operation relinquishes ownership of a mutex. If there are queued threads then a thread is removed from the queue and resumed, ownership is implicitly assigned to the thread. Interrupt processing using Semaphore mutex Priority-ceiling mutex locking and unlocking uint8_t SST_mutexLock(uint8_t prioCeiling) { uint8_t p; SST_INT_LOCK(); p = S_currPrio_; /* save the original SST priority to return */ if (prioCeiling > SST_currPrio_) { SST_currPrio_ = prioCeiling; /* set the SST priority to the ceiling */ } SST_INT_UNLOCK(); return p; } /*......................................... .................................*/ void SST_mutexUnlock(uint8_t orgPrio) { SST_INT_LOCK(); if (orgPrio < SST_currPrio_) { SST_currPrio_ = orgPrio; /* restore the saved priority to unlock */ SST_schedule_(); /* the scheduler unlocks the interrupts internally */ } SST_INT_UNLOCK(); } Unlike the simple INT_LOCK macros, the SST mutex interface allows locks to be nested, because the original SST priority is preserved on the stack. Above example shows how the mutex is used in the SST example to protect the non-reentrant DOS random number generator calls inside the clock-tick tasks tickTaskA() and tickTaskB(). Priority Inversion Problem In any real time embedded system ,if a high priority task is blocked or waiting and a low priority task is running or under execution ,this situation is called Priority Inversion. This priority Inversion is shown in the diagram below. In Scheduling, priority inversion is the scenario where a low priority Task holds a shared resource that is required by a high priority task. This causes the execution of the high priority task to be blocked until the low priority task releases the resource, effectively “inverting” the relative priorities of the two tasks. Suppose some other medium priority task, one that does not depend on the shared resource, attempts to run in the interim, it will take precedence over both the low priority task and the high priority task. The consequences of the priority Inversion are (i) Reduce the performance of the system (ii) May reduce the system responsiveness which leads to the violation of response time guarantees (iii) Create problems in real-time systems. There are two types of priority inversions.(i) Bounded and (ii).Unbounded. The Priority Inversion is avoided by using two protocolas.,namely (i).Priority Inheritance Protocol (PIP) (ii) Priority Ceiling Protocol(PCP). APPLICATION Creating Three Tasks :- 1. Blinking LED 2. Print on USART1 3. Print on USART2 void blinkyLed_task() { while(1) { // Set PORTC.8 GPIOC->BSRR = (1 << 8); vTaskDelay(200); // Reset PORTC.8 GPIOC->BRR = (1 << 8); vTaskDelay(500); } }
  • 3. void usart_task1() { while(1) { if(xSemaphoreTake( mutex, ( TickType_t ) 0 ) == pdTRUE ) { usart1_puts("HOD of EXTC Department "); xSemaphoreGive(mutex); vTaskDelay(1000); } } } void usart_task2() { while(1) { if(xSemaphoreTake( mutex, ( TickType_t ) 0 ) == pdTRUE ) { usart1_puts("Y . S . RAO Sir "); xSemaphoreGive(mutex); vTaskDelay(1000); } }} Calling Tasks inside main( ) : int main(void) { RCC->AHBENR |= RCC_AHBENR_GPIOCEN; // enable the clock to GPIOC RCC->AHBENR |= RCC_AHBENR_GPIOAEN; // enable the clock to GPIOA // Put PORTC.8 in output mode GPIOC->MODER |= (1 << 16); // Put PORTC.9 in output mode GPIOC->MODER |= (1 << 18); // Put PORTA.0 in input mode GPIOA->MODER &= ~(3 << 0); usart1_init(); mutex = xSemaphoreCreateMutex(); xTaskCreate(usart_task1, (const char *)"blinkyLed_task", configMINIMAL_STACK_SIZE, NULL, /* pvParameters */ tskIDLE_PRIORITY + 1, /* uxPriority */ NULL /* pvCreatedTask */); xTaskCreate(usart_task1, (const char *)"usart_task2", configMINIMAL_STACK_SIZE, NULL, /* pvParameters */ tskIDLE_PRIORITY + 2, /* uxPriority */ NULL /* pvCreatedTask */); xTaskCreate(usart_task2, (const char *)"usart_task3", configMINIMAL_STACK_SIZE, NULL, /* pvParameters */ tskIDLE_PRIORITY + 3, /* uxPriority */ NULL /* pvCreatedTask */); vTaskStartScheduler(); while(1); } RESULT After successful compilation of program .hex file will be generated. we used to connect the ARM board kit via Universal serial bus for debugging purpose to see Blinking LED. For debugging purpose openOCD.bin file is used. it provides Real time interfacing of ARM LPC2148X to the code i.e RTOS. Procedure to see the USART output on Minicom screen:--- rajan@Rajan:~$ sudo minicom Welcome to minicom 2.7 OPTIONS: I18n Compiled on Jan 1 2014, 17:13:19. Port /dev/ttySNX0, 19:59:10 Press CTRL-A Z for help on special keys +-----[configuration]------+ | Filenames and paths | | File transfer protocols | | Serial port setup | | Modem and dialing | | Screen and keyboard | | Save setup as dfl | | Save setup as.. | | Exit | +--------------------------+ CTRL-A Z for help | 9600 8N1 | NOR | Minicom 2.7 | VT102 | Offline | ttySNX0 After setting the serial usb port and Baud rate we will start getting the output on the Minicom screen as shown below:-- If Tasks have equal priority then use of Semaphore is essential. It is better shown in the output on Minicom window. 1. With Mutex (i.e Output device is locked for a single Task) Task 1: Display the task1 output at USART1 ( Embedded GURU of SPIT ) Task 2: Display the task2 output at USART2 ( Y . S . RAO Sir ) OUTPUT : HOD of EXTC Department Y . S . RAO Sir HOD of EXTC Department Y . S . RAO Sir HOD of EXTC Department Y . S . RAO Sir HOD of EXTC Department Y . S . RAO Sir HOD of EXTC Department Y . S . RAO Sir HOD of EXTC Department Y . S . RAO Sir ......... 2. Without Mutex (i.e Output device is used Task) OUTPUT : HOD of EXTC Department Y . S . RAO Sir HO Y . D .S o. FRA EXO STC irDe HOpar D otm f EXenTCt S o. FRA EXO STC irDe HOpar D otm f EXenTCt S o. FRA EXO STC irDe HOpar D otm f EXenTCt S o. FRA EXO STC irDe HOpar D otm f ExenTCt........................... References: 1.Embedded/Real Time Systems : Concepts,Design &Programming –Dr.K.V.K.K Prasad : Dreamtech Publs 2. Embedded & Real Time Systems Notes - Mr. Suman Kalyan Oduri 3.www.freertos.org