Embedded Linux Day 2. Stuffs HW1 posted today – Shooting for 1-2 hours. – Review scheduling stuff & licensing. HW0 in lab Sign up for group meetings for.

Slides:



Advertisements
Similar presentations
Lecture 13 Page 1 CS 111 Online File Systems: Introduction CS 111 On-Line MS Program Operating Systems Peter Reiher.
Advertisements

Chapter 6 Limited Direct Execution
04/14/2008CSCI 315 Operating Systems Design1 I/O Systems Notice: The slides for this lecture have been largely based on those accompanying the textbook.
Wednesday, June 07, 2006 “Unix is user friendly … it’s just picky about it’s friends”. - Anonymous.
W4118 Operating Systems OS Overview Junfeng Yang.
Operating Systems. What is an Operating System? A layer of software between users/applications and the hardware. The first program loaded onto a computer.
Operating System Structure. Announcements Make sure you are registered for CS 415 First CS 415 project is up –Initial design documents due next Friday,
Porting Plan 9 to the PowerPC Architecture Ian Friedman Ajay Surie Adam Wolbach.
CS 300 – Lecture 20 Intro to Computer Architecture / Assembly Language Caches.
CS 300 – Lecture 23 Intro to Computer Architecture / Assembly Language Virtual Memory Pipelining.
1 Chapter 13 Embedded Systems Embedded Systems Characteristics of Embedded Operating Systems.
EECS 498 Advanced Embedded Systems Lecture 6: Rhyme, Reason & Review; Topic group formation.
Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access memory.
Basic Unix Dr Tim Cutts Team Leader Systems Support Group Infrastructure Management Team.
EECS 498 Advanced Embedded Systems Lecture 4: Linux device drivers and loadable kernel modules.
I/O Tanenbaum, ch. 5 p. 329 – 427 Silberschatz, ch. 13 p
Stack Management Each process/thread has two stacks  Kernel stack  User stack Stack pointer changes when exiting/entering the kernel Q: Why is this necessary?
Chapter 3.1:Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access.
GCSE ICT User Interfaces. Learning Intentions: To understand the concept of a Windows operating system and have a basic understanding of GUI. Success.
Write today’s date and title in the front of your book. Underline it.
Host and Application Security Lesson 4: The Win32 Boot Process.
Systems Software & Operating systems
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.
Architecture Support for OS CSCI 444/544 Operating Systems Fall 2008.
OSE 2011– processes & address spaces (lec2) 1 Operating Systems Engineering Processes & Address Spaces By Dan Tsafrir.
CS 390 Unix Programming Summer Unix Programming - CS 3902 Course Details Online Information Please check.
IT253: Computer Organization
CE Operating Systems Lecture 3 Overview of OS functions and structure.
Operating Systems. Overview What is an Operating System (OS) What is an Operating System (OS) What Operating Systems do. What Operating Systems do. Operating.
2003 Dominic Swayne1 Microsoft Disk Operating System and PC DOS CS-550-1: Operating Systems Fall 2003 Dominic Swayne.
Moving Arrays -- 1 Completion of ideas needed for a general and complete program Final concepts needed for Final Review for Final – Loop efficiency.
CS 346 – Chapter 2 OS services –OS user interface –System calls –System programs How to make an OS –Implementation –Structure –Virtual machines Commitment.
CSE 451: Operating Systems Winter 2015 Module 5 1 / 2 User-Level Threads & Scheduler Activations Mark Zbikowski 476 Allen Center.
System Components ● There are three main protected modules of the System  The Hardware Abstraction Layer ● A virtual machine to configure all devices.
EECS 473 Advanced Embedded Systems Misc. things Midterm Review.
Lecture 4 Page 1 CS 111 Online Modularity and Virtualization CS 111 On-Line MS Program Operating Systems Peter Reiher.
Chapter 1 Basic Concepts of Operating Systems Introduction Software A program is a sequence of instructions that enables the computer to carry.
CENG334 Introduction to Operating Systems 1 Erol Sahin Dept of Computer Eng. Middle East Technical University Ankara, TURKEY URL:
Course Introduction David Ferry, Chris Gill Department of Computer Science and Engineering Washington University, St. Louis MO 1E81.
Advanced Operating Systems Introduction and Overview.
1 Operating System Software What, Where, Why, and How? Startup routines ROM BIOS POST Device Drivers User Interface – Text or GUI Menus and dialog boxes.
Lecture9 Page 1 CS 236 Online Operating System Security, Con’t CS 236 On-Line MS Program Networks and Systems Security Peter Reiher.
Chapter 2 Introduction to OS Chien-Chung Shen CIS/UD
I/O Software CS 537 – Introduction to Operating Systems.
Review etc.. Want to get out of here by 10am Go see 373 projects.
Lecture 4 Page 1 CS 111 Online Modularity and Memory Clearly, programs must have access to memory We need abstractions that give them the required access.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Chapter 6 Limited Direct Execution Chien-Chung Shen CIS/UD
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Copyright Prentice Hall, Inc. 1 Operating System Overview.
Computer Software. Two Major Types of SW System SW Programs that generally perform the background tasks in a computer. These programs, many times, talk.
Overview of today’s lecture Major components of an operating system Structure and internal architecture of an operating system Monolithic Vs Micro-kernels.
Lecture 5 Page 1 CS 111 Online Process Creation Processes get created (and destroyed) all the time in a typical computer Some by explicit user command.
Introduction to Operating Systems Concepts
Computer System Structures
Homework Reading Machine Projects Labs
Operating System & Application Software
Kernel Design & Implementation
Lecture 1-Part 2: Operating-System Structures
Lesson Objectives Aims You should be able to:
C++ coding standard suggestion… Separate reasoning from action, in every block. Hi, this talk is to suggest a rule (or guideline) to simplify C++ code.
Mechanism: Limited Direct Execution
Process Creation Processes get created (and destroyed) all the time in a typical computer Some by explicit user command Some by invocation from other running.
Modularity and Memory Clearly, programs must have access to memory
EECS 473 Review etc..
Chapter 2: System Structures
CS703 - Advanced Operating Systems
Lecture Topics: 11/1 General Operating System Concepts Processes
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
Presentation transcript:

