ENTC-489 Embedded Real Time Software Development Embedded Real Time Software Development Week 1 Introduction Week 1 - Introduction (Rev 2) 1.

Slides:



Advertisements
Similar presentations
A Sample RTOS Presentation 4 Group A4: Sean Hudson, Manasi Kapadia Syeda Taib.
Advertisements

Real-Time Library: RTX
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 3: Input/output and co-processors dr.ir. A.C. Verschueren.
HW/SW Interface Operating Systems Design and Implementation.
Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators.
Figure 2.8 Compiler phases Compiling. Figure 2.9 Object module Linking.
CSE Fall Introduction - 1 What is an Embedded Systems  Its not a desktop system  Fixed or semi-fixed functionality (not user programmable)
Embedded Real-time Systems The Linux kernel. The Operating System Kernel Resident in memory, privileged mode System calls offer general purpose services.
Chapter 13 Embedded Systems
Real-Time Kernels and Operating Systems. Operating System: Software that coordinates multiple tasks in processor, including peripheral interfacing Types.
MicroC/OS-II Embedded Systems Design and Implementation.
Embedded Systems Interrupts C.-Z. Yang Sept.-Dec
Phones OFF Please Processes Parminder Singh Kang Home:
OS Implementation On SOPC Final Presentation
Performance Evaluation of Real-Time Operating Systems
Evolution of Microcontroller Firmware Development David Benjamin.
The 6713 DSP Starter Kit (DSK) is a low-cost platform which lets customers evaluate and develop applications for the Texas Instruments C67X DSP family.
Advanced Embedded Systems Design Pre-emptive scheduler BAE 5030 Fall 2004 Roshani Jayasekara Biosystems and Agricultural Engineering Oklahoma State University.
Introduction to Embedded Systems
Real-Time Kernel (Part 1)
Ch. 9 Interrupt Programming and Real-Time Sysstems From Valvano’s Introduction to Embedded Systems.
Advanced Operating Systems CIS 720 Lecture 1. Instructor Dr. Gurdip Singh – 234 Nichols Hall –
Process Management. Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication.
1 Computer System Overview Chapter 1. 2 n An Operating System makes the computing power available to users by controlling the hardware n Let us review.
MICROPROCESSOR INPUT/OUTPUT
ENTC-489 Embedded Real Time Software Development Embedded Real Time Software Development Week 10 Real Time System Design.
Getting Started with the µC/OS-III Real Time Kernel Akos Ledeczi EECE 6354, Fall 2015 Vanderbilt University.
ECS642U Embedded Systems Cyclic Execution and Polling William Marsh.
ENTC-489 Embedded Real Time Software Development Embedded Real Time Software Development Week 7 Review, Quiz, & Watchdog Timers.
Operating System Principles And Multitasking
ENTC-489 Embedded Real Time Software Development Embedded Real Time Software Development Week 4 Review.
Embedded Systems OS. Reference Materials The Concise Handbook of Real- Time Systems TimeSys Corporation.
RTX - 51 Objectives  Resources needed  Architecture  Components of RTX-51 - Task - Memory pools - Mail box - Signals.
ECGR-6185 µC/OS II Nayana Rao University of North Carolina at Charlotte.
Multi-threaded projects Services and Drivers Alternate ways of doing Labs 1, 2, 3 and 4.
Real Time Operating Systems Michael Thomas Date: Rev. 1.00Date.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process-Concept.
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.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
Chapter 2 Process Management. 2 Objectives After finish this chapter, you will understand: the concept of a process. the process life cycle. process states.
Operating Systems (CS 340 D) Dr. Abeer Mahmoud Princess Nora University Faculty of Computer & Information Systems Computer science Department.
CSE466 - Fall What is an Embedded System  Its not a desktop system  Fixed or semi-fixed functionality (not user programmable)  Lacks some or.
For a good summary, visit:
Time Management.  Time management is concerned with OS facilities and services which measure real time.  These services include:  Keeping track of.
Embedded Computer - Definition When a microcomputer is part of a larger product, it is said to be an embedded computer. The embedded computer retrieves.
1 Run-to-Completion Non-Preemptive Scheduler. 2 In These Notes... What is Scheduling? What is non-preemptive scheduling? Examples Run to completion (cooperative)
CHAPTER 7 CONCURRENT SOFTWARE Copyright © 2000, Daniel W. Lewis. All Rights Reserved.
Unit - I Real Time Operating System. Content : Operating System Concepts Real-Time Tasks Real-Time Systems Types of Real-Time Tasks Real-Time Operating.
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.
Microcontrollers JULES CALELLA. Microcontrollers vs Microprocessors  Microprocessors – do not contain RAM, ROM, I/O  Microcontrollers – The whole package.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Big Picture Lab 4 Operating Systems C Andras Moritz
Outlines  Introduction  Kernel Structure  Porting.
Real-Time Operating Systems RTOS For Embedded systems.
Real-time Software Design
REAL-TIME OPERATING SYSTEMS
Processes and threads.
Advanced Operating Systems CIS 720
CS 6560: Operating Systems Design
Topics Covered What is Real Time Operating System (RTOS)
Operating Systems (CS 340 D)
Process Management Presented By Aditya Gupta Assistant Professor
Operating Systems (CS 340 D)
Writing and Testing Your First RTOS Project with MQX
Architectural Support for OS
EE 472 – Embedded Systems Dr. Shwetak Patel.
Chapter 3: Processes.
Architectural Support for OS
Presentation transcript:

