快 速 porting μc/os-ii 及 driver 解 說



Similar documents
8. MicroC/OS-II Real-Time Operating System

The Real-Time Operating System ucos-ii

Using the NicheStack TCP/IP Stack - Nios II Edition Tutorial

Comparing RTOS to Infinite Loop Designs

949 Crestview Circle Weston, FL U.S.A. The Real-Time kernel V2.90. Release Notes. Copyright 2010, Micriµm All Rights reserved

Real-Time Operating Systems With Example PICOS18. What is an Operating System?

A. Using the Nios II Integrated Development Environment

SYSTEM ecos Embedded Configurable Operating System

Notes and terms of conditions. Vendor shall note the following terms and conditions/ information before they submit their quote.

REAL TIME OPERATING SYSTEMS. Lesson-10:

Real Time Operating Systems. Tajana Simunic Rosing Department of Computer Science and Engineering University of California, San Diego.

the high-performance embedded kernel User Guide Version 5.0 Express Logic, Inc Toll Free 888.THREADX FAX

Deciding which process to run. (Deciding which thread to run) Deciding how long the chosen process can run

Module 8. Industrial Embedded and Communication Systems. Version 2 EE IIT, Kharagpur 1

Embedded Systems. 6. Real-Time Operating Systems

Real Time Operating Systems. Tajana Simunic Rosing Department of Computer Science and Engineering University of California, San Diego.

Linux A multi-purpose executive support for civil avionics applications?

Linux 2.4. Linux. Windows

Real-Time Operating Systems.

Page 1 of 5. IS 335: Information Technology in Business Lecture Outline Operating Systems

Operating Systems. Module Descriptor

Overview. Open source toolchains. Buildroot features. Development process

Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6

What is best for embedded development? Do most embedded projects still need an RTOS?

Performance Comparison of RTOS

Weighted Total Mark. Weighted Exam Mark

MQX Lite Real-Time Operating System User Guide

Eddy Integrated Development Environment, LemonIDE for Embedded Software System Development

REAL TIME OPERATING SYSTEMS. Lesson-3:

Introduction to Embedded Systems. Software Update Problem

Efficient Implementation of the bare-metal Hypervisor MetalSVM for the SCC

STLinux Software development environment

Real-Time Systems Prof. Dr. Rajib Mall Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Priority Based Implementation in Pintos

Realtime Linux Kernel Features

Nios II Software Developer s Handbook

Embedded Software development Process and Tools:

Master of Engineering Thesis. Evaluation and Implementation of the RTOS ecos

EE 472 Lab 2 (Group) Scheduling, Digital I/O, Analog Input, and Pulse Generation University of Washington - Department of Electrical Engineering

Operating System Manual. Realtime Communication System for netx. Kernel API Function Reference.

Using the FreeRTOS Real Time Kernel NXP LPC17xx Edition

Porting ecos to the Analog Devices BLACKfin DSP

Application Note: AN00121 Using XMOS TCP/IP Library for UDP-based Networking

RIOS: A Lightweight Task Scheduler for Embedded Systems

Why Threads Are A Bad Idea (for most purposes)

Helping you avoid stack overflow crashes!

Lecture 3 Theoretical Foundations of RTOS

Going Linux on Massive Multicore

Design and Development of ARM Processor Based Web Server

CPU Scheduling Outline

Chapter 2: OS Overview

Special FEATURE. By Heinrich Munz

Embedded Component Based Programming with DAVE 3

KVM in Embedded Requirements, Experiences, Open Challenges

Keil C51 Cross Compiler

Thomas Fahrig Senior Developer Hypervisor Team. Hypervisor Architecture Terminology Goals Basics Details

Track One Building a connected home automation device with the Digi ConnectCore Wi-i.MX51 using LinuxLink

APPLICATION NOTE. AT04056: Getting Started with FreeRTOS on Atmel SAM Flash MCUs. Atmel SMART. Introduction

Tasks Schedule Analysis in RTAI/Linux-GPL

ARM RTX Real-Time Operating System

EE8205: Embedded Computer System Electrical and Computer Engineering, Ryerson University. Multitasking ARM-Applications with uvision and RTX

RTOS Debugger for ecos

REAL TIME OPERATING SYSTEM PROGRAMMING-II: II: Windows CE, OSEK and Real time Linux. Lesson-12: Real Time Linux

Embedded Linux Platform Developer

Freescale MQX Software Solutions

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

RIOS: A Lightweight Task Scheduler for Embedded Systems

