TI-RTOS overview Nick Lethaby, TI-RTOS and IoT Ecosystem May 2015 1 What is TI-RTOS? Connectivity Wi-Fi, Bluetooth® Smart, ZigBee®, Cellular (via PPP), Wired TCP/IP, TLS/SSL Other Middleware USB, File Systems Power Manager T I R T O S User Application Tasks APls Real-time Kernel Drivers IoT MCU Sensors TI-RTOS development tools • TI-RTOS works with the TI Code Composer Studio (CCS), IAR, and GCC toolchains • The RTOS Object Viewer enables developers to study the state of OS objects such as tasks, stacks, and semaphores – Available for CCS and IAR • The RTOS Analyzer enables developers to look at execution history including context switching and per-task CPU load – Available for CCS How TI-RTOS helps developers • Provides pre-tested embedded software modules – Connectivity protocols, power management, real-time kernel, … – Eliminates need for these to be developed from scratch – Enables developers to focus on their areas of application expertise • No licensing hassles to use – Completely free to use and deploy • Reduced effort to port existing applications to new devices – RTOS isolates application from hardware specifics • Simpler development and maintenance of multi-function applications – Using multiple priorities and threads to integrate different functions – Add new features without modifying real-time response TI-RTOS kernel, drivers, & power manager Connectivity Wi-Fi, Bluetooth Smart, ZigBee, Cellular (via PPP), Wired TCP/IP, TLS/SSL Other Middleware USB, File Systems Power Manager T I R T O S User Application Tasks APls Real-time Kernel Drivers IoT MCU Sensors TI-RTOS kernel • Designed for real-time applications – Scheduler is deterministic so kernel system calls complete operation in a predictable time – Interrupt latency is low – “Zero-latency Interrupts” enable kernel to be used in hard realtime applications • Low footprint to meet MCU memory constraints – Kernel is highly configurable so unneeded functions are excluded – Static configuration enables very low footprints by eliminating need for heaps or create/delete calls if desired • Tick suppression for enhanced low-power performance Kernel services IPC Services: Events, Mailboxes, Semaphores, Gates Debug & Analysis: Logging, diagnostics, Hooks, stack checking Device-specific services: Interrupt and power management, timers, exception handling Memory Managers: Heap, fixedsized buffers Threading Services: Tasks, Software Interrupts, Clocks, Idle An integrated approach to power management Drivers & stacks: • Request peripheral clocks and power domains be enabled • Set power-down constraints in critical sections Clock module: • Provide next scheduled event Power policy: • Run in idle task • Select power saving mode Power manager: • Manage clock gates & power domains • Power-down and wake-up routines • Power-down and wake-up latencies • Record power-down constraints Impact of TI-RTOS power manager • TI MCU offers low power modes that consume exponentially less power compared to simply sleeping the main Cortex-M core (WaitForInterrupt) – The default power policy uses the latency data combined with its knowledge of the next scheduled event to select the lowest possible power state, thus greatly extending battery life – Note: The data below is from the SimpleLink™ CC2640 wireless MCU Power Mode Wake-up Time to CPU Active Current Used Active NA 4.145 mA WaitForInterrupt A few cycles 1.4 µs 14 µs 2.028 mA 796 µA 1-2 µA IDLE STANDBY TI-RTOS device drivers & board support • Driver APIs are consistent across device families – Makes applications easy to port to other device supported by TI-RTOS • Drivers are designed for use with RTOS – Thread-safe – Block (on a semaphore) when waiting for I/O so CPU is released for another thread to run • Each supported board has a “board.c” file that contains the code for initializing all the peripherals • Drivers are “power-aware” for ultra low-power MCU devices 10 TI-RTOS device drivers C28 C28+M3 TM4C MSP432 Y Y Y Y Y Y Y Y Real-time clock Timer UART Y DMA-based UART I2C MSP430 CC3200 CC26xx Y Y Y Y Y Y Y Y Y Y Y Y Y Y I2S Y Y Y SPI Y Y Y Y Y SPI-SD Y Y Y Y Y Y Y PWM Y Camera Y EMAC Y Y USB Y Y Watchdog Y Y Y Y Y Y Y TI-RTOS connectivity & middleware Connectivity Wi-Fi, Bluetooth® Smart, ZigBee®, Cellular (via PPP), Wired TCP/IP, TLS/SSL Other Middleware USB, File Systems Power Manager T I R T O S User Application Tasks APls Real-time Kernel Drivers IoT MCU Sensors TI-RTOS: wireless connectivity • TI-RTOS supports all on-chips stacks in TI SimpleLink™ wireless MCUs out-of-box • TI-RTOS supports the SimpleLink™ Wi-Fi CC3100 wireless network processor out-of-box Device Wireless Stack Comments CC3200 Wi-Fi CC3200 Wi-Fi host driver pre-tested on TI-RTOS CC2630 ZigBee Stack runs by default on TI-RTOS CC2640 Bluetooth Smart Stack runs by default on TI-RTOS MCU + CC3100 Wi-Fi TI-RTOS offers pre-integrated CC3100 host drivers using SPIs on MSP430, MSP432 and TM4Cx TI-RTOS TCP/IP stack T L S S N T P H T T P T E L N E T T F T P D H C P D N S Standard BSD Sockets Interface Route Manager IF Manager NAT TCP UDP ICMP IGMP IP PPP ARP Serial IF Ethernet IF Hardware Adaptation Layer Ethernet Serial Packet Port Driver Driver Timer Driver Hardware User LED Driver TCP/IP Key Features Supports both IPv4 and IPv6 Standard BSD Sockets interface Zero-copy sockets interface available Highly configurable to meet footprint constraints PPP/Serial Interface allows use with third-party cellular modems SSL/TLS requires a licensing fee USB stack M S C H I D C D C H I D Class Driver Application Host Device Hardware Adaptation Layer SD card, mouse, UART, …. Drivers Hardware DMA USB Driver Driver C O N F I G U R A T I O N USB Key Features MSC Host Class Driver HID Host & Device Class Drivers CDC Device Class Driver Examples for each class driver Example of using MSC Host Driver under FAT file system File system • TI uses an open source software called FatFs • Key features: – Both native and C RTS file APIs may be used • C RTS APIs (fopen (), fread (), fwrite (), …) are plugged into file system – Supports FAT12, FAT16, FAT32, and VFAT • Long file names (VFAT) are not supported in the default build • TI does NOT indemnify against VFAT patents • Drivers options: – SD Card (via SPI driver) – USB flash drive (via USB MSC host) Summary • TI-RTOS enables developers to focus on their specific areas of applications expertise by providing pre-tested software building blocks: – Multitasking kernel and device drivers – Connectivity solutions: TCP/IP, Wi-Fi, BLE, and USB – Advanced, easy-to-use power management • Preemptive multitasking design paradigm simplifies development and maintenance of embedded applications • TI-RTOS no-cost licensing removes commercial barriers to deployment For more information • www.ti.com web page: www.ti.com/tool/ti-rtos – Product brochure, white paper, manuals, software downloads • e2e forum: http://e2e.ti.com/support/embedded/tirtos/ • Wiki: http://processors.wiki.ti.com/index.php/Main_Page – Select ‘TI-RTOS’ category • Download page: – http://softwaredl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/tirtos/index.html Product manager: Nick Lethaby (nlethaby@ti.com)