Download presentation
Presentation is loading. Please wait.
Published byTatyana Sutherby Modified over 9 years ago
1
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 2
3
Find the right ARM ® Solution for you 32-bit ARM Cortex™-M3 MCUs DSP DSP+ARM ARM Cortex-A8 & ARM9™ MPUs Stellaris ® ARM Cortex-M3 Sitara ™ ARM Cortex-A8 & ARM9 C6000 ™ DaVinci ™ Digital Media processors Integra ™ Up to 80 MHz Flash 8 KB to 256 KB USB, ENET MAC+PHY CAN, ADC, PWM, SPI Connectivity,Security, Motion Control, HMI, Industrial Automation $1.00 to $8.00 32-bit ARM MCU for Safety-Critical Applications TMS570 ARM Cortex-R4 ™ Up to 250 DMIPS/ 160 MHz 2 MB Flash, 160 KB RAM FPU, ECC, Timer/PWM Co-Proc, 12bit ADCs, CAN, EMIF, LIN, SPI, Flexray Transportation, Motor Control, Certified for use in safety critical (SIL3) systems $7.00 to $18.00 375MHz to >1GHz Cache, RAM, ROM USB, CAN, SATA, SPI, PCIe, EMAC Industrial automation, POS & portable data terminals $5.00 to $25.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 Comprehensive developer ecosystem Software support Development tools 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
© 2010, Micriµm, All Rights Reservedwww.Micrium.com Display with optional Touch Interface Display Controller Touch Screen Controller Graphical User Interface File System Media Controller Media (SD) (MMC) (NAND Flash) (NOR Flash) (CF) (RAM Disk) Other Audio I 2 S Controller Keyboard Controller CPU Timer Interrupt Controller Real-Time Kernel Ethernet Controller (MAC/PHY) TCP/IP Stack USB (Host) (Device) USB Stacks CAN Controller CAN RS-232C RS-485 Modbus Other (Shell) (Clk) (CRC) (etc.) TCP/IP Apps Application RTOS RTOS vs Real-Time Kernels
6
© 2010, Micriµm, All Rights Reservedwww.Micrium.com 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
7
© 2010, Micriµm, All Rights Reservedwww.Micrium.com What is a Real-Time Kernel? Task Event Each Task Infinite Loop Task High Priority Task Low Priority Task Task Importance Task
8
© 2010, Micriµm, All Rights Reservedwww.Micrium.com ISR Low-priority task High-priority task ISR Preemptive Kernels Interrupt occurs ISR completes and the kernel switches to the high-priority task © 2009, Micriµm, All Rights Reserved www.Micrium.com Via a kernel call, the ISR makes the high priority task ready The kernel switches to the low-priority task Time
9
© 2010, Micriµm, All Rights Reservedwww.Micrium.com 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
10
© 2010, Micriµm, All Rights Reservedwww.Micrium.com µC/OS-III Summary 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
11
© 2010, Micriµm, All Rights Reservedwww.Micrium.com µC/OS-III Summary 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
12
© 2010, Micriµm, All Rights Reservedwww.Micrium.com 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) */ } Typical µC/OS-III Tasks Task (Priority) Stack (RAM) CPU Registers Variables Arrays Structures I/O Devices (Optional)
13
© 2010, Micriµm, All Rights Reservedwww.Micrium.com 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); ‘Creating’ a Task Task Control Block Task Name Task Start Address Priority Stack Stack Size Stack Limit Time Slice Options
14
© 2010, Micriµm, All Rights Reservedwww.Micrium.com The µC/OS-III Scheduler Using Count Leading Zeros (CLZ) The Cortex-M3 has a CLZ instruction –Makes scheduling much faster … ex. with 64 priorities 0000000000000000 310 0000110011101111 [0] [1] 32 5 Ready Priority = 37 3263 if (ReadyTbl[0] == 0) Prio = CLZ(ReadyTbl[1]) + 32; else Prio = CLZ(ReadyTbl[0]); #Zeros ReadyTbl[]
15
© 2010, Micriµm, All Rights Reservedwww.Micrium.com The µC/OS-III Ready List Highest Priority Lowest Priority Multiple Tasks At Same Priority
16
© 2010, Micriµm, All Rights Reservedwww.Micrium.com Context Switch ARM 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
17
© 2010, Micriµm, All Rights Reservedwww.Micrium.com Resource Management (Mutual Exclusion Semaphore) Delta TS
18
© 2010, Micriµm, All Rights Reservedwww.Micrium.com Synchronization (Semaphores) Delta TS
19
© 2010, Micriµm, All Rights Reservedwww.Micrium.com Synchronization (Event Flags) Delta TS
20
© 2010, Micriµm, All Rights Reservedwww.Micrium.com Message Passing (Message Queues) Delta TS
21
© 2010, Micriµm, All Rights Reservedwww.Micrium.com 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.
22
© 2010, Micriµm, All Rights Reservedwww.Micrium.com µC/Probe
23
© 2010, Micriµm, All Rights Reservedwww.Micrium.com 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
24
© 2010, Micriµm, All Rights Reservedwww.Micrium.com µC/Probe µC/OS-III Task Awareness Task Name Task Priority % CPU Usage Max Interrupt Disable Time Stack Usage ISR to Task Response ISR to Task Response #Context Switches
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 26
27
Texas Instruments EVALBOT Bumpers (2) 96x6 OLED Display Motor/Wheel (2) Batteries (3 AA) ON/OFF Switch User Switches (2) Stellaris LM3S9B92 MicroSD Socket RJ45 10/100 Ethernet USB-Device Connector USB-Host Connector In-Circuit Debug Interface Speaker
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. 28
29
Autonomous EVALBOT Control 29 Input Monitor Task posts flags to Control Task Control Task queues commands to motor tasks If Timer expires a random turn is initiated Motor Tasks receives command, interprets and posts to PID Task PID Task closes motor control loop based on feedback from speed sensor interrupt handlers speed sensor interrupts relay data back to PID Task buttons and Bump Sensor trigger Input monitor task
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.