Introduction to Embedded Systems. Software Update Problem



Similar documents
Decomposition into Parts. Software Engineering, Lecture 4. Data and Function Cohesion. Allocation of Functions and Data. Component Interfaces

Chapter 3 Operating-System Structures

Lecture 25 Symbian OS

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

Chapter 3: Operating-System Structures. System Components Operating System Services System Calls System Programs System Structure Virtual Machines

Patterns in Software Engineering

CS 3530 Operating Systems. L02 OS Intro Part 1 Dr. Ken Hoganson

Keil C51 Cross Compiler

Introduction. What is an Operating System?

Example of Standard API

Chapter 2 System Structures

Chapter 11 I/O Management and Disk Scheduling

CHAPTER 1: OPERATING SYSTEM FUNDAMENTALS

Operating Systems 4 th Class

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

Chapter 3: Operating-System Structures. Common System Components

Using the TASKING Software Platform for AURIX

General Introduction

An Implementation Of Multiprocessor Linux

Chapter 1. Introduction to ios Development. Objectives: Touch on the history of ios and the devices that support this operating system.

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Chapter 6, The Operating System Machine Level

New Methodologies in Smart Card Security Design. Y.GRESSUS Methodology and Secure ASIC development manager, Bull CP8

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

find model parameters, to validate models, and to develop inputs for models. c 1994 Raj Jain 7.1

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER

Multicore Programming with LabVIEW Technical Resource Guide

In: Proceedings of RECPAD th Portuguese Conference on Pattern Recognition June 27th- 28th, 2002 Aveiro, Portugal

How To Port A Program To Dynamic C (C) (C-Based) (Program) (For A Non Portable Program) (Un Portable) (Permanent) (Non Portable) C-Based (Programs) (Powerpoint)

Embedded Software development Process and Tools: Lesson-4 Linking and Locating Software

Building Applications Using Micro Focus COBOL

Embedded System Design. Disclaimer

Operating System Structures

ESE566 REPORT3. Design Methodologies for Core-based System-on-Chip HUA TANG OVIDIU CARNU

Good FORTRAN Programs

Cloud Computing. Up until now

Chapter 11: Integrationand System Testing

System Software Integration: An Expansive View. Overview

Types Of Operating Systems

GPU Tools Sandra Wienke

The structured application of advanced logging techniques for SystemVerilog testbench debug and analysis. By Bindesh Patel and Amanda Hsiao.

How do Users and Processes interact with the Operating System? Services for Processes. OS Structure with Services. Services for the OS Itself

How To Write A Windows Operating System (Windows) (For Linux) (Windows 2) (Programming) (Operating System) (Permanent) (Powerbook) (Unix) (Amd64) (Win2) (X

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

Memory Allocation. Static Allocation. Dynamic Allocation. Memory Management. Dynamic Allocation. Dynamic Storage Allocation

Operating System Organization. Purpose of an OS

Embedded Software development Process and Tools:

A3 Computer Architecture

language 1 (source) compiler language 2 (target) Figure 1: Compiling a program

etpu Host Interface by:

Software Module Test for an Electronic Steering Lock

PART IV Performance oriented design, Performance testing, Performance tuning & Performance solutions. Outline. Performance oriented design

Real Time Programming: Concepts

Tools Page 1 of 13 ON PROGRAM TRANSLATION. A priori, we have two translation mechanisms available:

System Structures. Services Interface Structure

Axiomatic design of software systems

2) Write in detail the issues in the design of code generator.

Designing a Home Alarm using the UML. And implementing it using C++ and VxWorks

KURA M2M/IoT Gateway. reducing the distance between embedded and enterprise technologies. Tiziano Modotti, October 28 th, 2014

Operating System Overview. Otto J. Anshus

Freescale Semiconductor, I

Chapter 11 I/O Management and Disk Scheduling

Multi-core Curriculum Development at Georgia Tech: Experience and Future Steps

Network Virtualization: Delivering on the Promises of SDN. Bruce Davie, Principal Engineer

Exception and Interrupt Handling in ARM

CSC 2405: Computer Systems II

CS3600 SYSTEMS AND NETWORKS

High Performance or Cycle Accuracy?

Practice #3: Receive, Process and Transmit

EMC Publishing. Ontario Curriculum Computer and Information Science Grade 11

SYSTEM ecos Embedded Configurable Operating System

Red Hat Linux Internals

Compute Cluster Server Lab 3: Debugging the parallel MPI programs in Microsoft Visual Studio 2005

Technical Properties. Mobile Operating Systems. Overview Concepts of Mobile. Functions Processes. Lecture 11. Memory Management.