Red Hat Linux Internals

Processes and Non-Preemptive Scheduling. Otto J. Anshus

EECE 276 Embedded Systems

SOFTUNE REALOS CONFIGURATOR MANUAL

How to Run the MQX RTOS on Various RAM Memories for i.mx 6SoloX

Getting Started. Building Applications with RL-ARM. For ARM Processor-Based Microcontrollers.

Kernel. What is an Operating System? Systems Software and Application Software. The core of an OS is called kernel, which. Module 9: Operating Systems

White Paper. Real-time Capabilities for Linux SGI REACT Real-Time for Linux

Complete Integrated Development Platform Copyright Atmel Corporation

Attention. restricted to Avnet s X-Fest program and Avnet employees. Any use

Programación de Sistemas Empotrados y Móviles (PSEM)

Technical Note TN_146. Creating Android Images for Application Development

XMOS Programming Guide

Objectives. Chapter 5: CPU Scheduling. CPU Scheduler. Non-preemptive and preemptive. Dispatcher. Alternating Sequence of CPU And I/O Bursts

COMPARISON BETWEEN QNX RTOS V6.2 AND RED HAT EMBEDDED LINUX (ELDS) V1.1

VtRES Towards Hardware Embedded Virtualization Technology: Architectural Enhancements to an ARM SoC. ESRG Embedded Systems Research Group

ELEC 377. Operating Systems. Week 1 Class 3

Developing Embedded Software with Free and Open Source Tools

Using the TASKING Software Platform for AURIX

Linux Driver Devices. Why, When, Which, How?

CHAPTER 15: Operating Systems: An Overview

Ways to Use USB in Embedded Systems

Reminders. Lab opens from today. Many students want to use the extra I/O pins on

Mobile Operating Systems Lesson 05 Windows CE Part 1

System Software Integration: An Expansive View. Overview

Simple Cooperative Scheduler for Arduino ARM & AVR. Aka «SCoop»

Project 11: FreeRTOS TM Real-Time Control of a Stepper Motor

Computer Science and Engineering Linux Cisco VPN Client Installation and Setup Guide

Embedded OS. Product Information

An Implementation Of Multiprocessor Linux

Real-Time Component Software. slide credits: H. Kopetz, P. Puschner

University of Dayton Department of Computer Science Undergraduate Programs Assessment Plan DRAFT September 14, 2011

Transcription:

快 速 porting μc/os-ii 及 driver 解 說 沈 智 明 晶 心 科 技 公 司 資 深 經 理 Email: jimmy@andestech.com WWW.ANDESTECH.COM

Outline Application Building Blocks μc/os-ii/rtos Introduction μc/os-ii & FreeRTOS Merge μc/os-ii kernel into Andes Demo Program Driver Introduction & Demo Analysis 2

Application Building Blocks Fundamental All-C Embedded Programming environment Optimized MCUlib, newlib, glibc, and uclibc Concise linker script Linker Scattering-and-Gathering (LdSaG), and its tool Sample programs to demo AndesCore s features Real-Time Operating System FreeRTOS, ecos, and contiki (open source) μc/os-ii, μc/os-iii and middleware (from Micriμm) ThreadX and middleware (from Express Logic) Nucleus kernel (from Mentor Graphics) μc3 micro c cube (μitron from eforce) Linux, Middleware and SW Framework U-Boot (mainlined), OpenWrt OProfile, gdbserver, strace GTK, Qt, and rdesktop Linux kernel 2.6.32 & 3.4.x and device drivers 3

Multi-tasking 4

Mutual Exclusion Concepts Mutual exclusion (often abbreviated to mutex) algorithms are used in concurrent programming to avoid the simultaneous use of a common resource, such as a global variable, by pieces of computer code called critical sections. Critical Section of Code: Also called critical region, is code that needs to be treated indivisibly. Once the section of code starts executing, it must not be interrupted. Resource: A resource is any entity used by a task, it can thus be an I/O device, such as a printer, a variable or an array. Shared Resource: A shared resource is that can be used by more than one task. Each task should gain exclusive access to the shared resource to prevent data corruption. This is called mutual exclusion. http://zh.wikipedia.org/wiki/%e4%ba%92%e6%96% A5%E9%94%81 5

Reentrancy Function A reentrant function can be used by more than one task without fear of data corruption. It can be interrupted at any time and resumed at a later time without lost of data. It either use local variables or protect data when global variables are used. Example void strcpy(char *dest, char *src) { while (*dest++ = *src++) { ; } *dest = NUL; } 6