ENTC-489 Embedded Real Time Software Development Embedded Real Time Software Development Week 1 Introduction Week 1 - Introduction (Rev 2) 1

ENTC-489 Embedded Real Time Software Development Today’s Agenda House Keeping Real Time Kernel Concepts Introduction to our development platform Preparation for first homework assignment Week 1 - Introduction (Rev 2) 2

ENTC-489 Embedded Real Time Software Development House Keeping Instructor Goals for this class Expectations / Grading Week 1 - Introduction (Rev 2) 3

ENTC-489 Embedded Real Time Software Development Instructor Mike Willey – BSEE Texas A&M ’78 – Second Aggie in family, first was Eugene Couch, BSME ‘1897 – 36 years designing embedded systems – Co-owner, CTO Paragon Innovations, Inc. – 30 years programming in C and using embedded kernels Week 1 - Introduction (Rev 2) 4

ENTC-489 Embedded Real Time Software Development Goals for this class Develop skills that will enable you to get and keep a job designing embedded systems firmware – Demonstrate knowledge of the vocabulary of Embedded Kernels – Demonstrate an understanding of memory sharing, dynamic allocation/de-allocation, and stack usage in an embedded design – Demonstrate an ability to use binary semaphores, counting semaphores, and message queues – Demonstrate an ability to design a multi-tasking embedded application using diagrams and text – Demonstrate a knowledge of defensive programming techniques – Design and implement a practical embedded application with at least 5 tasks Week 1 - Introduction (Rev 2) 5

ENTC-489 Embedded Real Time Software Development Expectation / Support / Grading Midterm Exam (Open Book)25% Final Exam (Open Book)25% Quizzes / Homework25% 5 Task Application Project25% Total100% Week 1 - Introduction (Rev 2) 6 A , B 80-89, C 70-79, D 60-69, F < 60 My expectation is that the software you write for this class will be the same quality that a professional engineering company would require of any technical contributor.

ENTC-489 Embedded Real Time Software Development Expectations / Support / Grading (cont) Software Application Grading – 55% Performs required functions – 5%No compiler warnings – 15%Proper use of highlighted techniques – 15%Design documentation / comments – 10%Conforms with Class Coding Standards – Bonus opportunities (must get full points for “Performs required functions”, max +10%) 5%Use processor I/O registers directly rather than Tiva Ware calls 5%Use of Doxygen to document program Week 1 - Introduction (Rev 2) 7

ENTC-489 Embedded Real Time Software Development Bonus Opportunities Use Processor I/O registers rather than TivaWare calls – Can use TivaWare as a go-by, but DO NOT Xerox! – Keep in separate source/include files – May use TivaWare “inc/*.h” but not “driverlib/*.h” Use Doxygen – Every function created by you MUST have a Doxygen entry for description, parameters and return values – All #defines and globals must have a description – The descriptions must be “useful” to aid in understanding and use. Week 1 - Introduction (Rev 2) 8

ENTC-489 Embedded Real Time Software Development Expectations / Support / Grading (cont) Class Support Site – Contains my blog, instructions for setting up tools, handy resources, class coding standards, etc. Software homework – CCS File->Export->General->Archive File File name for Jane Smith, Assignment “Blinky” s15_jsmith_blinky.zip Supply on a flash drive to be returned following week or Upload to – Requires registration on the web site Registration may take hours for approval Week 1 - Introduction (Rev 2) 9

ENTC-489 Embedded Real Time Software Development Real Time Kernel Concepts Superloops Foreground/Background Systems Real-Time Kernels Week 1 - Introduction (Rev 2) 10

ENTC-489 Embedded Real Time Software Development Superloops Week 1 - Introduction (Rev 2) 11 Task 1Task 2Task 3Task 4

ENTC-489 Embedded Real Time Software Development Superloops void main (void) { initialization_code(); while (1) { read_adc(); read_serial_command(); write_serial_results(); for (i=0; i < bigvalue; i++) { /* delay to synchronize read_adc() */ } Week 1 - Introduction (Rev 2) 12

