Evolution of Microcontroller Firmware Development David Benjamin.

Slides:



Advertisements
Similar presentations
Interrupts Chapter 8 – pp Chapter 10 – pp Appendix A – pp 537 &
Advertisements

Computer System Overview
CSCI 4717/5717 Computer Architecture
Sensor Network Platforms and Tools
Chapter 13 Embedded Systems
Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
ECE 526 – Network Processing Systems Design Software-based Protocol Processing Chapter 7: D. E. Comer.
Interrupts What is an interrupt? What does an interrupt do to the “flow of control” Interrupts used to overlap computation & I/O – Examples would be console.
COMP3221: Microprocessors and Embedded Systems Lecture 15: Interrupts I Lecturer: Hui Wu Session 1, 2005.
OS2-1 Chapter 2 Computer System Structures. OS2-2 Outlines Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
Architectural Support for Operating Systems. Announcements Most office hours are finalized Assignments up every Wednesday, due next week CS 415 section.
Generic Sensor Platform for Networked Sensors Haywood Ho.
Chapter 13 Embedded Systems
Midterm Tuesday October 23 Covers Chapters 3 through 6 - Buses, Clocks, Timing, Edge Triggering, Level Triggering - Cache Memory Systems - Internal Memory.
Figure 1.1 Interaction between applications and the operating system.
1 Interrupts INPUT/OUTPUT ORGANIZATION: Interrupts CS 147 JOKO SUTOMO.
CHAPTER 9: Input / Output
MicroC/OS-II Embedded Systems Design and Implementation.
INTERRUPTS PROGRAMMING
Performance Evaluation of Real-Time Operating Systems
0 Deterministic Replay for Real- time Software Systems Alice Lee Safety, Reliability & Quality Assurance Office JSC, NASA Yann-Hang.
Introduction to Embedded Systems
Interrupts Signal that causes the CPU to alter its normal flow on instruction execution ◦ frees CPU from waiting for events ◦ provides control for external.
CORTEX-M0 Structure Discussion 2 – Core Peripherals
Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.
CHAPTER 9: Input / Output
MICROPROCESSOR INPUT/OUTPUT
Typical Microcontroller Purposes
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
Microcontroller based system design Asst. Prof. Dr. Alper ŞİŞMAN.
Chapter 8 I/O. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 8-2 I/O: Connecting to Outside World So far,
Chapter 2: Computer-System Structures 2.1 Computer System Operation 2.5 Hardware Protection 2.6 Network Structure.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Interrupt.
Microprocessors 1 MCS-51 Interrupts.
Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection Network Structure.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose  This training course provides an overview of the CPU architecture.
COMPUTER ORGANIZATIONS CSNB123. COMPUTER ORGANIZATIONS CSNB123 Expected Course Outcome #Course OutcomeCoverage 1Explain the concepts that underlie modern.
13-Nov-15 (1) CSC Computer Organization Lecture 7: Input/Output Organization.
ECNG3006 MICROPROCESSOR APPLICATIONS Course Instructor: Mr. Kevon Andrews Office: Rm. 239 Phone: ext address:
WISP.
1 © Unitec New Zealand Interrupt Lecture 6 Date: - 20 Sept, 2011 Embedded Hardware ETEC 6416.
AT91 Interrupt Handling. 2 Stops the execution of main software Redirects the program flow, based on an event, to execute a different software subroutine.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
Embedded Systems Design 1 Lecture Set 8 MCS-51 Interrupts.
SensorWare: Distributed Services for Sensor Networks Rockwell Science Center and UCLA.
MICRO-CONTROLLER MOTOROLA HCS12 Interrupts Mechatronics Department Faculty of Engineering Ain Shams University.
Embedded Computer - Definition When a microcomputer is part of a larger product, it is said to be an embedded computer. The embedded computer retrieves.
Slides created by: Professor Ian G. Harris Operating Systems  Allow the processor to perform several tasks at virtually the same time Ex. Web Controlled.
Interrupts ELEC 330 Digital Systems Engineering Dr. Ron Hayne
Interrupts ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
The 8051 Microcontroller Chapter 6 INTERRUPTS. 2/29 Interrupt is the occurrence of a condition an event that causes a temporary suspension of a program.
Introduction to Exceptions 1 Introduction to Exceptions ARM Advanced RISC Machines.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
INSTITUTE: INSTITUTE:PARUL INSTITUTE OF TECHNOLOGY BRANCH : BRANCH :B.E. E.C.5 TH SEM. SUBJECT:MICROCONTROLLER & INTERFACING TOPIC:AVR INTTRUPT TOPIC:AVR.
Software Architecture of Sensors. Hardware - Sensor Nodes Sensing: sensor --a transducer that converts a physical, chemical, or biological parameter into.
Computer System Structures Interrupts
Chapter 2: Computer-System Structures
Operating Systems CMPSC 473
Microprocessor Systems Design I
Interrupts In 8085 and 8086.
Interrupt.
Interrupts, Tasks and Timers
Chapter 8 I/O.
COMPUTER PERIPHERALS AND INTERFACES
Computer System Overview
COMP3221: Microprocessors and Embedded Systems
Presentation transcript:

