Lab 3 Department of Computer Science and Information Engineering National Taiwan University Lab3 – μC/OS 2015/10/13/ 13 1.

Slides:



Advertisements
Similar presentations
How to Use Stowe School District
Advertisements

Embedded System Presentation Nguyễn Trần Quang Nguyễn Công Vũ 1µC/OS-II.
Chapter 14 80x86, Large Model Port Porting to real mode and for the large model –Real mode: 1Mb memory space (pointers in this model require 32 bits) –In.
Lab6 – Debug Assembly Language Lab
Lab 4 Department of Computer Science and Information Engineering National Taiwan University Lab4 - Bootloader 2014/10/14/ 13 1.
Department of Mathematics and Computer Science μC/OS-II 2IN60: Real-time Architectures (for automotive systems)
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
Threads CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
MicroC/OS-II Embedded Systems Design and Implementation.
Real-Time Operating Systems Suzanne Rivoire November 20, 2002
Programming & Development of Mobile & Embedded Systems Lin Zhong ELEC424, Fall 2010.
Outline Introduction to MQX Initializing and starting MQX
ΜC/OS-III Tasks Akos Ledeczi EECE 354, Fall 2010 Vanderbilt University.
Lab 3 Department of Computer Science and Information Engineering National Taiwan University Lab3 - Cross Tools 2014/10/7/ 20 1.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Introduction Purpose  This training course provides an overview of the installation and.
COMPUTER SYSTEM LABORATORY Lab10 - Sensor II. Lab 10 Experimental Goal Learn how to write programs on the PTK development board (STM32F207). 2013/11/19/
SOC Consortium Course Material SoC Design Laboratory Lab 8 Real-time OS - 2 Speaker: Yung-Chih Chen Advisor: Prof. Chun-Yao Wang November 17, 2003 Department.
Kernel structure & Task management © P.J.Fondse April 2010.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Purpose  This training course describes how to configure the the C/C++ compiler options.
Advanced Operating Systems CIS 720 Lecture 1. Instructor Dr. Gurdip Singh – 234 Nichols Hall –
The  C/OS-II Real-Time Operating System.  C/OS-II Real-time kernel –Portable, scalable, preemptive RTOS –Ported to over 90 processors Pronounced “microC.
RTEMS overview W. Eric Norum Introduction RTEMS is a tool designed specifically for real-time embedded systems The RTEMS product is an executive.
Lab 11 Department of Computer Science and Information Engineering National Taiwan University Lab11 - Porting 2014/12/9/ 26 1.
FINAL MPX DELIVERABLE Due when you schedule your interview and presentation.
Threads Many software packages are multi-threaded Web browser: one thread display images, another thread retrieves data from the network Word processor:
Lab 1 Department of Computer Science and Information Engineering National Taiwan University Lab1 - Sensor 2014/9/23/ 13 1.
SOC Consortium Course Material Real-time OS Speaker: 沈文中 April. 9, 2003 National Taiwan University Adopted from National Chiao- Tung University SOC Course.
Getting Started with the µC/OS-III Real Time Kernel Akos Ledeczi EECE 6354, Fall 2015 Vanderbilt University.
Discovering SQL all rights reserved (c) 2010 agilitator.com INSTALLING PostgreSQL 9.0.
Processes and Threads CS550 Operating Systems. Processes and Threads These exist only at execution time They have fast state changes -> in memory and.
2-1 The critical section –A piece of code which cannot be interrupted during execution Cases of critical sections –Modifying a block of memory shared by.
Scheduling in µC/OS-III Akos Ledeczi EECE 6354, Fall 2015 Vanderbilt University.
Real-time OS Hao-yuan Chin Feb. 18, Institute of Electronics, National Chiao Tung University Real-time OS 1 Outline Introduction to RTOS Introduction.
Lab 13 Department of Computer Science and Information Engineering National Taiwan University Lab13 – Interrupt + Timer 2014/12/23 1 /16.
Real-Time Systems Lecture 3 Teachers: Olle Bowallius Phone: Anders Västberg Phone:
ECGR-6185 µC/OS II Nayana Rao University of North Carolina at Charlotte.
We will focus on operating system concepts What does it do? How is it implemented? Apply to Windows, Linux, Unix, Solaris, Mac OS X. Will discuss differences.
Multi-Tasking The Multi-Tasking service is offered by VxWorks with its real- time kernel “WIND”.
Operating Systems CSE 411 CPU Management Sept Lecture 10 Instructor: Bhuvan Urgaonkar.
MicroC/OS-II S O T R.  MicroC/OS-II (commonly termed as µC/OS- II or uC/OS-II), is the acronym for Micro-Controller Operating Systems Version 2.  It.
Implementation of Embedded OS Lab4 Cortex-M3 Programming.
Lab 12 Department of Computer Science and Information Engineering National Taiwan University Lab12 – Driver 2014/12/16 1 /21.
Implementation of Embedded OS Lab3 Porting μC/OS-II.
Lab 5 Department of Computer Science and Information Engineering National Taiwan University Lab5 – Bootloader + OS Kernel 2015/10/27/ 25 1.
Lab 8 Department of Computer Science and Information Engineering National Taiwan University Lab8 - Root Filesystem 2015/11/10/ 22 1.
Lab 9 Department of Computer Science and Information Engineering National Taiwan University Lab9 - Debugging I 2014/11/4/ 28 1.
Embedded Computer - Definition When a microcomputer is part of a larger product, it is said to be an embedded computer. The embedded computer retrieves.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Introduction Purpose  This training course demonstrates the Project Generator function.
Lab 7 Department of Computer Science and Information Engineering National Taiwan University Lab7 – uCOS Application 2015/11/10/ 10 1.
Lab 5 Department of Computer Science and Information Engineering National Taiwan University Lab5 - OS Kernel 2014/10/21/ 16 1.
SOC Consortium Course Material SoC Design Laboratory Lab 8 Real-time OS - 1 Speaker: Yung-Chih Chen Advisor: Prof. Chun-Yao Wang November 17, 2003 Department.
Chapter 3: Kernel Structure 1. Objectives To understand what a task is. To learn how μ C/OS-II manages tasks. To know how an interrupt service routine.
Chapter 13: Porting μC/OS-II 1. Outline Requirements Hardware Software Tasks of Porting µC/OS-II OS_CPU_C.H OS_CPU_C.C OS_CPU_A.ASM Testing a port 2.
Chapter 3: Kernel Structure 1. Objectives To understand what a task is. To learn how μ C/OS-II manages tasks. To know how an interrupt service routine.
Chapter 1: Getting Started with μC/OS-II 1. kernel Introduction 2 LinuxμC/OS-II Task (process) kernel Device driver User mode (0-3G) (Kernel mode) 3G-4G.
Chapter 5: Time Management 1. Time Management OSTimeDly() OSTimeDlyHMSM() OSTimeDlyResume() OSTimeGet() OSTimeSet() 2.
Outlines  Introduction  Kernel Structure  Porting.
Lab 5 Department of Computer Science and Information Engineering National Taiwan University Lab5 – μC/OS 2016/5/31/ 13 1.
Chapter 1: Getting Started with μC/OS-II
Chapter 13: Porting μC/OS-II
CS4101 Introduction to Embedded Systems Lab 8: Tower System
Computer System Laboratory
Implementation of Embedded OS
Computer System Laboratory
Getting Started with the µC/OS-III Real Time Kernel
Roller Coaster Design Project
Computer System Laboratory
EE 472 – Embedded Systems Dr. Shwetak Patel.
Computer System Laboratory
Computer System Laboratory
Presentation transcript:

