Nothing Special   »   [go: up one dir, main page]

Freertos and LPC Microcontrollers: Richard Barry Design West, San Jose, 2013

Download as pdf or txt
Download as pdf or txt
You are on page 1of 40

FreeRTOS and LPC Microcontrollers

Richard Barry
Design West, San Jose, 2013
Introductions

Real Time Engineers Ltd.


– FreeRTOS™
– FreeRTOS+™

WITTENSTEIN high integrity systems


– OpenRTOS®
– SafeRTOS®

Richard Barry
Director, Real Time Engineers Ltd
Founder, the FreeRTOS project

Copyright 2013 Real Time Engineers Ltd.


Agenda

Why would I want an RTOS?


What is FreeRTOS? What is FreeRTOS+?
The FreeRTOS value proposition
Using FreeRTOS
FreeRTOS running on LPC
LPCOpen, a complete embedded solution from NXP

Copyright 2013 Real Time Engineers Ltd. 3


April 25, 2013
Why Would I Want an RTOS?

HOW CAN AN RTOS HELP ME?

Copyright 2013 Real Time Engineers Ltd. 4


Super Loop Designs

Copyright 2013 Real Time Engineers Ltd. 5


Super Loop Designs

Will it scale?

Copyright 2013 Real Time Engineers Ltd. 6


Scaling and Maintenance

Integration of COTS components

Code re-use

Mixed processing requirements

Concurrent team development

Testability

Mix of hard and soft real time

Scalable (not susceptible to application change)

Tolerant of hardware change

Copyright 2013 Real Time Engineers Ltd. 7


Scaling and Maintenance

Integration of COTS components

Code re-use

Mixed processing requirements

Concurrent team development


Interdependency between timing and functionality
Testability

Mix of hard and soft real time

Scalable (not susceptible to application change)

Tolerant of hardware change

Copyright 2013 Real Time Engineers Ltd. 8


The RTOS Alternative
Task #1 Task #2 Task #3

Delay (wait) until it is


Wait for a message
time to start the next Wait for interrupt
from another task
control cycle

Perform control
Process data Process message
function

Send a message to
Output results
another task
Task #4

Background
processing

Copyright 2013 Real Time Engineers Ltd. 9


The RTOS Alternative
Task #1 Task #2 Task #3

Delay (wait) until it is


Wait for a message
time to start the next Wait for interrupt
from another task
control cycle

Perform control
Process data Process message
function
Autonomous sequential tasks,
RTOS takes care of signaling, communication and timing
Send a message to
Output results
another task
Task #4

Background
processing

Copyright 2013 Real Time Engineers Ltd. 10


Scaling and Maintenance

Integration of COTS components

Code re-use

Mixed processing requirements

Concurrent team development

Testability

Mix of hard and soft real time

Scalable (not susceptible to application change)

Tolerant of hardware change

Copyright 2013 Real Time Engineers Ltd.11


Scaling and Maintenance

Integration of COTS components

Code re-use

Mixed processing requirements

Concurrent team development


Decoupled, functionally cohesive code
Testability

Mix of hard and soft real time

Scalable (not susceptible to application change)

Tolerant of hardware change

Copyright 2013 Real Time Engineers Ltd. 12


Agenda

Why would I want an RTOS?


What is FreeRTOS? What is FreeRTOS+?
The FreeRTOS value proposition
Using FreeRTOS
FreeRTOS running on LPC
LPCOpen, a complete embedded solution from NXP

Copyright 2013 Real Time Engineers Ltd. 13


April 25, 2013
WHAT IS FREERTOS?

Copyright 2013 Real Time Engineers Ltd. 14


RTOS, Kernel or Scheduler?

RTOS

Executive

Scheduler

Copyright 2013 Real Time Engineers Ltd. 15


The RT In RTOS

Deterministic
– Hard real time – “it absolutely must”
– Soft real time – “it should”

T2 preempts T3 T1 preempts T2

Task1 (high, event)


Task2 (med, periodic)
Task3 (low, event)
Idle task
t1 t2 t3 t4 t5 t6 t7 t8 t9 t11 t13
t10 t12

Copyright 2013 Real Time Engineers Ltd. 16


For Microcontrollers

33 architectures and 18 tool chains

Real Time Linux


μCLinux, eCOS
Applicability

FreeRTOS
No Scheduler

Processor power

Copyright 2013 Real Time Engineers Ltd. 17


Moderated Open Source Real Time Kernel

is everywhere ....

Professionally developed, quality controlled, robust and supported


Downloaded more than 103,000 times in 2012
Polled top in class for the questions “which kernel are you currently
using?” and “which kernel are you most likely to use in your next project”
in the 2011, 2012 and 2013 EETimes Embedded Market Surveys

Copyright 2013 Real Time Engineers Ltd.18


FreeRTOS Value Proposition

FreeRTOS offers lower project risks and a lower total cost of ownership
than commercial alternatives because:
It is fully supported and documented
Most people take products to market without ever contacting us, but
with the complete peace of mind that they could opt to switch to a fully
indemnified commercial license (with dedicated supports) at any time.

Copyright 2013 Real Time Engineers Ltd.19


Is It Free, Even For Commercial Use?

Yes
– Moderated open source
– Proprietary code remains proprietary

Application Driver Middleware


Source Source Source
Closed Source
FreeRTOS API
Open Source

FreeRTOS Source

Copyright 2013 Real Time Engineers Ltd. 20


Under Constant Development

Latest features include


– Tick suppression for low power applications
– Queue sets
– Port optimised task selection

Without Tick Suppression

Interrupt
Scheduler
Task
Idle Task

