Presentation is loading. Please wait.

Presentation is loading. Please wait.

Course Syllabus (1) Course Goals: Pre-requisites:

Similar presentations


Presentation on theme: "Course Syllabus (1) Course Goals: Pre-requisites:"— Presentation transcript:

0 CSE 438/598 Embedded Systems Programming – Fall 2014
Computer Science & Engineering Department Arizona State University Tempe, AZ 85287 Dr. Yann-Hang Lee (480)

1 Course Syllabus (1) Course Goals: Pre-requisites:
Understand the design issues of embedded software and gain an in-depth knowledge of development and execution environment. Understand the functions and the internal structure of device interfaces, drivers, and real-time operating systems. Acquire the skill to develop multi-threaded embedded software in target environment, including good quality and coding style for embedded programming, and testing and debugging approaches. Develop feasible task scheduling and carry out system performance and task schedulability analyses. Pre-requisites: Assembly language and computer organization (CSE230), microprocessor interfaces (CSE 325), and experience of C programming language Knowledge of operating systems and computer architecture

2 Course Syllabus (2) Introduction: characteristics of embedded applications (2 lecture) Embedded processor architecture: processor architecture, exceptions and interrupts, and system memory map. (4 lectures) Device interface and programming approaches: interconnection architecture, serial buses, and device controllers (3 lectures) Device driver: software structure of device driver, Linux loadable kernel module, blocking and non-blocking IO, top-half and bottom-half ISR. (6 lectures) Embedded software and thread programming: task model and specification, periodic and aperiodic tasks, imprecise computation, overrun management, signaling, setjmp and longjmp. (5 lectures) Basic RTOS and services for multiple threads or tasks, mutexes, semaphores and software timers. (4 lectures) Scheduling algorithms and analysis: cyclic, rate-monotonic, and EDF,scheduling,, priority inheritance, and analysis. (4 lectures)

3 Course Syllabus (3) Office hours –2:30pm-4:00pm, Tuesday and Thursday
Evaluation 1st midterm exam* (20%) (in class, 75 minutes, Tuesday, Oct. 21) 2nd midterm exam* (30%) (12:10pm-2:00pm, Thursday, Dec. 11) 5 Lab assignments (40%) Class attendance and participation, discussion board participation, and video sharing (10%) All exams are closed book and closed notes. The lab assignments must be done individually. There will be a 20% deduction per day for late submission. Request a regrade of exam or assignments within a week from the date that the grade is returned. Plagiarism and other anti-intellectual behavior will be dealt with severely.

4 Lab Setup Intel Galileo board and additional periperals
Prepare your own micro SD card (and adapter) for booting Preferred development software Linux, Eclipse, command lines, GUN tools

5 Real-time Embedded Systems
the software and hardware component that is an essential part of another system Real-time system provide well-timed computation deadlines, jitters, periodicity temporal dependency Plant sensor actuator Control-raw computation A/D D/A Reference input Controller

6 Embedded Systems -- Examples

7 Emerging Embedded Systems

8 Hardware (chips) + Software (programs) for specific applications
Embedded Systems They are everywhere What are they? Hardware (chips) + Software (programs) for specific applications CPU (micro- processor) I/O Timer memory

9 SW Development for RT ES
To write the control software for a smart washer initialize read keypad or control knob read sensors take an action System current state state transition diagram external triggers via polling or ISR If there are multiple triggers and external conditions – single or multiple control loops initialization external trigger? ISR: to set/clear events Take actions Change system state

10 SW Development for RT ES
In the example of smart washer Never-ending in a single control loop Single execution threat and one address space Event triggering and state transitions Small memory footprint What are missing: no concurrency (real-world events occur in parallel) no explicit timing control (let’s add a timer) difficult to develop and maintain large embedded systems – verifiable, reusable, and maintainable

11 RT ES vs. General Software
Multi-tasking for concurrent events Machine dependence and portability Software abstraction, modular design information hiding, OO, separate compilation, reusable a sorting procedure -- function, input, output specification Control timing predictable actions in response to external stimuli deadline (absolute or relative), and jitter Resource constraints and sharing CPU time, stack, memory, and bandwidth Scheduling

12 Embedded System Development
Need a real-time (embedded) operating system (RTOS) or run on bare metal ? Need a development and test environment ? Use the host to edit, compile, and build application programs At the target, use tools to load, execute, debug, and monitor (performance and timing) Development Host (gnu tool chain + Eclipse) Target Peripherals + Plant Model

13 Development Environment of Linux
Host PC workstation gcc cross-compiler Linux Eclipse IDE GDB Server Target board Board support package Applications Linux or Windows GDB debugger Command line or IDE (Eclipse, Kdevelop) Linux and GNU tools

14 HelloWorld Example /* Hello World program */ #include <stdio.h> #include <time.h> int main(void) { int i; time_t curTime; for (i=0; i<10; i++) { curTime = time(NULL); printf("Hello, world. The current time is: %s", ctime (&curTime)); sleep(i); } CC = i586-poky-linux-gcc all: HelloWorld.c $(CC) -o HelloWorld.o HelloWorld.c scp HelloWorld.o

15 From Source to Executable
Compiler, linker, and loader In ELF: executable, relocatable, shared library, and core information for relocation, symbol, debugging linker resolves symbol reference Link script or link command file assigns absolute memory addresses (program area, static data, bss, stack, vector table, etc.) Startup code to disable interrupts, initialize stack, data, zero uninitialized data area, and call main(). cc asm ld linker loader debugger linker script executable