Lab 3 Department of Computer Science and Information Engineering National Taiwan University Lab3 – μC/OS 2015/10/13/ 13 1

Lab 3 Department of Computer Science and Information Engineering National Taiwan University  Practice real-time programming on μC/OS-II. 2015/10/13/ 13 2

Lab 3 Department of Computer Science and Information Engineering National Taiwan University  Host System  Windows XP  Build System  IAR Embedded Workbench  Target System  PTK development board (STM32F207)  Software  The source codes of μC/OS-II.  You can find all software on CSL Course Software.CSL Course Software 2015/10/13/ 13 3

Lab 3 Department of Computer Science and Information Engineering National Taiwan University  μC/OS-II is a real-time operating system with the following features:  Highly portable  It is written in ANSI C, with target-specific code written in assembly language.  It support various platforms, such as x86, MIPS, ARM.  ROMable  You can embed μC/OS-II as part of a product with the proper tool chain.  Very scalable  Simply specify which features to use through #define constant.  Preemptive real-time  It always runs the highest priority task that is ready.  Multitasking  It can manage up to 64 tasks, including 8 reserved tasks for μC/OS-II.  The source codes can be downloaded from the official website freely.official website  It is neither freeware nor open source code.  You are required to purchase a license for use in any commercial application. 2015/10/13/ 13 4

Lab 3 Department of Computer Science and Information Engineering National Taiwan University 2015/10/13/ 13 5 The definition of features in this application The main kernel The user tasks The functionalities of board support package (BSP) The functions of tick interrupt handler and context switch

