System Construction Autumn Semester 2017 ETH Zürich Felix Friedrich 1
Goals Competence in building custom system software from scratch Understanding of „ how it really works “ behind the scenes across all levels Knowledge of the approach of fully managed lean systems A lot of this course is about detail. A lot of this course is about bare metal programming . 2
Course Concept Discussing elaborated case studies In theory (lectures) and practice (hands-on lab) Learning by example vs. presenting topics 3
Prerequisite Knowledge corresponding to lectures Systems Programming and/or Operating Systems Do you know what a stack-frame is? Do you know how an interrupt works? Do you know the concept of virtual memory? Good reference for recapitulation: Computer Systems – A Programmer's Perspective 4
Links SVN repository https://svn.inf.ethz.ch/svn/lecturers/vorlesungen/trunk/syscon/2017/shared Links on the course homepage http://lec.inf.ethz.ch/syscon 5
Background: Co-Design @ ETH Languages (Pascal Family) +MathOberon Active Modula Oberon ActiveOberon Cells Oberon07 Zonnon Operating / Runtime Systems Medos Oberon Aos A2 SoC LockFree HeliOs Minos Kernel Hardware x86 / IA64/ ARM TRM Lilith Ceres Emulations on (FPGA) Unix / Linux RISC (FPGA) 6 1980 1990 2000 2010
Course Overview Part1: Contemporary Hardware Case Study 1. Minos: Embedded System Safety-critical and fault-tolerant monitoring system Originally invented for autopilot system for helicopters Topics: ARM Architecture, Cross-Development, Object Files and Module Loading, Basic OS Core Tasks (IRQs, MMUs etc.), Minimal Single-Core OS: Scheduling, Device Drivers, Compilation and Runtime Support. With hands-on lab on Raspberry Pi (2) 7
Course Overview Part1: Contemporary Hardware Case Study 2. A2: Multiprocessor OS Universal operating system for symmetric multiprocessors (SMP) Based on the co-design of a programming language (Active Oberon) and operating system (A2) Topics: Intel SMP Architecture, Multicore Operating System, Scheduling, Synchronisation, Synchronous and Aysynchronous Context Switches, Priority Handling, Memory Handling, Garbage Collection. Case Study 2a: Lock-free Operating System Kernel With hands-on labs on x86ish hardware and Raspberry Pi 8
Course Overview Part2: Custom Designed Systems Case Study 3. RISC: Single-Processor System RISC single-processor system designed from scratch: hardware on FPGA Graphical workstation OS and compiler ("Project Oberon") Topics: building a system from scratch, Art of simplicity, Graphical OS, Processor Design. Case Study 4. Active Cells: Multi-Processor System Special purpose heterogeneous system on a chip (SoC) Massively parallel hard- and software architecture based on Message Passing Topics: Dataflow-Computing, Tiny Register Machine: Processor Design Principles, Software-/Hardware Codesign, Hybrid Compilation, Hardware Synthesis 9
Organization Lecture Tuesday 14:15-16:00 (CAB G 56) with a break around 15:00 Exercise Lab Tuesday 16:00 – 18:00 (CAB G 56) Guided, open lab, duration normally 2h First exercise: today (19th September) Oral Examination in examination period after semester (15 minutes). Prerequisite: knowledge from both course and lab 10
Design Decisions: Area of Conflict simple / sophisticated / Programming Model undersized complex universal / tailored / Compiler overly generic non-generic elaborate / comprehensible / Language incomprehensible simplicistic feature rich / customizable / Tools predetermined inconvenient economic / optimized / System unoptimzed uneconomic I am about here 11
Min imal O perating S ystem 1. CASE STUDY MINOS 12
Focus Topics Hardware platform Cross development Simple modular OS Runtime Support Realtime task scheduling I/O (SPI, UART)* Filesystem (flash disk) *Serial Peripheral Interface, Universal Asynchronous Receiver Transmitter 13
Learn to Know the Target Architecture 1.1 HARDWARE 14
ARM Processor Architecture Family 32 bit R educed I nstruction S et C omputer architecture by ARM Holdings 1st production 1985 (Acorn Risc Machine at 4MHz) ARM Ltd. today does not sell hardware but (licenses for) chip designs Prominent example: StrongARM (1995) by DEC & A dvanced R isc M achines. XScale implementation by Intel (now Marvell) after DEC take over More than 90 percent of the sold mobile phones (since 2007) contain at least one ARM processor (often more) * [95% of smart phones, 80% of digital cameras and 35% of all electronic devices*] Modular approach (today): ARM families produced for different profiles, such as Application Profile, Realtime Profile and Microcontroller / Low Cost Profile *http://news.cnet.com/ARMed-for-the-living-room/2100-1006_3-6056729.html *http://arm.com/about/company-profile/index.php 15
ARM Architecture Versions Architecture Features ARM v1-3 Cache from ARMv2a, 32-bit ISA in 26-bit address space ARM v4 Pipeline, MMU, 32 bit ISA in 32 bit address space ARM v4T 16-bit encoded Thumb Instruction Set [http://www.arm.com/products/processors/instruction-set-architectures/] ARM v5TE Enhanced DSP instructions, in particular for audio processing Jazelle Technology extension to support Java acceleration ARM v5TEJ technology (documentation restricted) SIMD instructions, Thumb 2, Multicore, Fast Context Switch ARM v6 Extension ARM v7 profiles: Cortex- A (applications), -R (real-time), -M (microcontroller) ARM v8 Supports 64-bit data / addressing (registers). Assembly language overview available (more than 100 pages pure instruction semantics) 16
ARM Processor Families very much simplified & sparse Architecture Product Line / Family Speed (MIPS) (Implementation) ARMv1-ARMv3 ARM1-3, 6 4-28 (@8-33MHz) ARMv3 ARM7 18-56 MHz ARMv4T, ARMv5TEJ ARM7TDMI up to 60 ARMv4 StrongARM up to 200 (@200MHz) ARMv4 ARM8 up to 84 (@72MHz) ARMv4T ARM9TDMI 200 (@180MHz) ARMv5TE(J) ARM9E 220(@200MHz) ARMv5TE(J) ARM10E ARMv5TE XScale up to 1000 @1.25GHz ARMv6 ARM11 740 ARMv6, ARMv7, ARMv8 ARM Cortex up to 2000 (@>1GHz) 17
ARM Architecture Reference Manuals describe ARMv5 Architecture Reference Manual ARMv6-M Architecture Reference Manual ARM/Thumb instruction sets ARMv7-M Architecture Reference Manual ARMv7-M Architecture Reference Manual Processor modes and states ARMv7-AR Architecture Reference Manual ARMv8-A Architecture Reference Manual Exception and interrupt model System programmer's model, standard coprocessor interface Memory model, memory ordering and memory management for different potential implementations Optional extensions like Floating Point, SIMD, Security, Virtualization ... for example required for the implementation of assembler, disassembler, compiler, linker and debugger and for the systems programmer. 18
ARM Technical System Reference Manuals describe Particular processor implementation of an ARM architecture Cortex™ - A7 MPCore™ Technical Reference Manual Redundant information from the Architecture manual (e.g. system control processor) Additional processor implementation specifics e.g. cache sizes and cache handling, interrupt controller, generic timer usually required by a system's programmer 19
System on Chip Implementation Manuals describe Particular implementation of a System on Chip Address map: BCM2835 ARM Peripherals physical addresses and bit layout for the registers Peripheral components / controllers, such as Timers, Interrupt controller, GPIO, USB, SPI, DMA, PWM, UARTs usually required by a system's programmer. 20
ARM Instruction Set consists of Data processing instructions Branch instructions Status register transfer instructions Load and Store instructions Generic Coprocessor instructions Exception generating instructions 21
Some Features of the ARM Instruction Set 32 bit instructions / many in one cycle / 3 operands Load / store architecture (no memory operands such as in x86) ldr r11, [fp, #-8] increment a ? local variable add r11, r11, #1 ? str r11, [fp, #-8] 22
Some Features of the ARM Instruction Set Index optimized instructions (such as pre-/post-indexed addressing) stmdb sp!,{fp,lr} ; store multiple decrease before and update sp stack activation ? ... ? frame ldmia sp!,{fp,pc} ; load multiple increase after and update sp 23
Some Features of the ARM Instruction Set Predication : all instructions can be conditionally executed* cmp r0, #0 null pointer ? swieq #0xa ? check 24
Some Features of the ARM Instruction Set Link Register procedure call ? bl #0x0a0100070 ? Shift and rotate in instructions r11 = fp + r11*4 add r11, fp, r11, lsl #2 ? ? e.g. array access 25
Some Features of the ARM Instruction Set PC-relative addressing load a large ? ldr r0, [pc, #+24] ? constant Coprocessor access instructions mrc p15, 0, r11, c6, c0, 0 ? setup the mmu ? 26
ARM Instruction Set Encoding (ARM v5) shiftable register conditional execution 8 bit immediates with even rotate load / store with destination increment undefined instruction: user extensibility load / store with multiple registers branches with 24 bit offset generic coprocessor instructions 27 From ARM Architecture Reference Manual
Recommend
More recommend