J o i n t I C T P - I A E A S c h o o l o n Z y n q - 7 0 0 0 S o C a n d i t s A p p l i c a t i o n s f o r N u c l e a r a n d R e l a t e d I n s t r u me n t a t i o n I n t r o d u c t i o n t o E mb e d d e d L i n u x Fernando Rincón fernando.rincon@uclm.es Smr3143 – ICTP & IAEA (Aug. & Sept. 2017)
Contents ● Embedded OS ● Embedded Linux ● Linux Architecture 2 Introduction to Petalinux Smr3143 – ICTP & IAEA (Aug. & Sept. 2017)
Embedded OS ● Embedded systems usually perform very simple tasks – Monitor status of sensors – React to events following simple rules ● Move motors ● Activate relays ● Send data ● … ● Complex applications may have more requirements – Concurrent execution – Real-time management – Resource multiplexion – Advanced communication mechanisms ● Purpose of the OS → Release the user from those complex tasks 3 Introduction to Petalinux Smr3143 – ICTP & IAEA (Aug. & Sept. 2017)
Desktop vs Embedded ● Main diferences – Small footprint, and tailored to the specifc need – Custom peripheral drivers. – Less protection mechanisms ● Even no Memory management Unit (MMU) – Real-time – Lack of very simplistic user-interface – Sometimes no network connection ● Although the trend is to have everything connected 4 Introduction to Petalinux Smr3143 – ICTP & IAEA (Aug. & Sept. 2017)
Embedded OS Development ● Cross-development – Host machine: develoment enviroment and tools ● Cross-compiler – Diferent versions for bare-metal and OS development ● Mostly because of the linked libraries ● Ex: arm-none- vs arm-xilinx-linux ● Target root flesystem & basic libraries for compilation purposes – Target machine: ● Bootloader ● Kernel ● Root flesystem ● Cross-platform design cycle – Compile → test → debug – Use of emulators ● Bootstrap process: – Flash – Network – ... 5 Introduction to Petalinux Smr3143 – ICTP & IAEA (Aug. & Sept. 2017)
Why Linux? ● Low cost of ownership ● Open-source, full control and customizability ● Rich feature set ● Quality of Linux components ● Re-use of Linux components ● Big active developer community & resources ● Pool of talented embedded Linux developers ● Scalability, from embedded to the cluster ● Standard tools and run-time environment 6 Introduction to Petalinux Smr3143 – ICTP & IAEA (Aug. & Sept. 2017)
What does Linux Ofer? ● Multiple processor achitectures supported – ARM, MIPS, PowerPC, x84, amd64, Microblaze, … ● Reduced foot print (a few MB) and fast booting times (~4 s) ● Networking: – full support for TCP/IP, Wif, Bluetooth, USB, … ● Graphics: – X, Frame Bufer & DRM/KMS. – Graphical development libraries QT, Gnome, … ● Multimedia: – Video4Linux & Gstreamer, FFMPeg, OpenCV, … 7 Introduction to Petalinux Smr3143 – ICTP & IAEA (Aug. & Sept. 2017)
What Does Linux Ofer? ● Interoperability and OS infrastructure – Networking, fle systems, device support – Scheduling, processes/threads, interrupt handling, interprocess communication, symmetric multiprocessing (SMP) ● Developer familiarity – Standard tools – Standard run-time environment – Application code can be prototyped on the desktop ● Scalability – Deeply embedded → single board computers → desktop → server → cluster ● Freedom and openness – Accessibility to modify source code 8 Introduction to Petalinux Smr3143 – ICTP & IAEA (Aug. & Sept. 2017)
Linux Components Tools Root File Application Utilities User Applications Linux Build & Development GNU Cross-Compiler tool system (rootfs) chain & Debugger Libraries – Graphics, Video, Networking, etc. Tool Kernel Linux Kernel Device Drivers Image U-boot Boot Loader First Stage Boot Loader Hardware QEMU Linux Build tools: PetaLinux, Yocto, OpenEmbedded, buildroot Other tool chains: Linaro, GCC Board Support Package (BSP): Collection of SoC/board specific Linux mainline components that include Linux kernel & device drivers, boot loader and tools 9 Introduction to Petalinux Smr3143 – ICTP & IAEA (Aug. & Sept. 2017)
Anatomy of a Linux System ● User applications – Task specifc – Libraries – C run time, networking, – graphics, for example ● Kernel – More on this soon ● Hardware – CPU, memory – Timer, interrupt controller, I/O 10 Introduction to Petalinux Smr3143 – ICTP & IAEA (Aug. & Sept. 2017)
Linux Kernel Architecture Overview ● System call interface (SCI) – Function calls from user space to kernel ● Process management – Processes or threads – Share the CPU between the active threads ● Memory management – Manages the virtual and physical memory ● Virtual fle system – Switching layer between the SCI and the fle systems supported by Linux 11 Introduction to Petalinux Smr3143 – ICTP & IAEA (Aug. & Sept. 2017)
Linux Kernel Architecture Overview ● Network stack – Above TCP, socket layer – Invoked through the SCI ● Device drivers – Supports most of the common devices ● Architecture-dependent code (BSP) – Processor and platform-specifc code 12 Introduction to Petalinux Smr3143 – ICTP & IAEA (Aug. & Sept. 2017)
System Call Interface ● Contract between user space and kernel space – Request services – Memory, I/O – Process management ● The standard C library is a wrapper around the system call interface – For example, malloc() is a C library call ● Maintains a pool of memory ● Calls kernel memory allocator only when that pool is exhausted 13 Introduction to Petalinux Smr3143 – ICTP & IAEA (Aug. & Sept. 2017)
Virtual Memory 14 Introduction to Petalinux Smr3143 – ICTP & IAEA (Aug. & Sept. 2017)
Linux distributions 15 Introduction to Petalinux Smr3143 – ICTP & IAEA (Aug. & Sept. 2017)
Recommend
More recommend