Embedded Linux On A R M

0 %
100 %
Information about Embedded Linux On A R M

Published on January 24, 2008

Author: emcelettronica

Source: slideshare.net

Embedded Linux on ARM Chia Che Lee 李嘉哲 Home Automation, Networking, and Entertainment Lab Dept. of Computer Science and Information Engineering National Cheng Kung University

Tool chains OUTLINE Bootloader Building Linux kernel Linux device driver GUI Department of Computer Science and Information Engineering HANEL National Cheng Kung University 2

A collection of tools used to develop for Tool chains a particular hardware target (e.g. embedded system) Often used in the context of building software on one system which will be installed or run on some other device (e.g. embedded system) the chain of tools usually consists of such items as a particular version of a compiler, libraries, assembler, special headers, etc. Department of Computer Science and Information Engineering HANEL National Cheng Kung University 3

The Advantage of understanding Tool chains tool-chain : Any project that requires an embedded processor also requires software- development tools. Be advantage to develop new embedded system by developing own tool-chain Department of Computer Science and Information Engineering HANEL National Cheng Kung University 4

Tool chains The role of toolchain Department of Computer Science and Information Engineering HANEL National Cheng Kung University 5

Source Source Source Tool chains code code code Compile flow compiler compiler compiler chart Assembly Assembly Assembly code code code Assembler Assembler Assembler object object object code code code Executabl Libraries Linker e code code Department of Computer Science and Information Engineering HANEL National Cheng Kung University 6

GNU is a complete, Unix-like operating Tool chains system that has been in development Why using the for just over twenty years GNU Tool-chain GNU software is known for it's stability and standard compliance GNU tool-chain is open source which be easy to modify Department of Computer Science and Information Engineering HANEL National Cheng Kung University 7

The GNU toolchain consists : Tool chains Compiler – gcc Assembler – binutils : as Linker-- binutils : ld Library– glibc Debugger-- gdb Department of Computer Science and Information Engineering HANEL National Cheng Kung University 8

gcc is a full-featured ANSI C compiler Tool chains with support for C, C++, Objective C, gcc - GNU Java, and Fortran Compiler Collection GCC provides many levels of source code error checking , produces debugging information, and can perform many different optimizations to the resulting object code Department of Computer Science and Information Engineering HANEL National Cheng Kung University 9

The GNU Compiler for Java is now Tool chains integrated and supported: GCJ can gcc - GNU compile Java source or Java bytecodes Compiler to either native code or Java class files Collection GCC now supports the Intel IA-64 processor, so completely free software systems will be able to run on the IA- 64 architecture as soon as it is released. Department of Computer Science and Information Engineering HANEL National Cheng Kung University 10

Binutils are a collection of binary tools Tool chains like assembler, linker, disassembler … . GNU Binutils Binutils is to create and manipulate binary executable files. The main tools for Binutils ld - the GNU linker. as - the GNU assembler. Department of Computer Science and Information Engineering HANEL National Cheng Kung University 11

Any Unix-like operating system needs a Tool chains C library ( defines the ‘’system calls'' GNU C Library and other basic facilities such as open, malloc, printf, exit... ) The GNU C library is used as the C library in the GNU system and most systems with the Linux kernel. The GNU C library is a large blob of glue code, which tries to give it's best to hide kernel specific functions from you. (e.g. You can use the same function name and do not care the difference between different kernel ) Department of Computer Science and Information Engineering HANEL National Cheng Kung University 12