Evolution of Microcontroller Firmware Development David Benjamin

Overview  Traditional microcontroller firmware Polling Interrupts  Real-time Operating Systems  Demonstration

Polling  Polling is when a process continually evaluates the status of a register in an effort to synchronize program execution.  Polling is not widely used because it is an inefficient use of microcontroller resources.

Polling Example void main ( void ) { while(1) { while (!button1_pressed); turn_on_led; while (!button1_pressed); turn_off_led; }

Interrupts  Interrupt as defined by Merriam Webster to break in upon an action  Interrupt An event that causes the Program Counter (PC) to change. These events can be internal or external.  Interrupt Service Routine (ISR) Set of instructions that is executed when an interrupt occurs  Interrupt Vector Memory address of the first instruction in the ISR.

Interrupts  Why should one use interrupts? Provides more efficient use of microcontroller resources. Provides a means to create firmware that can “multi-task”.

Interrupts  Interrupts are often prioritized within the system and are associated with a variety of on-chip and off-chip peripherals Timers, A/D D/A converters, UART, GP I/O  A majority of the  C interrupts can be enabled or disabled. Globally Individually Those interrupts that cannot be disabled are called Non- Maskable Interrupts (NMI).  Interrupts can be nested.  Interrupts can occur at anyplace, at anytime. ISRs should be kept short and fast.

What happens when an interrupt occurs?

Interrupts  The current program instruction completes execution. Main() { … some code turn_on_led1;0x08A2 turn_off_led1;0x08A3 … } __interrupt void port1_ISR(void) { disable_interrupts0x0FE0... reti }  The PC and status register values are placed on the stack.  The interrupt vector is loaded into the PC and SR is updated.  Program execution resumes with the first step of the ISR.  When the ISR has completed execution, the values of the PC and status registers are restored.  Program execution resumes with next instruction that would have occurred had the interrupt not taken place. PC = 0x08A2 SR = 0xFE PC = 0x0FE0 SR = 0x7E PC = 0x8A3 SR = 0xFE XXX 0x08A3 0xFE STACK

Interrupts vs. Polling  Allowed for more efficient use of the microcontroller. Faster program execution Multi-tasking  Facilitated the development of complex firmware. Supports a modular approach to firmware design.

Real-time Operating Systems

Real-time Operating System  A real-time operating system (RTOS) is a multi-tasking operating system intended for real-time applications. Mainly used in embedded applications. Facilitates the creation of a real-time system. Tool for the real-time software developer. Provides a layer abstraction between the hardware and software.

Real-time Operating System  State A unique operating condition of the system.  Task A single thread of execution through a group of related states.  Task Manager Responsible for maintaining the current state of each task. Responsible for providing each task with execution time.

Real-time Operating System Collection of Tasks… Single Task

Real-time Operating System  A more detailed explanation state A function void idleState ( void ); Should be kept short and fast Should represent a logical step in the task  i.e. Evaluating different parts of an incoming message.

Real-time Operating System void idleState( void ) { if (rx_buffer_full) { read_rxBuffer; if (syncByte_received) { transition_to_workState1; } else { stay_in_idleState; } else { stay_in_idleState; }

Real-time Operating System  Event-driven Tasks are granted execution time, based on an event (interrupt). Tasks of higher priority are executed first (interrupt priorities).  Time sharing Each task is granted a given amount of time to execute. Tasks may also be granted execution time based on events. “Round-robin” approach Creates a more deterministic multi-tasking system.

Real-time Operating Systems void main ( void ) { initSystem(); while (1) { work(); sleep(); } void work (void) { doTask(RecieveMsg); doTask(Process); doTask(TransmittResponse); } __interrupt void Timer_A (void) { wakeUp(); }

Real-time Operating System  Available commercially TinyOS -an open source component-based operating system and platform targeting wireless sensor networks (WSNs). Salvo - an RTOS developed by Pumpkin Inc. FreeRTOS - free RTOS that runs on several architectures. DrRTOS - works with ARM 7  Implement a custom RTOS Can be highly optimized to suit your application

Real-time Operating Systems  A tool for real-time software developers.  Allows increasingly complex systems to be developed in less time.  Provides a level abstraction between software and hardware.  Continues the evolution microcontroller system design.

Application Example Implementation  Example of RTOS application that requires wireless communication. CC1100 HAL Radio Operation Layer Protocol Application  Hardware abstraction layer for the radio. Performs low-level interaction between  C and radio.  Groups low-level interactions from the HAL into higher-level functions. Sending a packet  Middle-ware that provides a gateway between the application and RTOS.  Application

Demonstration

Questions?