40
FreeRTOS and LPC Microcontrollers Richard Barry Design West, San Jose, 2013

what is freertos?

  • Upload
    others

  • View
    31

  • Download
    4

Embed Size (px)

Citation preview

Page 1: what is freertos?

FreeRTOS and LPC Microcontrollers

Richard Barry Design West, San Jose, 2013

Page 2: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

Introductions

Real Time Engineers Ltd. – FreeRTOS™

– FreeRTOS+™

WITTENSTEIN high integrity systems – OpenRTOS®

– SafeRTOS®

Richard Barry Director, Real Time Engineers Ltd

Founder, the FreeRTOS project

Page 3: what is freertos?

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

April 25, 2013 3

Page 4: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

HOW CAN AN RTOS HELP ME? Why Would I Want an RTOS?

4

Page 5: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

Super Loop Designs

5

Page 6: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

Super Loop Designs

6

Will it scale?

Page 7: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

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

7

Page 8: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

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

8

Interdependency between timing and functionality

Page 9: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

The RTOS Alternative

Task #1

Delay (wait) until it is time to start the next

control cycle

Perform control function

Output results

9

Task #2

Wait for interrupt

Process data

Task #3

Wait for a message from another task

Process message

Send a message to another task

Task #4

Background processing

Page 10: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

The RTOS Alternative

Task #1

Delay (wait) until it is time to start the next

control cycle

Perform control function

Output results

10

Task #2

Wait for interrupt

Process data

Task #3

Wait for a message from another task

Process message

Send a message to another task

Task #4

Background processing

Autonomous sequential tasks, RTOS takes care of signaling, communication and timing

Page 11: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

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

11

Page 12: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

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

Scaling and Maintenance

12

Decoupled, functionally cohesive code

Page 13: what is freertos?

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

April 25, 2013 13

Page 14: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

WHAT IS FREERTOS?

14

Page 15: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

RTOS

RTOS, Kernel or Scheduler?

Executive

Scheduler

15

Page 16: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

The RT In RTOS

16

Task2 (med, periodic)

Task3 (low, event)

Task1 (high, event)

Idle task

T2 preempts T3 T1 preempts T2

t1 t3t2 t4 t5 t6 t7 t8t10

t11t12

t13t9

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

Page 17: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

For Microcontrollers

33 architectures and 18 tool chains

Real Time Linux

Processor power

μCLinux, eCOS

No Scheduler FreeRTOS

App

licab

ility

17

Page 18: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

Moderated Open Source Real Time Kernel

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

is everywhere ....

18

Page 19: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

FreeRTOS Value Proposition

19

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.

Page 20: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

Is It Free, Even For Commercial Use?

Yes – Moderated open source – Proprietary code remains proprietary

FreeRTOS API

FreeRTOS Source

Application Source

Driver Source

Middleware Source

Closed Source Open Source

20

Page 21: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

Under Constant Development

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

21

TaskIdle Task

SchedulerInterrupt

Without Tick Suppression

Page 22: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

Under Constant Development

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

22

TaskIdle Task

SchedulerInterrupt

With Tick Suppression

Page 23: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

FreeRTOS+

IO Add an open(), read(), write(), ioctl()

peripheral interface to your application

CLI Enable your application to efficiently

process command line input

Safety & Certification A pre-certified kernel for

microcontrollers, with a similar usage model to FreeRTOS

Trace Get 15 graphically interlinked views of the trace, providing an unprecedented

level of insight

Your Product Here?

Nabto Exciting new technology that re-

defines the web device

SSL and TLS State of the art networking security

for embedded systems

RTOS Training Expert instructor led RTOS training to

maximise productivity – delivered online or on site

FreeRTOS+ Ecosystem

23

UDP/IP Thread aware, Berkeley sockets

based, efficient UDP/IP stack

TCP/IP Pre-built libraries for easy integration of TCP/IP and related protocols into

cost-sensitive applications

Page 24: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

FreeRTOS+Trace

October 2012 24

Page 25: what is freertos?

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

25

Page 26: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

www.FreeRTOS.org

26

Page 27: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

Source Files

27

Page 28: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

FAQ

28

Page 29: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

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 ); }

29

Page 30: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

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(); } }

30

Page 31: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

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();

31

Page 32: what is freertos?

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

32

Page 33: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

Featured Demo #1

33

Page 34: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

Featured Demo #2

April 25, 2013 34

Page 35: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

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

LPCOpen from NXP

Page 36: what is freertos?

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

Page 37: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

The LPCOpen platform structure

Core Library

LwIP

LPCUSBlib

emWin SWIM

LPCOpen Platform

FreeRTOS

Board layer

Chip layer

IP layer

LPCUSBlib examples

HID, CDC

Mass Storage Audio Host

: :

LwIP examples

Webserver TCP/IP echo

Internet radio : :

Peripheral examples

Power Save Dual Core

CAN SCT

SGPIO :

emWin examples

Touchscreen Animation

: :

OS examples

Dual Core OS Tickless OS

: :

Page 38: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

Importing LPCOpen Stacks and Drivers

38

Page 39: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

TAKING IT FURTHER There is a lot more!

Page 40: what is freertos?

Copyright 2013 Real Time Engineers Ltd.

Thanks For Attending!

40