Renesas Electronics America Inc. © 2012 Renesas Electronics America Inc. All rights reserved. Software Development with an Open Source RTOS © 2012 Renesas Electronics America Inc. All rights reserved.2 Renesas Technology & Solution Portfolio © 2012 Renesas Electronics America Inc. All rights reserved.3 Microcontroller and Microprocessor Line-up Wide Format LCDs Industrial & Automotive, 130nm 350µA/MHz, 1µA standby 44 DMIPS, True Low Power Embedded Security, ASSP 165 DMIPS, FPU, DSC 1200 DMIPS, Performance 1200 DMIPS, Superscalar 500 DMIPS, Low Power 165 DMIPS, FPU, DSC 25 DMIPS, Low Power 10 DMIPS, Capacitive Touch Industrial & Automotive, 150nm 190µA/MHz, 0.3µA standby Industrial, 90nm 242µA/MHz, 0.2µA standby Automotive & Industrial, 90nm 600µA/MHz, 1.5µA standby Automotive & Industrial, 65nm 600µA/MHz, 1.5µA standby Automotive, 40nm 500µA/MHz, 35µA deep standby Industrial, 40nm 242µA/MHz, 0.2µA standby Industrial, 90nm 1mA/MHz, 100µA standby Industrial & Automotive, 130nm 144µA/MHz, 0.2µA standby 2010 2013 32-bit8/16-bit © 2012 Renesas Electronics America Inc. All rights reserved.4 Microcontroller and Microprocessor Line-up Wide Format LCDs Industrial & Automotive, 130nm 350µA/MHz, 1µA standby 44 DMIPS, True Low Power Embedded Security, ASSP 165 DMIPS, FPU, DSC 1200 DMIPS, Performance 1200 DMIPS, Superscalar 500 DMIPS, Low Power 165 DMIPS, FPU, DSC 25 DMIPS, Low Power 10 DMIPS, Capacitive Touch Industrial & Automotive, 150nm 190µA/MHz, 0.3µA standby Industrial, 90nm 242µA/MHz, 0.2µA standby Automotive & Industrial, 90nm 600µA/MHz, 1.5µA standby Automotive & Industrial, 65nm 600µA/MHz, 1.5µA standby Automotive, 40nm 500µA/MHz, 35µA deep standby Industrial, 40nm 242µA/MHz, 0.2µA standby Industrial, 90nm 1mA/MHz, 100µA standby Industrial & Automotive, 130nm 144µA/MHz, 0.2µA standby 2010 2013 32-bit8/16-bit 32-Bit High Performance DSP, FPU with High Integration © 2012 Renesas Electronics America Inc. All rights reserved.5 ‘Enabling The Smart Society’ DVR Game Console Smart Phones Navigation Systems Music Players Tablet PC © 2012 Renesas Electronics America Inc. All rights reserved.6 Agenda Definitions Why RTOS? Why FreeRTOS? Lab Exercises Questions Feedback Form © 2012 Renesas Electronics America Inc. All rights reserved.7 Definitions, RTOS, and FreeRTOS © 2012 Renesas Electronics America Inc. All rights reserved.8 What is Your RTOS Experience? I have previously used an RTOS in a commercial product I am using an RTOS in my current project I am considering using an RTOS in the near future and would like to get as much info as possible I am a “Super-Loop” user and here to burn you down © 2012 Renesas Electronics America Inc. All rights reserved.9 Some Definitions REAL-TIME: Computing with a deadline Hard real-time (Air bag) Soft real-time (Adaptive volume) TASK: Self contained code that handles a singular functionality or semi-independent portion of an application Process Thread SCHEDULER: Implements the scheduling policy Kernel Operating system (OS) PRIORTY: Used in arbitration mechanism © 2012 Renesas Electronics America Inc. All rights reserved.10 Why Use an RTOS? (1 of 2) Abstracting timing information Kernel is responsible for system time Modularity Tasks are independent modules with well defined purpose Team development Designers can work on different tasks simultaneously Code reuse Modules allow code re-use with less effort Improved efficiency Event driven software Code executes only when it is needed [...]... America Inc All rights reserved Why FreeRTOS? Widely used and known Open source Simple and easy to port Feature rich but small size Free use and distribute Path to commercial versions OpenRTOS: Full support, additional components SafeRTOS: Functional safety, IEC 61508 compliant More on FreeRTOS site http://www.freertos.org/ http://www.freertos.org/a00090.html#RENESAS 12 © 2012... http://www.freertos.org/a00090.html#RENESAS 12 © 2012 Renesas Electronics America Inc All rights reserved What is our role with FreeRTOS? Port FreeRTOS to Renesas MCUs Work with FreeRTOS to qualify ports Provide sample projects with FreeRTOS Direct Drive LCD Firmware Integration Technology (FIT) Support by FreeRTOS Partner with other RTOS vendors for full support Micrium: uc/OS Segger: embOS CMX: CMX-RTX 13 © 2012... Exercise 2 – Queue Management 22 © 2012 Renesas Electronics America Inc All rights reserved Lab Exercise 2 – Queue Management APIs: xQueueCreate(), xQueueSendToBack(), xQueueSendToFront(), xQueueReceive(), uxQueueMessagesWaiting() Head Head Communication between tasks and interrupts Blocking API call Not owned by a particular task Any task can write to a queue Any task can read from a queue... ISR gives 3 semaphores Handler task takes them and processes the events ISR returns to Periodic task 34 © 2012 Renesas Electronics America Inc All rights reserved Lab Exercise 4 – Resource Management 35 © 2012 Renesas Electronics America Inc All rights reserved Lab Exercise 4 – Resource Management Resource sharing/Peripheral access LCD, standard IO, memory Read/Modify/Write operation ... task causes an interrupt ISR runs and gives the semaphore ISR does not requests context switch Periodic task continues Context switches at next timer tick Handler task runs 33 © 2012 Renesas Electronics America Inc All rights reserved Lab Exercise 3 – Recap (2 of 2) Counting semaphores Event detection Resource management Similar sequence of events ISR gives 3 semaphores Handler task... xSemaphoreTake() unblocks Lab Exercise 3 – You can start the lab now 32 © 2012 Renesas Electronics America Inc All rights reserved Lab Exercise 3 – Recap (1 of 2) Sequence of events (hard real-time) Periodic task causes an interrupt ISR runs and gives the semaphore ISR requests context switch Context switches and handler task runs Context switches back and periodic task resumes Sequence of events...Why Use an RTOS? (2 of 2) Flexible interrupt handling Short interrupt routines that detects events Most of the work deferred to a task Mixed processing requirements Periodic execution Continuous functions Event driven processing Real-time requirement ordering with priorities Control over peripherals Shared resources Gatekeeper tasks 11 © 2012 Renesas... queue and removes it Therefore, the items in queue is always zero There are 2 sender tasks and 1 receiver task The receiver tasks runs twice as more and prints out 2 messages Therefore it consumes more MCU processing time 26 © 2012 Renesas Electronics America Inc All rights reserved Lab Exercise 2 – Recap (2 of 3) Receiver task priority is lower than the sender tasks Sender tasks fills the queue and... vSemaphoreCreateBinary(), xSemaphoreCreateCounting(), xSemaphoreGiveFromISR(), xSemaphoreTake() Binary semaphore Queue with a length of one Always either empty or full Counting semaphore Event count, initial value = zero Resource management, initial count = number of resource Task Task Task Another interrupt event Interrupt gives the givessemaphore the semaphore xSemaphoreGiveFromISR() xSemaphoreGiveFromISR()... sender tasks Sender tasks fills the queue and can not send anymore All tasks are at the same priority so they are time-sliced Number of items in the queue can be as much as 2 27 © 2012 Renesas Electronics America Inc All rights reserved Lab Exercise 2 – Recap (3 of 3) No sender tasks Receiver task blocks waiting for a message but times out Queue API calls can Return immediately Block indefinitely . reserved.8 What is Your RTOS Experience? I have previously used an RTOS in a commercial product I am using an RTOS in my current project I am considering using an RTOS in the near future and would. America Inc. © 2012 Renesas Electronics America Inc. All rights reserved. Software Development with an Open Source RTOS © 2012 Renesas Electronics America Inc. All rights reserved.2 Renesas. ordering with priorities Control over peripherals Shared resources Gatekeeper tasks © 2012 Renesas Electronics America Inc. All rights reserved.12 Why FreeRTOS? Widely used and known Open source