ENTC-489 Embedded Real Time Software Development Superloops Pros Easy for very simple stuff No upfront cost Minimal training No extra memory for OS Cons Difficult to catch external events Complexity grows quickly Timing is impossible to predict Week 1 - Introduction (Rev 2) 13

ENTC-489 Embedded Real Time Software Development Foreground/Background Systems Week 1 - Introduction (Rev 2) 14 Task 1 ISR #1 ISR #2 Task 2#3 Task 4

ENTC-489 Embedded Real Time Software Development Foreground/Background Systems Background void main (void) { perform_initialization(); while (1) { read_adc(); read_serial_command(); write_serial_result(); wait_timer_flag(); clear_timer_flag(); } Foreground void serial_isr(void) { clear_irq(); store_received_char(); } void timer_isr (void) { clear_irq(); set_timer_flag(); } Week 1 - Introduction (Rev 2) 15

ENTC-489 Embedded Real Time Software Development Foreground/Background Systems Pros No upfront cost Minimal training required Single stack area for – Function nesting – Local variables – ISR nesting No extra memory for OS Minimal interrupt latency Cons Difficult to ensure timing is met All background code has same priority If one function takes longer than expected, the whole system will suffer Complexity increases as the number of background tasks increases Week 1 - Introduction (Rev 2) 16

ENTC-489 Embedded Real Time Software Development Kernel Operating System vs. Kernel Week 1 - Introduction (Rev 2) 17 Application Hardware File System GUI TCP/IP USB Bluetooth RS-232 An Operating System is a collection of software that provides services useful to Application code. A Kernel provides task scheduling and communication for the other Operating System components and the Application.

ENTC-489 Embedded Real Time Software Development Real-Time If a task must be completed within a given time, it is said to be a real-time task – In other words, the task has a deadline There are two categories of real-time tasks – Hard Real-time tasks Missing the deadline results in a severe problem. For these tasks a late response is equivalent to an incorrect response – Soft Real-time tasks Missing a deadline does not cause dire consequences Week 1 - Introduction (Rev 2) 18

ENTC-489 Embedded Real Time Software Development Determinism Fast software is not necessarily real-time software Determinism is a desirable quality in real-time software Software is deterministic if it has a bounded response time to events Week 1 - Introduction (Rev 2) 19

ENTC-489 Embedded Real Time Software Development Real-Time Kernel A real-time kernel is a framework for developing multi-task applications The services provided by a real-time kernel can help an application meet its timing requirements The primary service provided by any real-time kernel is task scheduling Week 1 - Introduction (Rev 2) 20

ENTC-489 Embedded Real Time Software Development Real-Time Kernel Pros Simplifies complex systems Creating time-deterministic software is more straight forward Adding functionality has minimum impact on existing code Very easy for multiple contributors to work in same code base Cons Up front cost or port of open source code Requires design prior to coding Consumes extra memory Week 1 - Introduction (Rev 2) 21

ENTC-489 Embedded Real Time Software Development What is a task? A task is a simple program that thinks it has the CPU all to itself. A task will have a priority, based on its importance Week 1 - Introduction (Rev 2) 22 Task (Priority) CPU Registers Variables Arrays Structures I/O Devices Stack (RAM) (Optional)

ENTC-489 Embedded Real Time Software Development Tasks in a Kernel-Based System Week 1 - Introduction (Rev 2) 23 High Priority Task Low Priority Task Task Event Each Task Infinite Loop Importance

ENTC-489 Embedded Real Time Software Development Kernel Based System Tasks void read_ADC_task( void ){ while (1) { wait for conversion time; start A/D conversion; wait for signal from ISR; store_store_ADC_value(); } void read_serial_task (void) { while (1) { wait for character; if (not end of line) { put character in buffer; } else { process command; clear buffer; } ISRs void timer_irq (void) { clear interrupt; signal conversion time; } void adc_irq (void) { clear interrupt; signal conversion complete; } void serial_irq (void) { clear interrupts; signal character ready; } Week 1 - Introduction (Rev 2) 24

ENTC-489 Embedded Real Time Software Development Real Time Kernel Types A cooperative kernel (non-preemptive) relies on each task to relinquish the use of the CPU on a regular basis A preemptive kernel evaluates the highest priority task when returning from interrupt routines and resumes the highest priority task, rather than the one which was interrupted Week 1 - Introduction (Rev 2) 25

ENTC-489 Embedded Real Time Software Development Cooperative Kernels Week 1 - Introduction (Rev 2) 26 ISR Low-priority task High-priority task ISR Via a kernel call, the ISR makes the high priority task ready ISR completes The low-priority task completes and the kernel switches to the high-priority task Interrupt occurs Time

ENTC-489 Embedded Real Time Software Development Preemptive Kernels Week 1 - Introduction (Rev 2) 27 ISR Low-priority task High-priority task ISR Interrupt occurs ISR completes and the kernel switches to the high-priority task Via a kernel call, the ISR makes the high priority task ready The kernel switches to the low-priority task Time

ENTC-489 Embedded Real Time Software Development Week 1 - Introduction (Rev 2) 28 Task States

ENTC-489 Embedded Real Time Software Development BREAK Week 1 - Introduction (Rev 2) 29

ENTC-489 Embedded Real Time Software Development Intro to Tiva Development Tiva T4C123G Launch Pad is REQUIRED Sensor Hub Booster Pack is REQUIRED Code Composer Studio 6 is REQUIRED Install the tools on your PC txwilley/ENTC-489-ERTSD and go to the “Getting Started” tab Installation is time consuming, start early First homework assignment will take some time, order you boards ASAP Week 1 - Introduction (Rev 2) 30

ENTC-489 Embedded Real Time Software Development TMC123G Launch Pad Debug USB on top Power switch right is “on” for debug RGB Led 2 Push Buttons TM4C123GH6PM CPU UART 0 to Debug USB Port Week 1 - Introduction (Rev 2) 31

ENTC-489 Embedded Real Time Software Development Sensor Hub Booster Pack MPU Axis Motion Sensor TMP006 Thermopile Sensor SHT21 Humidity Sensor BMP180 Pressure Sensor ISL29023 Light Sensor User LED Week 1 - Introduction (Rev 2) 32

ENTC-489 Embedded Real Time Software Development TM4C123GH6PM CPU Week 1 - Introduction (Rev 2) 33

ENTC-489 Embedded Real Time Software Development System Control Power on, runs on internal 16 MHz osc, PLL off, /16: 1 MHz instruction cycle We will run at 50MHz using the external 16 MHz crystal Week 1 - Introduction (Rev 2) 34

ENTC-489 Embedded Real Time Software Development Changing the Clock Registers: RSS RSS2 Week 1 - Introduction (Rev 2) 35

ENTC-489 Embedded Real Time Software Development Changing the Clock #include “inc/hw_types.h” – HWREG(), HWREGH(), HWREGB(), HWREGBITW(), HWREGBITH(), HWREGBITB() Using TivaWare – #include “driverlib/sysctl.h” – SysCtlClockSet(); Week 1 - Introduction (Rev 2) 36

ENTC-489 Embedded Real Time Software Development Timing on the TM4C123G In this class we DO NOT USE TIMING LOOPS (except when adjusting the system clock, making timing loops the only reasonable method of introducing a delay) ARM Devices provide a special periodic timer, SYSTICK specifically to provide a regular timer tick. – Point interrupt vector to FAULT_SYSTICK (this can be done in the *_startup_css.c file) – Set the number of clock ticks between interrupts in the NVIC_ST_RELOAD register – Enable the interrupts – Enable the systick device – Using TivaWare SysTickIntRegister(); /* optional */ SysTickPeriodSet(); IntMasterEnable(); SysTickIntEnable(); SysTickEnable(); – DANGER, WILL ROBINSON!!! use IntMasterDisable() instead of ROM_IntDisable(FAULT_SYSTICK) to disable interrupts while manipulating variables altered by your SYSTICK interrupt function. The later has the side effect of reloading the SYSTICK counter with the initial value. Week 1 - Introduction (Rev 2) 37

ENTC-489 Embedded Real Time Software Development GPIO Pins on the TM4C123G Steps to use a GPIO – Enable the clock to the GPIO port module (RCGC2) – Set the pad type (GPIO_O_DR2R, GPIO_O_DR4R, GIPO_O_DR8R, GPIO_O_SLR, GPIO_O_ODR, GPIO_O_PUR, GPIO_O_PDR, GPIO_O_DEN, GPIO_O_DIR, GPIO_O_AFSEL) Using TivaWare – SysCtlPeripheralEnable(); – GPIOPinTypeGPIOOutput(); GPIOPinTypeGPIOInput(); Week 1 - Introduction (Rev 2) 38

ENTC-489 Embedded Real Time Software Development Homework Start with BlankProject (No Operating System) from txwilley.com/entc-489-ERTSD Create a program that will – Blink the RGB LED in Blue (no red or green light) – Blink must be at 1Hz, that is 1 time per second the LED must turn on and off – Use a 50% duty cycle – Processor must run at 50MHz or faster – The functionality test for your grade will be Compiling on instructor’s workstation Running on instructor’s reference platform Required Techniques – Must use a timer interrupt to achieve time delays (no timing loops) Week 1 - Introduction (Rev 2) 39

ENTC-489 Embedded Real Time Software Development Closed Book Quiz Next Week Real-Time Software and Kernel Vocabulary Coding Standards Compliance Task State Diagram Superloop/Superloop with Interrupt/Kernel comparison Week 1 - Introduction (Rev 2) 40