Embedded Linux Day 2

Stuffs HW1 posted today – Shooting for 1-2 hours. – Review scheduling stuff & licensing. HW0 in lab Sign up for group meetings for next Thursday posted today.

Review I got a number of questions yesterday which led me to believe there are some fundamental misunderstandings. – I think I dove in too deep without looking around first. – So we’ll address that. About Linux, but also about the larger picture.

In this class, we are exploring a number of environments we could use on an embedded processor. One is “barebones” – In the context of this class, this means that you are just writing C or assembly and not using any library support (or at least no significant library support). – This is what we did in 373 – To do I/O, you need to read the processor specification and figure out which memory-mapped I/O locations you want to use and how to use them. – Advantages: Code can be really small (only have what you want) and efficient. You have complete control. – Disadvantages: Lots of work (reading, programming) Error prone

Environments… One is a set of libraries that you can call. – This is generally “just” a set of hardware interface functions that have been written for you. – Advantages: Don’t need to do as much reading. Hopefully the interface is the same across different boards/chips. – Makes porting so much easier. – Disadvantages Libraries might not support what you want to do. – Maybe no support for a 10-bit SPI device for example… Libraries might be ineffiecent as they are trying to do more than you want. Still need to handle scheduling yourself (which may be trivial, but might not be…)

Environments… One is an RTOS – Basically a bunch of libraries with a scheduler. Can be more than this (shell support, memory management, file system, all kinds of things) – FreeRTOS is an example of a fairly simple one of these. Supports memory management and even a FAT file system if you want it, but not hugely featureful support. – Advantages All the advantages of the libraries, but with a scheduler and other things. – Win! – Disadvantages More to learn about the software. – Can be hard to justify if you can’t amortize it over more than one project. Porting to new boards/chips tends to be harder, so often the port options are more limited. More “bloat” (code you don’t need) that could take up space. Might be doing things you don’t want (using timers, wanting control of interrupts, wanting control of memory layout, etc.)