Copyright 2013 Real Time Engineers Ltd. 21


Under Constant Development

Latest features include


– Tick suppression for low power applications
– Queue sets
– Port optimised task selection

With Tick Suppression

Interrupt
Scheduler
Task
Idle Task

Copyright 2013 Real Time Engineers Ltd. 22


FreeRTOS+ Ecosystem
FreeRTOS+
TCP/IP UDP/IP
Pre-built libraries for easy integration
Thread aware, Berkeley sockets
of TCP/IP and related protocols into
based, efficient UDP/IP stack
cost-sensitive applications
IO CLI
Add an open(), read(), write(), ioctl()
Enable your application to efficiently
peripheral interface to your
process command line input
application
Safety & Certification Trace
A pre-certified kernel for Get 15 graphically interlinked views of
microcontrollers, with a similar usage the trace, providing an unprecedented
model to FreeRTOS level of insight

Nabto SSL and TLS


Exciting new technology that re- State of the art networking security
defines the web device for embedded systems

RTOS Training
Expert instructor led RTOS training to
maximise productivity – delivered
Your Product Here?
online or on site

Copyright 2013 Real Time Engineers Ltd. 23


FreeRTOS+Trace

Copyright 2013 Real Time Engineers Ltd. 24


October 2012
Agenda

Why would I want an RTOS?


What is FreeRTOS? What is FreeRTOS+?
The FreeRTOS value proposition
Using FreeRTOS
FreeRTOS running on LPC
LPCOpen, a complete embedded solution from NXP

Copyright 2013 Real Time Engineers Ltd. 25


www.FreeRTOS.org

Copyright 2013 Real Time Engineers Ltd. 26


Source Files

Copyright 2013 Real Time Engineers Ltd. 27


FAQ

Copyright 2013 Real Time Engineers Ltd. 28


Task Example #1
/* Tasks always have the same prototype. */
void vProcessMessages( void *pvParameters )
{
for( ;; )
{
xQueueReceive( xQueue, &xMessage, portMAX_DELAY );
ProcessMessage( &xMessage );
}

/* A task cannot exit without first deleting itself. */


vTaskDelete( NULL );
}

Copyright 2013 Real Time Engineers Ltd. 29


Task Example #2
/* Tasks always have the same prototype. */
void vProcessMessages( void *pvParameters )
{
portTickType xLastWakeTime;
const portTickType xFrequency = 10;

/* Initialise the xLastWakeTime variable with the


current time. */
xLastWakeTime = xTaskGetTickCount();

for( ;; )
{
/* Wait for the next cycle. */
vTaskDelayUntil( &xLastWakeTime, xFrequency );
vPeriodicProcessingDoneHere();
}
}

Copyright 2013 Real Time Engineers Ltd. 30


Create a Task – Start the Scheduler
xTaskCreate( /* A pointer to the task function. */
aTask,
/* Textual name. */
"LED",
/* Dimensions of the task stack. */
configMINIMAL_STACK_DEPTH,
/* Parameters passed into the task. */
(void *) 0,
/* The priority of the task. */
2,
/* A handle for the task. */
NULL
);

vTaskStartScheduler();

Copyright 2013 Real Time Engineers Ltd. 31


Agenda

Why would I want an RTOS?


What is FreeRTOS? What is FreeRTOS+?
The FreeRTOS value proposition
Using FreeRTOS
FreeRTOS running on LPC
LPCOpen, a complete embedded solution from NXP

Copyright 2013 Real Time Engineers Ltd. 32


Featured Demo #1

Copyright 2013 Real Time Engineers Ltd. 33


Featured Demo #2

Copyright 2013 Real Time Engineers Ltd. 34


April 25, 2013
LPCOpen from NXP
LPCOpen is free software from NXP for use with NXP MCUs
– Peripheral drivers
– LPCUSBlib, with support for many classes
– SWIM (NXP‘s lightweight graphics library)
– Examples
Includes pre-ported third party open source and licensed software
– Support and examples for FreeRTOS
– LwIP network stack
– emWin (binary graphics library licensed from Segger for NXP customers)
– ChaN FatFs
– Cortex-M CMSIS DSP library

LPCOpen is available for download on www.lpcware.com

Copyright 2013 Real Time Engineers Ltd.


Benefits of LPCOpen

Supports all NXP Cortex-M based MCUs


Similar APIs across processor families
Available for Keil’s µVision, IAR’s EWARM, LPCXpresso
Supports hardware from Embedded Artists, NGX, Keil, Hitex, and more
Thoroughly tested, maintained, and documented code
Meaningful application examples using multiple peripherals, running
stand-alone or under an RTOS
Steadily increasing number of example applications, including USB
audio, HID, Web Server, etc

Copyright 2013 Real Time Engineers Ltd.


The LPCOpen platform structure

Core Library
Board layer
Chip layer emWin FreeRTOS
LwIP LPCUSBlib
IP layer SWIM

LPCOpen Platform
LPCUSBlib LwIP Peripheral emWin OS
examples examples examples examples examples

HID, CDC Webserver Power Save Touchscreen Dual Core OS


Mass Storage TCP/IP echo Dual Core Animation Tickless OS
Audio Internet radio CAN : :
Host : SCT : :
: : SGPIO
: :

Copyright 2013 Real Time Engineers Ltd.


Importing LPCOpen Stacks and Drivers

Copyright 2013 Real Time Engineers Ltd. 38


There is a lot more!

TAKING IT FURTHER

Copyright 2013 Real Time Engineers Ltd.


Thanks For Attending!

Copyright 2013 Real Time Engineers Ltd. 40

You might also like