Lab 3 Department of Computer Science and Information Engineering National Taiwan University  It is a multitasking and preemptive kernel with a priority-driven real-time scheduling.  Nested interrupts could go up to 256 levels.  There are 64 priorities, 0 is the highest, and 63 is the lowest.  Each task must have a unique priority in the application.  μC/OS-III supports more tasks having the same priority with round-robin scheduling, while it is not supported in μC/OS-II. 2015/10/13/ 13 6 Non-preemptive kernelPreemptive kernel

Lab 3 Department of Computer Science and Information Engineering National Taiwan University  A task control block (TCB) is a data structure used to maintain the state of a task when it is preempted.  All valid TCB’s are doubly linked.  Free TCB’s are linked in a free list.  The contents of a TCB is saved/restored when a context switch occurs.  The stack, priority, time delay, etc. of a task.  CPU registers are stored in the stack rather than in the TCB. 2015/10/13/ 13 7

Lab 3 Department of Computer Science and Information Engineering National Taiwan University  If there is no user task ready, it will start the idle task (the priority is 63).  In os_core.c : void OS_Sched (void) {... OS_ENTER_CRITICAL(); if (OSIntNesting == 0u) { if (OSLockNesting == 0u) { OS_SchedNew(); OSTCBHighRdy = OSTCBPrioTbl[OSPrioHighRdy]; if (OSPrioHighRdy != OSPrioCur) { #if OS_TASK_PROFILE_EN > 0u OSTCBHighRdy->OSTCBCtxSwCtr++; #endif OSCtxSwCtr++; OS_TASK_SW(); } OS_EXIT_CRITICAL(); } 2015/10/13/ 13 8 Find the highest ready task. Perform a context switch.

Lab 3 Department of Computer Science and Information Engineering National Taiwan University  app.c : void main(void) { OSInit(); OSTaskCreate( ((void (*)(void *)) App_TaskStart, (void *) 0, (OS_STK *) &App_TaskStartStk[APP_TASK_START_STK_SIZE - 1], (INT8U) APP_TASK_START_PRIO); OSStart(); } void App_TaskStart(void *pdata) { for (;;) { /* do something... */ OSTimeDly(100); } 2015/10/13/ 13 9 Each task performs an infinite loop. Initialize task ready list, priority table, TCBs, and free pool. Use OSTaskCreate() or OSTaskCreateExt() to create a task. Tasks become “ready” after they are created. Start multitasking of μC/OS-II (and never return). function pointer of a user task the pointer to the task's top of stack the task's priority task-specified data Use OSTimeDly() or OSTimeDlyHMSM() to do time delay. It allows other tasks to execute.

Lab 3 Department of Computer Science and Information Engineering National Taiwan University  Step 1: download the PTK_Examples, provided in Lab2.PTK_Examples  Step 2: download and extract the μC/OS-II source codes.μC/OS-II source codes  Step 3: copy the folder Software in Micrium to PTK_Examples/ePBB/Libraries/OS_uCOS-II/Micrium-V29x.  Step 4: connect the target system STM32F207 to Windows XP. 2015/10/13/ 13 10

Lab 3 Department of Computer Science and Information Engineering National Taiwan University  Step 1: open the serial console.  Please set baud rate to bps.  Step 2: open the following workspace in IAR Embedded Workbench IDE.  PTK_Examples/ePBB/Applications/Projects/PTK-STM32F207/EWARM- V6/OS_uCOS-II/base_uart/demo.eww  Step 3: compile the project and download the program to the target system.  Step 4: click the button “Go” or press the key “F5” to continue the execution.  You will see the message “Hello World!!!” on the serial console. 2015/10/13/ 13 11

Lab 3 Department of Computer Science and Information Engineering National Taiwan University  Now, you are asked to create several tasks in μC/OS-II to complete the followings:  Regularly read the value of temperature.  Regularly read the value of luminous flux.  Set up a key handler to display the message to LCD screen when a key button is pressed.  Other functionalities you can think.  Tips:  You need to initialize the LCD device by invoking “ ili9325_gui_config() ” in the function “ platform_board_init_hook() ”.  Be careful to the size of stack, do not give it too small! 2015/10/13/ 13 12

Lab 3 Department of Computer Science and Information Engineering National Taiwan University  Show that you can display the information of current temperature and luminous flux on LCD screen by pressing key buttons and your other ideas.  Please hand in your lab report to the FTP.  Server:  Username: csl2015  Password: csl2015HomeWork  Directory: lab3,4  Please use this format for filename: “G# Ver#”, where G# is your group id and Ver# is revision version number.  E.g., G1 Ver2 2015/10/13/ 13 13