RTOS (some more) Again, RTOSes can be huge or quite small; complex or very simple. – Linux can be an RTOS with work. WinCE is one too. All that’s needed is real-time support. But in here I’m talking about RTOSes similar to FreeRTOS – Small, modular, and fairly easy to understand. – Doesn’t try to (say) support every I/O device on the planet (which Windows and Linux does). Means less “bureaucratic overhead” than one might find in those OSes. – Smaller means less features, but what you can do is often faster and easier. “Make the common case fast”.

“user OS” that’s real-time (or not) Taking a full-fledged OS designed to deal with logged in users – Simultaneous Multi-user support, graphics, support for big applications (e.g. Word, Matlab), etc. Advantages – Familiar environment. – Support for applications. Want to do vision work, just use OpenCV. Want to do motion planning? Can do it in Matlab. – Abstracts nearly all hardware issues away. – Often highly portable. Given enough memory/CPU Disadvantages – Often huge bloat – May not be real-time; may not have control of scheduling as much as you’d like – While it effectively has massive library hardware support, if it doesn’t support what you want to do, it can be a pain to figure out how to do it yourself.

So… Much of the first half of this class is about exposing you to these different options. – 373 did barebones – Arduino is a library (with a bit more—the loop) – FreeRTOS lets you see a fairly basic (and good) RTOS – Lab 4, Linux device drivers, will let you see some of the difficulties of using a “user” OS in an embedded system. The win is pretty large (OpenCV for example) But there is a cost. Lab 4 (and this lecture) – Get you to see how to deal with one of the problems with such an OS How to write (and use…) a device driver in Linux. You’re on your own for Windows…

What we did last time I tried to get you some idea of what you might see on a minimal Linux install – File system, busybox, boot process, flash drive, etc. – If you are dealing with a very small version of Linux (often the case with embedded systems) you’ll be exposed to a lot of that.

Today Jump back to slides from last time – Cover device drivers in Linux at a high level…

Two devices crw-r--r-- 1 root root 60, :36 /dev/mem2 crw-rw-rw- 1 root root 60, :32 /dev/memory Created two devices, each with different minor numbers – But same driver – Recall that we print the minor number to the log on open. After a cat to /dev/memory and /dev/mem2 Nov 1 11:34:37 admin373-desktop kernel: [ ] Minor: 0 Nov 1 11:43:00 admin373-desktop kernel: [ ] Minor: 3 Modules: Some thinky stuff

Notes: One important note is that module stuff is written in kernel space. – That means you can’t do a lot of things you might want to! File I/O is a really bad idea – See next slide. Talking to memory-mapped I/O devices requires effort – Still have virtual memory Things like malloc don’t quite work – Thus kmalloc, kprint, etc. – Can be an unpleasant place to live… Modules: Some thinky stuff

A rant from on-line (Dick Johnson) The kernel is not a process. A file-descriptor needs a process-context for it to mean anything. Otherwise how would the kernel keep your STDIN_FILENO separate from somebody else's STDIN_FILENO? Coding a kernel module is not like coding a user-mode program. You should never write a module that requires reading or writing to any logical device. The kernel is the thing that translates physical I/O to logical I/O. Attempting to perform logical I/O in the kernel is effectively going backwards. If you need to get "outside world" information into your module, it's easy. Your module can have code for open(), read(), write(), ioctl(), and close(). A user-mode program can open() the device and perform any kind of device-specific ioctl() (or read or write or whatever) that it wants. This means that there is never, never, ever, never any real reason to attempt to perform logical (like file) I/O within the kernel at all. That said, it is possible to do file I/O in the kernel, but doing so is a severe violation of standard practice. It is also complicated and can lead to races and crashes if, for instance, a file is removed while your module has it open. You can readily code a kernel module so that it can be controlled from a user-mode script such as: – insmod my-thing.o my_device < parameters Until you understand this, you should not attempt to write a kernel module. If you need human input for your module, it works the same way. Modules: Some thinky stuff

Sources [1] – Very useful overview on drivers, a fair bit of text and many figures come from here. [2] Wikipedia – – [3] – Nice overview covering modules in general. A bit out of date?