Non-Reentrant function Example : int Temp; void swap(int *x, int *y) { Temp = *x; *x = *y; *y = Temp; } 7

μc/os II Feature Open source code Memory footprint is about 20K for a fully functional kernel. Code size: 5KB ~ 24KB Preemptive priority-driven real-time scheduling Portable: Support many platforms:andes,x86,arm,mips ROMable: Was designed for embedded applications. It s easy as part of a product Scalable: you can use only the services that you need in your application. Multi-tasking: can manage up to 64 tasks, however, the current version of the software reserves eight (8) of these tasks for system use. Deterministic: Execution time of all μc/os-ii functions and services are deterministic. Task stacks: Each task requires its own stack, however, μc/os-ii allows each task to have a different stack size. Services: provides a number of system services such as mailboxes, queues, semaphores, fixed-sized memory partitions, time related functions, etc. Interrupt Management: Interrupts can be nested up to 255 levels deep. Robust and reliable: 8

Task states OSTaskDel OSTaskCreate OSTaskCreateExt Waiting Dormant OSIntExit Ready Running ISR OSTaskDel Task State Diagram OSMBoxPost OSQPost OSQPostFront OSSemPost OSTaskResume OSTimeDlyResume OSTimeTick OSTaskDel OSStart OS_TASK_SW Task is Preempted OSMBoxPend OSQPend OSSemPend OSTaskSuspend OSTimeDly Interrupt OSIntExit 9

uc/os-ii & FreeRTOS Kernel ROM Footprint range uc/os-ii FreeRTOS 6 ~ 26 KB 4 ~ 9 KB Tasks counts support 255 > 255 Multitasking model Code Execution Entities Synchronization Mechanisms License Extra Features Preemptive with unique priority tasks Tasks, ISR Queque Semaphores Mutex Flag MailBox commercial (45-day trial) TCPIP USB host/device/otg FAT CAN GUI Bluetooth Preemptive with round robin for same priority tasks Tasks, Coroutine, ISR Queque Semaphores Mutex Flag GPLv3 with exception TCPIP FAT (possibility of migration to OpenRTOS and SafeRTOS for commercial supporting) 10

Merge μc/os-ii kernel into Andes Demo Program Access website http://www.micrium.com/page/products/rtos/os-ii Download Micrium-uCOS-II-V291.ZIP kernel source code Merge μc/os II and Andes Demo Program tar zxvf ucos-ii_withoutkernel.tgz unzip Micrium-uCOS-II-V291.ZIP cp Micrium/Software/uCOS-II/Source/* rtos-ucos-ii/ucosii/source/ tar zcvf ucos-ii.tgz rtos-comm/ rtos-ucos-ii/ 11

Build&Run Demo Program How to build demo program Source Andes cross-complier Untar ucos-ii source code to workspace #tar zxvf ucos-ii.tgz Build individual APP by makefile #cd rtos-ucos-ii #make APP=BH AE210P=1 DEBUG=1 all After a while. Delivered image by AICE #ddd -debugger nds32le-elf-gdb build/bh.elf Delivered image by SD card # cp bin/bh.bin to SD card 12

For Example -> Timer What is our purpose? Setup timer interval. Hookup ISR Driver Introduction Start.S -> BSP_Init ->main /* Init all timer device */ hal_timer_init(0); /* System tick init */ BSP_Tmr_TickInit(0x1, (MB_PCLK / TICK_HZ), IRQ_SYS_TICK_VECTOR, tick_isr_fp); 13

Demo Analysis Why RTOS? The difference between RTOS & Non-OS How Threads/Tasks work within RTOS? Semaphore, event, queue.. Kernel scheduler Task Yield: task A-> scheduler -> task B. While(1){ Event_wait.... } While(1){ semaphore.... } Interrupt Yield: task A ->interrupt -> scheduler -> task B 14

Bottom half Analysis How Threads/Tasks work within RTOS? bottom half Thread + Semaphore Kernel scheduler BH While(1){ getchar() post_semaph ore... } While(1){ pend_semap hore.... } 15

Andes e-service is a web-based support ticket system. It is a convenient way to get quick response of your question. How to apply for a new account? Please send your information to es.admin@andestech.com Including your name, e-mail, company name and telephone number 16

How to Use E-service? E-service website: http://es.andestech.com/ilogin.php You can track your ticket in e-service system 17