16 Debugger Observability, real-time analysis, and run control
At host: GUI, source code, symbol table, type information, line number Communication to the target serial port, Ethernet, USB, etc. read/write memory and registers control processor execution (single step, breakpoint, watchpoint, etc.) At target: debugging stub (software): at breakpoint, replace the instruction with breakpoint inst. or invalid instruction to trigger exception BDM (JTAG interface): hardware breakpoint, trace buffer, flash programming

17 Trends of RT Embedded Systems Applications
Wide-spreading, distributed, connected, and heterogeneous Mission and safety critical High-end consumer products cell phone, HDTV, home network, PDA, GPS, appliances Quality of the products portable/reusable, reliable/dependable, interoperable, predictable (schedulable), and secured Software extensive A new S-class Mercedes-Benz over 20 million lines of code nearly as many ECUs as the new Airbus A380 (excluding the plane's in-flight entertainment system).

18 (Analyses from http://www.ohloh.net/)
Software Complexity Software in Smartphones = apps + android + Linux Linux kernel: Android: Language Code Comment Blank Percentage C 15,213,100 3,277,849 2,919,083 94.5% Assembly 474,013 99,107 77,428 2.9% C++ 238,689 107,606 49,138 1.7% XML 85,470 520 7,079 0.4% Make 39,575 11,901 10,859 0.3% Totals 16,086,836 3,504,100 3,070,580 Language Code Comment Blank Percentage C 4,790,691 1,541,950 1,021,643 42.5% C++ 2,922,477 896,141 624,506 25.7% Java 1,530,288 770,935 321,929 15.2% HTML 955,041 51,284 220,949 7.1% XML 524,855 75,396 34,453 3.7% Totals 11,431,145 3,546,030 2,333,226 (Analyses from

19 Reliable Embedded Software
Bill Gate: in FOCUS, 1995, “There are no significant bugs in our released software that any significant number of users want fixed.” Numerous recalls for software bugs have occurred in automobiles Smart cars: transition from mechanical to electronic control Toyota Prius: a software problem that caused the gas engines to stall at highway speeds Volvo’s recall of S60 sedans due to software problems with the fuel pumps. Jaguar: a software bug prevented cruise control from being turned off

20 Toyota’s ETCS-i and Unintended Acceleration
Electronic Throttle Control System, Intelligent (ETCS-i) a closed loop throttle control function. learning algorithms to recalibrate sensor inputs. NASA “found no electronic flaws .. to create UA incidents” But, in Appendix A compiler warnings extensive use of global variables, indirection, name overloading, and code duplication dead code, warnings from static analyzer violations of coding standards (NASA Engi. and Safety Center Technical Assessment Report)

21 Building Embedded Systems
Advances in general-purpose computers PCs are powerful, cheap, and versatile Information processing is ubiquitous Thanks for the growth in productivity The design gaps Process technology Hardware design Software design 2x/18 months HW gap SW gap 1.6x/18 months 2x/5 years (International Technology Roadmap for Semiconductors, 2011)

22 Embedded Software Characteristics Embedded software development
Concurrent, time dependent, and device/environment dependent Embedded software development 80% programs in embedded system is with C/C++ and 15% in assembly the same thing that has been done more than 30 years (Ada?) Software complexities inherent and cannot be eliminated, i.e. algorithm, concurrency, etc. accidental (due to technology or methods used), i.e. memory leaks What can we do? abstraction (e.g. high-level languages, modeling) automation (e.g. compiler)

23 Design for Performance and Predictability
A system vs. a piece of code Computer science is about abstraction, but resource is needed to run any piece of code a switch statement  a branch table if (unlikely(!timer)) return -EINVAL; Benchmarking and profiling data measurement and interpretation resource usage and hot spots A good understanding on what hardware and software are doing space and time tradeoff compiler optimization time and resource requirement model data structure algorithm O(n), O(n2)… object operating system compiler library CPU memory instruction set IO & Bus time/cycle signal abstract physical

24 Embedded Coding Practices
Informal rules to improve the quality of software applications simplify their maintenance MISRA-C:2012  143 rules checkable using static code analysis makes development as predictable as possible, across projects or pieces of code, without errors of interpretation Holzmann’s “Power of Ten” and JPL coding standard Examples: check return value of non-void functions name convention – dump_data_to_file() no compilation warnings no errors or warnings resulting from static code analyzers (Image credit: Wikidave)

25 Embedded Software Analysis Tools (1)
Static and dynamic tools to show the correctness and performance of software systems VDC Research ( ). "Automated Defect Prevention for Embedded Software Quality"

26 Embedded Software Analysis Tools (2)
in single core in dual core vs. A simple example: Static analysis tools Lint, PolySpace, CODAN of Eclipse null pointer de-reference, use after free, array indexing errors, stack and heap overrun, etc. IDE, debug and trace tools Performance and profiling tools: gprof, perf, Valgrind profiler, Intel Amplifier Memory and thread tools: Valgrinde memcheck and DRD, Intel Inspector (Wind River Workbench’s System Viewer)


Download ppt "Course Syllabus (1) Course Goals: Pre-requisites:"

Similar presentations


Ads by Google