Tool chains GDB : The GNU Project Debugger What is GDB Allows you to see what is going on `inside' another program while it executes Allows you to see what another program was doing at the moment it crashed GDB can run on most popular UNIX and Microsoft Windows variants. Department of Computer Science and Information Engineering HANEL National Cheng Kung University 13

Supported Languages Tool chains C GDB C++ Pascal Objective-C Many other languages Department of Computer Science and Information Engineering HANEL National Cheng Kung University 14

Bootloader is mainly responsible for Bootloader loading the kernel, it is an very important component Many bootloaders can be used with Linux on various hardware LOIO GRUB LinuxBIOS Redboot U-boot …… Department of Computer Science and Information Engineering HANEL National Cheng Kung University 15

Bootloader Department of Computer Science and Information Engineering HANEL National Cheng Kung University 16

The simple code will be execute after Bootloader you power on your target ( Sometimes we call it “boot monitor” ) Embedded System bootloader should do: 1. Initialize Hardware: processor and memory 2. Loading kernel image and execute kernel (sometimes it need to transfer parameter to linux kernel) Department of Computer Science and Information Engineering HANEL National Cheng Kung University 17

Bootloader Department of Computer Science and Information Engineering HANEL National Cheng Kung University 18

Bootloader Boot Loader reset; ;Reset Code ;(in assembly) Jmp hw_init Hw_init ;Hardware Main() ;Initialization { ;(in assembly) /*The C/C++ program start here*/ …. } Jmp startup Startup; ;startup code NoOS/OS Code ;(in assembly) …… Call main Department of Computer Science and Information Engineering HANEL National Cheng Kung University 19

Part1 Jump 0x00900000 Bootloader Part2 Initialize the actual hardware Set cpu mode Part3 Disable all interrupts Copy any initialized data from ROM to RAM Zero the uninitialized data area Allocation space for and initialize the stack Initialize the processor’s stack pointer Create and initialize the heap Execute the constructors and initializers for all global variables (C++) Enable interrupts Call main Part4 Program C/C++ code Department of Computer Science and Information Engineering HANEL National Cheng Kung University 20

Bootloader Department of Computer Science and Information Engineering HANEL National Cheng Kung University 21

Three different host/target Building Linux kernel architectures are available for the development of embedded Linux systems: Linked setup Removable storage setup Standalone setup Your actual setup may belong to more than one category or may even change categories over time, depending on your requirements and development methodology Department of Computer Science and Information Engineering HANEL National Cheng Kung University 22

The target and the host are Building Linux kernel permanently linked together using a physical cable Linked Setup This link is typically a serial cable or an Ethernet link All transfers occur via the link Host Target *Cross-platform *Bootloader development *Kernel environment *Root filesystem Department of Computer Science and Information Engineering HANEL National Cheng Kung University 23

The kernel could be available via Trivial Building Linux File Transfer Protocol (TFTP) kernel The root filesystem could also be NFS Linked Setup mounted instead of being on a storage (cont’) media in the target Using an NFS-mounted root filesystem is actually perfect during development, because it avoids having to constantly copy program modifications between the host and the target The physical link can also be used for debugging purposes Many embedded systems provide both Ethernet and RS232 link capabilities Department of Computer Science and Information Engineering HANEL National Cheng Kung University 24

A storage device is written by the host, Building Linux kernel is then transferred into the target, and is used to boot the device Removable Storage Setup Host Target *Cross-platform development *Bootloader environment *Secondary bootloader *Kernel *Root filesystem Department of Computer Science and Information Engineering HANEL National Cheng Kung University 25

The target contains only a minimal Building Linux bootloader kernel The rest of the components are stored on a Removable removable storage media, such as a Storage Setup CompactFlash IDE device or any other type (cont’) of drive Instead of a fixed flash chip, the target could contain a socket where a flash chip could be easily inserted and removed The chip would be programmed by a flash programmer on the host and inserted into the socket in the target for normal operation Department of Computer Science and Information Engineering HANEL National Cheng Kung University 26

This setup is mostly popular during the Building Linux kernel initial phases of embedded system development Removable You may find it more practical to move on Storage Setup to a linked setup once the initial (cont’) development phase is over you can avoid the need to physically transfer a storage device between the target and the host every time a change has to be made to the kernel or the root filesystem Department of Computer Science and Information Engineering HANEL National Cheng Kung University 27

The target is a self-contained Building Linux kernel development system and includes all the required software to boot, operate, Standalone and develop additional software Setup This setup is similar to an actual workstation, except the underlying hardware is not a conventional workstation but rather the embedded system itself Target *Bootloader *Kernel *Full root filesystem *Native development environment Department of Computer Science and Information Engineering HANEL National Cheng Kung University 28

This type of setup is quite popular with Building Linux developers building high-end PC-based kernel embedded systems, such as high- Standalone availability systems Setup They can use standard off-the-shelf Linux (cont’) distributions on the embedded system Once development is done, they then work at trimming down the distribution and customizing it for their purposes This gets developers around having to build their own root filesystems and configure the systems' startup It requires that they know the particular distribution they are using inside out Department of Computer Science and Information Engineering HANEL National Cheng Kung University 29

There are some broad characteristics Building Linux kernel expected from the hardware to run a Linux system: 1. Linux requires at least a 32-bit CPU containing a memory management unit (MMU) 2. a sufficient amount of RAM must be available to accommodate the system. 3. minimal I/O capabilities are required if any development is to be carried out on the target with reasonable debugging facilities. Department of Computer Science and Information Engineering HANEL National Cheng Kung University 30

There are three different setups used Building Linux kernel to bootstrap an embedded Linux system: Solid state storage media Disk Network Department of Computer Science and Information Engineering HANEL National Cheng Kung University 31

Solid state storage media Building Linux kernel Boot parameter Kernel Root file system Bootloader Department of Computer Science and Information Engineering HANEL National Cheng Kung University 32

Building Linux Disk kernel Department of Computer Science and Information Engineering HANEL National Cheng Kung University 33

Building Linux kernel Department of Computer Science and Information Engineering HANEL National Cheng Kung University 34

Network Building Linux kernel the kernel resides on a solid state storage media or a disk, and the root filesystem is mounted via NFS only the bootloader resides on a local storage media. The kernel is then downloaded via TFTP, and the root filesystem is mounted via NFS Department of Computer Science and Information Engineering HANEL National Cheng Kung University 35

U ser program s Building Linux kernel L ibraries U ser Level K ernel L evel System C all Interface file subsystem IPC buffer Scheduler cache L inux M em ory m anagem ent character block device drivers H ardw are control (H A L ) K ernel Level H ardw are Level Department of Computer Science and Information Engineering HANEL H ardw are National Cheng Kung University 36

Device Driver Department of Computer Science and Information Engineering HANEL National Cheng Kung University 37

Classes of Devices and Modules Device driver Character devices Block devices Network interfaces Department of Computer Science and Information Engineering HANEL National Cheng Kung University 38

A character (char) device is one that Device driver can be accessed as a stream of bytes Character devices (like a file) Driver usually implements at least the open, close, read, and write system calls. The text console (/dev/console) and the serial ports (/dev/ttyS0) are examples of char devices. char devices are just data channels, which you can only access sequentially. Department of Computer Science and Information Engineering HANEL National Cheng Kung University 39

Like char devices, block devices are Device driver accessed by filesystem nodes in the Block devices /dev directory. A block device is something that can host a filesystem, such as a disk. Department of Computer Science and Information Engineering HANEL National Cheng Kung University 40

Any network transaction is made Device driver through an interface, that is, a device Network that is able to exchange data with interfaces other hosts. Network interface was look as a Queue The Unix way to provide access to interfaces is still by assigning a unique name to them (such as eth0). Department of Computer Science and Information Engineering HANEL National Cheng Kung University 41

Hello World Department of Computer Science and Information Engineering HANEL National Cheng Kung University 42

Whereas an application performs a Kernel module single task from beginning to end, a vs module registers itself in order to serve Application future requests, and its “main” function terminates immediately. the task of the function init_module (the module’s entry point) is to prepare for later invocation of the module’s functions.The second entry point of a module, cleanup_module, gets invoked just before the module is unloaded. Department of Computer Science and Information Engineering HANEL National Cheng Kung University 43

Department of Computer Science and Information Engineering HANEL National Cheng Kung University 44

Init_module() Init_module() for each facility, there is a specific kernel function that accomplishes this registration. The arguments passed to the kernel registration functions are usually a pointer to a data structure describing the new facility and the name of the facility being registered. Department of Computer Science and Information Engineering HANEL National Cheng Kung University 45

cleanup_module() cleanup_modu le To unload a module, use the rmmod command. Its task is much simpler than loading, since no linking has to be performed. The command invokes the delete_module system call, which calls cleanup_module in the module itself if the usage count is zero or returns an error otherwise. Department of Computer Science and Information Engineering HANEL National Cheng Kung University 46

The job of a typical driver is, for the I/O Regions most part, writing and reading I/O ports and I/O memory. Access to I/O ports and I/O memory (collectively called I/O regions) happens both at initialization time and during normal operations. Department of Computer Science and Information Engineering HANEL National Cheng Kung University 47

A typical /proc/ioports file on a recent PC that is running version 2.4 of the kernel will look like the following: 0000-001f : dma1 I/O Port 0020-003f : pic1 0040-005f : timer 0060-006f : keyboard 0080-008f : dma page reg 00a0-00bf : pic2 00c0-00df : dma2 00f0-00ff : fpu 0170-0177 : ide1 01f0-01f7 : ide0 02f8-02ff : serial(set) 0300-031f : NE2000 0376-0376 : ide1 03c0-03df : vga+ 03f6-03f6 : ide0 03f8-03ff : serial(set) 1000-103f : Intel Corporation 82371AB PIIX4 ACPI 1000-1003 : acpi 1004-1005 : acpi 1008-100b : acpi 100c-100f : acpi 1100-110f : Intel Corporation 82371AB PIIX4 IDE 1300-131f : pcnet_cs 1400-141f : Intel Corporation 82371AB PIIX4 ACPI 1800-18ff : PCI CardBus #02 1c00-1cff : PCI CardBus #04 5800-581f : Intel Corporation 82371AB PIIX4 USB d000-dfff : PCI Bus #01 d000-d0ff : ATI Technologies Inc 3D Rage LT Pro AGP-133 Department of Computer Science and Information Engineering HANEL National Cheng Kung University 48

I/O memory information is available in I/O Memory the /proc/iomem file. Department of Computer Science and Information Engineering HANEL National Cheng Kung University 49

Major and Minor Numbers Chars Drivers Special files for char drivers are Major and Minor Numbers identified by a “c” in the first column of the output of ls –l. Block devices appear in /dev as well, but they are identified by a “b.” Use ls –l /dev commend to check. Department of Computer Science and Information Engineering HANEL National Cheng Kung University 50

The kernel uses the major number at Chars Drivers open time to dispatch execution to the appropriate driver The minor number is used only by the driver specified by the major number mknod /dev/scull0 c 254 0 creates a char device (c) whose major number is 254 and whose minor number is 0. Department of Computer Science and Information Engineering HANEL National Cheng Kung University 51

QT & QT Embedded GUI DirectFB Department of Computer Science and Information Engineering HANEL National Cheng Kung University 52

Qt is a C++ class library for writing GUI GUI applications that run on UNIX, Windows QT & QT 95/98, and Windows NT platforms Embedded Qt/Embedded, the embedded Linux port of Qt, is a complete and self- contained C++ GUI and platform development tool for Linux-based embedded development. Department of Computer Science and Information Engineering HANEL National Cheng Kung University 53

GUI QT & QT Embedded Department of Computer Science and Information Engineering HANEL National Cheng Kung University 54

GUI DirectFB Department of Computer Science and Information Engineering HANEL National Cheng Kung University 55

GUI DirectFB Department of Computer Science and Information Engineering HANEL National Cheng Kung University 56

Add a comment

Related presentations

Related pages

Embedded Linux » Hardware » Linux-Magazin

Embedded Linux Artikel und News zum Thema. ... eine Klage gegen Arduino S.R.L, ... . 2 3 A B C D E F G H I J K L M N O P Q R S T U V W X Z. Ausgaben. 2016 ...
Read more

Softwareentwickler (m/w) - Schwerpunkt Embedded Linux

... (m/w) - Schwerpunkt Embedded Linux Regensburg ... Dann freuen wir uns auf Ihre Bewerbung online unter der Kennziffer SB36-83663-R bei Frau Daniela ...
Read more

Embedded Linux On A R M - Technology

1. Embedded Linux on ARMChia Che Lee李嘉哲Home Automation, Networking, and Entertainment Lab Dept. of Computer Science and Information Engineering ...
Read more

Embedded Linux Main Page - eLinux.org

Welcome to the eLinux wiki! ... Renesas R-Car Boards: DragonBoard: Parallella. ... if you have a problem with boot up time of your embedded Linux system ...
Read more

Embedded Linux Software Entwickler (m/w) - München Bayern ...

Embedded Linux Software Entwickler m w Munich Bayern Germany ... Sie haben bereits erste Erfahrungen im Embedded Linux Softwarebereich und besitzen: ...
Read more

uClinux™ -- Embedded Linux Microcontroller Project -- Home ...

The Embedded Linux/Microcontroller ... This product used a MCF5282 V2 ColdFire processor on an Arcturus uC5282 module running uClinux as its Embedded Linux ...
Read more

Embedded Linux Conference 2015 - YouTube

... Dronecode Project and Ardupilot With Linux ... Embedded Linux Benchmarking Using Kernel Trace ... Embedded Android Workshop Part 3 ...
Read more

Embedded Linux BSP-Kernel/Driver Entwickler (m/w ...

Für unsere Niederlassung in Erlangen suchen wir ab sofort einen Embedded Linux BSP-Kernel/Driver Entwickler (m ... und Embedded Devices; Aufbau von Linux ...
Read more

Embedded-Linux-Distributionen vorgestellt » Linux-Magazin

Dafür sind Embedded-Linux-Distributionen von Firmen wie Montavista [1], ... . 2 3 A B C D E F G H I J K L M N O P Q R S T U V W X Z. Ausgaben. 2016; 2015 ...
Read more