1 / 29

Stellaris® Robotic Evaluation Board and Micriµm µC/OS-III

Stellaris® Robotic Evaluation Board and Micriµm µC/OS-III. Dexter Travis, Stellaris ARM® Cortex™-M3 Applications Engineering Jean J. Labrosse, Founder, President and CEO of Micriµm. Introductions. Jean J. Labrosse Founder, President and CEO of Micriµm Dexter Travis

ariane
Download Presentation

Stellaris® Robotic Evaluation Board and Micriµm µC/OS-III

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Stellaris® Robotic Evaluation Board and Micriµm µC/OS-III Dexter Travis, Stellaris ARM® Cortex™-M3 Applications Engineering Jean J. Labrosse, Founder, President and CEO of Micriµm

  2. Introductions • Jean J. Labrosse • Founder, President and CEO of Micriµm • Dexter Travis • Stellaris® ARM® Cortex™-M3 Applications Engineering

  3. Find the right ARM® Solution for you Comprehensive developer ecosystem DSP DSP+ARM 32-bit ARM MCU for Safety-Critical Applications 32-bit ARMCortex™-M3 MCUs ARM Cortex-A8 &ARM9™ MPUs C6000™ Sitara™ ARMCortex-A8 & ARM9 Stellaris® ARMCortex-M3 TMS570 ARM Cortex-R4™ Integra™ DaVinci™ Digital Media processors 375MHz to >1GHz Cache, RAM, ROM USB, CAN, SATA,SPI, PCIe, EMAC Industrial automation, POS & portable data terminals $5.00 to $25.00 Upto250DMIPS/ 160 MHz 2 MB Flash, 160 KB RAM FPU, ECC, Timer/PWM Co-Proc,12bitADCs,CAN, EMIF, LIN, SPI, Flexray Transportation, Motor Control, Certified for use in safety critical (SIL3) systems $7.00 to $18.00 Up to 80 MHz Flash8 KB to 256 KB USB, ENET MAC+PHY CAN, ADC, PWM, SPI Connectivity,Security,Motion Control, HMI,Industrial Automation $1.00 to $8.00 300MHz to >1Ghz +Accelerator Cache RAM, ROM USB, ENET, PCIe, SATA, SPI Floating/Fixed Point Video, Audio, Voice, Security, Conferencing $5.00 to $200.00 Development tools Software support Responsive design support

  4. Agenda • RTOSs and Real-Time Kernels • A brief introduction • Micriµm - µC/OS-III • Summary of features • Scheduling and Context Switching • Synchronization • Message Passing • Other Services • Texas Instruments - EVALBOT • Features • Examples • Demo

  5. RTOS vs Real-Time Kernels Application Keyboard Keyboard Controller Graphical User Interface Display Controller Display with optional Touch Interface Touch Screen Controller Interrupt Controller Real-Time Kernel File System Media (SD) (MMC) (NAND Flash) (NOR Flash) (CF) (RAM Disk) Other RTOS Timer Media Controller CPU I2S Controller Ethernet Controller (MAC/PHY) TCP/IP Stack TCP/IP Apps Audio CAN CAN Controller USB (Host) (Device) USB Stacks Other (Shell) (Clk) (CRC) (etc.) Modbus RS-232C RS-485 www.Micrium.com

  6. What is a Real-Time Kernel? • Software that manages the time of a CPU • Performs multitasking • ‘Switches’ the CPU between tasks • Highest priority task runs on the CPU • Round-robins tasks of equal priority • Provides valuable services to an application: • Task management • Synchronization • Mutual exclusion management • Message passing • Memory management • Time management • Soft-timer management • Other www.Micrium.com

  7. What is a Real-Time Kernel? High Priority Task Task Task Each Task Importance Event Event Task Task Task Task Task Task Infinite Loop Low Priority Task Task www.Micrium.com

  8. Preemptive Kernels Via a kernel call, the ISR makes the high priority task ready Interrupt occurs ISR ISR ISR completes and the kernel switches to the high-priority task High-priority task The kernel switches to the low-priority task Low-priority task Time www.Micrium.com © 2009, Micriµm, All Rights Reserved www.Micrium.com

  9. What is µC/OS-III? • A third generation Real-Time Kernel • Has roots in µC/OS-II, the world’s most popular Real-Time Kernel • µC/OS-II’s internals were described in the book: “MicroC/OS-II, The Real-Time Kernel” (1998) • A new 850+ page book: • “µC/OS-III, The Real-Time Kernel” • Describes µC/OS-III’s internals • The book comes with: • A Cortex-M3 based evaluation board • Featuring TI’s LM3S9B92 • Links to download: • Sample code to run µC/OS-III • IAR’s 32K KickStart tools • A trial version of µC/Probe • Companion EVALBOT • 5 Example projects www.Micrium.com

  10. µC/OS-IIISummary of Key Features • Preemptive Multitasking • Round-robin scheduling of equal-priority tasks • ROMable • Scalable • Adjustable footprint • Compile-time and run-time configurable • Portable • All µC/OS-II ports can be adapted to µC/OS-III • Rich set of services • Task Management, Time Management, Semaphores, Mutexes, Message Queues, Soft Timers, Memory Management, Event Flags and more www.Micrium.com

  11. µC/OS-IIISummary of Key Features • Real-Time, Deterministic • Reduced interrupt and task latency • Built-in Performance Measurement • Measures interrupt disable time on a per-task basis • Measures stack usage for each task • Keeps track of the number of context switches for each task • Measures the ISR-to-Task and Task-to-Task response time • And more • Cleanest source code in the industry • Consistent API • Run-Time argument checking www.Micrium.com

  12. Typical µC/OS-III Tasks Variables Arrays Structures CPU Registers Stack (RAM) I/O Devices (Optional) void MyTask (void *p_arg) { Do something with ‘argument’ p_arg; Task initialization; for (;;) { Wait for event; /* Time to expire ... */ /* Signal/Msg from ISR ... */ /* Signal/Msg from task ... */ /* Processing (Your Code) */ } } Task (Priority) www.Micrium.com

  13. ‘Creating’ a Task • You create a task by calling a service provided by the kernel: OSTaskCreate(OS_TCB *p_tcb, CPU_CHAR *p_name, OS_TASK_PTR p_task, void *p_arg, OS_PRIO prio, CPU_STK *p_stk_base, CPU_STK *p_stk_limit, OS_STK_SIZE stk_size, OS_MSG_QTY q_size, OS_TICK time_slice, void *p_ext, OS_OPT opt, OS_ERR *p_err); Task Control Block Task Name Task Start Address Priority Stack Stack Limit Stack Size Time Slice Options www.Micrium.com

  14. The µC/OS-III Scheduler Using Count Leading Zeros (CLZ) 0 1 0 0 0 1 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 1 • The Cortex-M3 has a CLZ instruction • Makes scheduling much faster … ex. with 64 priorities ReadyTbl[] 0 31 32 [0] 5 [1] 32 63 Ready Priority = 37 #Zeros if (ReadyTbl[0] == 0) Prio = CLZ(ReadyTbl[1]) + 32; else Prio = CLZ(ReadyTbl[0]); www.Micrium.com

  15. The µC/OS-III Ready List Highest Priority Multiple Tasks At Same Priority Lowest Priority www.Micrium.com

  16. Context SwitchARM Cortex-M3 for µC/OS-III • (1): Current task’s CPU registers are saved on current task’s stack • (2): CPU’s SP register is saved in current task’s TCB • (3): New task’s SP is restored from the new task’s TCB • (4): CPU registers are restored from the new task’s stack www.Micrium.com

  17. Resource Management(Mutual Exclusion Semaphore) Delta TS www.Micrium.com

  18. Synchronization(Semaphores) Delta TS www.Micrium.com

  19. Synchronization(Event Flags) Delta TS www.Micrium.com

  20. Message Passing(Message Queues) Delta TS www.Micrium.com

  21. Other µC/OS-III Features • Task Management • Suspend/Resume a task • Delete a task • Time Management • Software Timers • Fixed-Size Memory Partitions • Pending on Multiple Objects • And more. www.Micrium.com

  22. µC/Probe www.Micrium.com

  23. What is µC/Probe? • ‘Windows’ application to display/change target data: • ANY variable • ANY memory location • ANY I/O port • Works with ANY processor • 8-, 16-, 32-, 64-bit or DSP • Works with ANY compiler • Compiler/linker needs to generate an ELF/DWARF file such as Embedded Workbench • Supports many interfaces • RS-232C • USB • TCP/IP (Ethernet) • J-Link • SWD (Cortex-M3) … NO target resident coded needed! • Others • Target doesn’t need an RTOS • Works with or without an RTOS www.Micrium.com

  24. µC/ProbeµC/OS-III Task Awareness Task Name Task Priority % CPU Usage #Context Switches Max Interrupt Disable Time Stack Usage ISR to Task Response ISR to Task Response www.Micrium.com

  25. To run the book examples… you will need: • The µC/OS-III book • The TI EVALBOT • http://www.ti.com/evalbot • Download and install the IAR 32K edition of Embedded Workbench for the ARM (V5.5) • http://supp.iar.com/Download/SW/?item=EWARM-KS32 • You will need to install the J-Link driver • Download and unzip the µC/OS-III book examples: • http://www.Micrium.com/Books/Micrium-uCOS-III • Download and install the non-time limited TRIAL version of µC/Probe: • http://www.Micrium.com/Books/Micrium-uCOS-III

  26. Texas Instruments EVALBOT unassembled

  27. Texas Instruments EVALBOT User Switches (2) Speaker Stellaris LM3S9B92 Bumpers (2) USB-Device Connector USB-Host Connector 96x6 OLED Display RJ45 10/100 Ethernet ON/OFF Switch MicroSD Socket Motor/Wheel (2) Batteries (3 AA) In-Circuit Debug Interface

  28. Examples • Example 1: Simple Display • Rotates a series of messages on the Display • Blinks LEDS on the board • Example 2: Using Audio • Bump sensors select next or previous wav track • SWITCH2 begins audio playback, SWITCH1 stops playback • Example 3: Simple Control • Manual start/stop of the motor via SWITCH1, SWITCH2 and bump sensors • Example 4: Autonomous Control • EVALBOT moves randomly and reacts to sensor inputs.

  29. Autonomous EVALBOT Control Motor Tasks receives command, interprets and posts to PID Task Control Task queues commands to motor tasks If Timer expires a random turn is initiated PID Task closes motor control loop based on feedback from speed sensor interrupt handlers Input Monitor Task posts flags to Control Task speed sensor interrupts relay data back to PID Task buttons and Bump Sensor trigger Input monitor task

More Related