OS/Run'me and Execu'on Time Produc'vity

CIS570 Modern Programming Language Implementation. Office hours: TDB 605 Levine

ECU State Manager Module Development and Design for Automotive Platform Software Based on AUTOSAR 4.0

Systems Software. Introduction to Information System Components. Chapter 1 Part 2 of 4 CA M S Mehta, FCA

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C

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

How to design and implement firmware for embedded systems

Software Quality Factors OOA, OOD, and OOP Object-oriented techniques enhance key external and internal software quality factors, e.g., 1. External (v

Weighted Total Mark. Weighted Exam Mark

Why study Operating Systems? CS 372. Why study. Why study. Introduction to Operating Systems

SKP16C62P Tutorial 1 Software Development Process using HEW. Renesas Technology America Inc.

OS Concepts and structure

Objectives. Chapter 2: Operating-System Structures. Operating System Services (Cont.) Operating System Services. Operating System Services (Cont.

theguard! ApplicationManager System Windows Data Collector

Changing the embedded development model with Microsoft.NET Micro Framework

SecureDoc Disk Encryption Cryptographic Engine

x86 ISA Modifications to support Virtual Machines

SECURE IMPLEMENTATIONS OF CONTENT PROTECTION (DRM) SCHEMES ON CONSUMER ELECTRONIC DEVICES

50 Computer Science MI-SG-FLD050-02

Instruction Set Design

picojava TM : A Hardware Implementation of the Java Virtual Machine

SAN Conceptual and Design Basics

Effective Java Programming. efficient software development

Have both hardware and software. Want to hide the details from the programmer (user).

Transcription:

Introduction to Embedded Systems CS/ECE 6780/5780 Al Davis logistics minor Today s topics: more software development issues 1 CS 5780 Software Update Problem Lab machines work let us know if they don t Personal machines have update issues Torrey & William have been trying to find a fix» so far the solution has been elusive Labs next lab will be assembly oriented hopefully posted by tomorrow 2 CS 5780 Page 1

Modular SW Development Modular programming breaks SW into distinct and independent modules provides:» functional abstraction to support reuse» complexity abstraction divide and conquer approach» portability 3 CS 5780 Global Variables Global information shared by more than one module use them to pass data between main() and interrupts data is permanent and not deallocated Can use absolute addressing to access globals I/O ports and registers are considered global values it would be silly to view them as locally scoped 4 CS 5780 Page 2

Local Variables Temporary information used by only one module typically allocated, used, and deallocated» hence information is not permanent Stored on stack or registers dynamic allocation/release allows memory reuse limited scope provides data protection since interrupt saves registers and uses it s own stack» code may still be re-entrant code is relocatable number of local variables» only limited by stack size 5 CS 5780 Two Local 16-bit Variables: Take 1 *X sum and *X+2 n (stack grows down) n and sum are now X relative offsets 6 CS 5780 Page 3

Take 1 continued 7 CS 5780 Two Local 16-bit Variables: Take 2 6812 allows negative offset addressing X now points inside the stack frame leas: load effective address SP 8 CS 5780 Page 4

Take 2 continued deallocation phase now 1 instruction shorter than in Take 1 9 CS 5780 Take 2 Execution 10 CS 5780 Page 5

Take 2 Execution SP decrements by 2 11 CS 5780 Take 2 Execution 12 CS 5780 Page 6

Take 2 Execution sum n 13 CS 5780 Take 2 Execution 14 CS 5780 Page 7

Take 2 Execution 15 CS 5780 Take 2 Execution 16 CS 5780 Page 8

Take 2 Execution 17 CS 5780 Take 2 Execution 18 CS 5780 Page 9

Take 2 Execution 19 CS 5780 Take 2 Execution 20 CS 5780 Page 10

Take 2 Execution 21 CS 5780 End of loop 22 CS 5780 Page 11

Put Sum in D register 23 CS 5780 Restore Stack Pointer & Dellocate 24 CS 5780 Page 12

Restore X Register & Voila done 25 CS 5780 Returning Multiple Parameters: Registers 26 CS 5780 Page 13

Returning Multiple Values: stack 27 CS 5780 More Issues All assembly exit points must balance the stack» call and return sequences are mirrored Performing unnecessary I/O in a subroutine limits reuse I/O devices must be considered global restrict the number of modules that access them Information hiding expose only the necessary information at the interfaces» promotes understanding and reduces conceptual complexity» e.g. hide inner workings of the black box from the user 28 CS 5780 Page 14

Module Decomposition Coupling influence a module s behavior has on another module Task decomposition goals make the SW organization easier to understand increase the number of modules» this may increase code footprint and/or increase run time due to extra subroutine linkages» but start properly and then optimize if you have to» minimize coupling as much as possible Develop, connect and test modules in a hierarchy top-down write no software until every detail is specified bottom-up one brick at a time Initial design is best done top-down Implementation is best done bottom-up namely you have something to test 29 CS 5780 Layered Software Systems Note SW continually changes as better HW or algorithms become available Layered SW facilitates these changes top layer is the main program lowest layer is the HW abstraction layer» modules that access the I/O HW Hierarchy should be strict each layer can only call lower layers» ideal is to only call the next lower layer gate or API» defines the interface at the next lower layer if this happens» each layer can be replaced without affecting other layers» possible downside: code bloat optimize last policy is a good one easier to optimize correctly based on measurements of working code 30 CS 5780 Page 15

Layered Parallel Port Example 31 CS 5780 Layered SW Rules Modules may make calls to modules in the same layer Modules may call lower layer only using gate Module has no access to any function or variable in another layer except via gate Modules can t call upper layers Ideal yet optional module calls only next layer down all I/O access is at the lowest layer user interface is at the highest level 32 CS 5780 Page 16

Device Driver Concepts Purpose SW interface to physical I/O devices» interface API for upper layers» low-level routines to configure and perform actual I/O Separation of policy and mechanism is important e.g. interface may include routines to open, read, and write files» but it shouldn t care about what device the files reside on HAL provide a good hardware abstraction layer 33 CS 5780 Low-Level Device Drivers Normally found in BIOS ROM basic I/O system Good low-level drivers allow: new hardware to be installed new algorithms to be implemented» synchronization w/ completion flags/interrupts» error detection and recovery methods higher-level features built on top of low-level» OS features like blocking semaphores» driver features like automatic compression/decompression 34 CS 5780 Page 17

Encapsulated Objects in ANSI C Choose names to reflect the module in which they are defined Example 35 CS 5780 Reentrancy Reentrant if it can be conurrently executed by 2 or more threads or by main and one or more interrupts Rules for reentrant functions must not call a non-reentrant function must not touch global variables w/o proper locking 36 CS 5780 Page 18

Coding Guidelines Guidelines that cannot be checked by a smart compiler are less effective Too many guidelines are worthless too hard to remember or enforce Following is a 10 rule list by Gerard Holzman» leads NASA/JPL s Lab for Reliable Software needless to say it s hard to debug things in outer space note» these are good things to know» even though some of the implied tools aren t available to you at the moment 37 CS 5780 Rule 1 38 CS 5780 Page 19

Rule 2 39 CS 5780 Rule 3 40 CS 5780 Page 20

Rule 4 41 CS 5780 Rule 5 42 CS 5780 Page 21

Rule 6 43 CS 5780 Rule 7 44 CS 5780 Page 22

Rule 8 45 CS 5780 Rule 9 46 CS 5780 Page 23

Rule 10 47 CS 5780 Debugging Theory Process of testing, stabilizing, localizing, and correcting errors Research in program monitoring & debugging has not kept up gdb has been around for 30+ years so has printf alas the Symbolics 3600 system has been left behind» it shouldn t have ES debugging is even more complicated by concurrency and real-time requirements printf is a problem because they are slow 48 CS 5780 Page 24

HW Debugging 49 CS 5780 Debugging w/ SW Debugging instrument» code added to a program to improve visibility of internals» extra visibility aids debugging» printf is the common example Printf instrument policy (use one or more) place printf statements in a unique column define instruments with a specific naming pattern define all instruments to test a run-time global flag use conditional compilation (assembly) to turn on/off 50 CS 5780 Page 25

Functional/Static Debugging Functional check that the right computation is done Inputs supplied run system check outputs Several methods single step tracing breakpoints w/o filtering conditional breakpoints instrumentation: printf s to a trace file» with or without filtering you only want values within a specific range monitor with a fast display 51 CS 5780 Performance Debugging Verification of timing behavior run system and check dynamic I/O behavior» count bus cycles using the assembly listing» instrumentation measure with a counter 52 CS 5780 Page 26

Instrumentation via Output Port How would you improve on this? 53 CS 5780 Concluding Remarks As Arlo says you can t always do what you re supposed to do But keeping these coding tips in mind will make you a better programmer and reduce hair pulling panic attacks in later professional life» these types of things will be mandated by your company albeit in a slightly different form So might as well develop good habits early» some of you already have 54 CS 5780 Page 27