Introduction to embedded linux device driver and firmware


Published on

Published in: Technology, Business

Introduction to embedded linux device driver and firmware

  1. 1. Introduction to Embedded Linuxand Device
  2. 2. What is an Embedded system?An embedded system is a special-purpose computersystem designed to perform one or a few dedicatedfunctions, often with real-time computing constraints. It is usually embedded as part of a complete deviceincluding hardware and mechanical parts.In contrast, a general-purpose computer, such as apersonal computer, can do many different tasksdepending on programming.Embedded systems control many of the commondevices in use today.
  3. 3. Embedded System Products
  4. 4. LinuxThe Free Software and Open Source world offers abroad range of tools to develop embedded systems.AdvantagesReuse of existing components for the base systemAllows to focus on the added value of the product.High quality, proven components (Linux kernel, Clibraries...)Complete control on the choice of componentsModifications possible without external constraintsCommunity support: tutorials, mailing lists...Low cost, in particular no per-unit royalties.Potentially less legal issues.Easier access to software and tools.
  5. 5. Linux ArchitectureHardwareBoot loaderLinux kernelStandard C libraryLibrary Library LibraryApplicationTools
  6. 6. Embedded HardwareHardware for embedded systems is often differentfrom hardware for classical systems.Often a different CPU architecture: ARM, MIPS orPowerPC. Intel atom based on x86 arch is also used.Storage on flash : NOR or NAND type, often withlimited capacity (from a few hundreds of MB to fewGB)Limited RAM capacity (from a few tens of MB toseveral hundreds of MB)Many interconnect buses generally not often foundon the desktop: I2C, SPI, SSP, CAN, etc.
  7. 7. Minimum System HW ReqA CPU supported by gcc and the Linux kernel32 bit CPUMMU-less CPUs are also supported, through theuClinux project.A few MB of RAM (4 MB), 8 MB are needed toreally do something.Linux isnt designed for small microcontrollers thatjust have a few tens or hundreds of KB of flash andRAM.Base metal, no OSReduced systems, such as FreeRTOS , Nucleus
  8. 8. SW Comp’s Req for DevelopmentCross-compilation tool chainCompiler that runs on the development machine, butgenerates code for the targetBootloaderStarted by the hardware, responsible for basicinitialization, loading and executing the kernelLinux KernelContains the process and memory management,network stack, device drivers and provides services touserspace applicationsC libraryThe interface between the kernel and the userspaceapplicationsLibraries and applicationsThird-party or in-house
  9. 9. Driver DevelopmentKernel Architecture for Device DriversEmbedded Linux DriverDevelopment
  10. 10. Kernel and Device DriversApplicationSystem call interfaceFrameworkDriverBus infrastructureHardwareUserspaceKernel
  11. 11. Unified Device ModelThe 2.6 kernel included a significant new feature: a unified deviceModel : Instead of having different ad-hoc mechanisms in the varioussubsystems, the device model unifies the description of thedevices and their topology Minimization of code duplication Common facilities (reference counting, event notification,power management, etc.) Enumerate the devices, view their interconnections, linkthe devices to their buses and drivers, etc. Understanding the device model is necessary to understandhow device drivers fit into the Linux kernel architecture.
  12. 12. Bus Drivers The first component of the device model is the bus driver; One bus driver for each type of bus: USB, PCI, SPI, MMC, I2C, etc. It is responsible for: Registering the bus type (struct bus_type) Allowing the registration of adapter drivers (USB controllers,I2C adapters, etc.), able of detecting the connected devices,and providing a communication mechanism with the devices Allowing the registration of device drivers (USB devices, I2Cdevices, PCI devices, etc.), managing the devices Matching the device drivers against the devices detected bythe adapter drivers Provides an API to both adapter drivers and device drivers Defining driver and device specific structure, typicallyxxx_driver and xxx_device
  13. 13. Example: USB BusUSB coreRegisters the bus_type structureUSB adapterdriver AUSB adapterdriver BUSB devicedriver 1USB devicedriver 2USB devicedriver 3SystemUSB1USB2DEV1 DEV2DEV3 DEV4 DEV5
  14. 14. Platform Devices On embedded systems, devices are often not connectedthrough a bus allowing enumeration, hot plugging, andproviding unique identifiers for devices. However, we still want the devices to be part of the devicemodel. The solution to this is the platform driver / platform deviceinfrastructure. The platform devices are the devices that are directlyconnected to the CPU, without any kind of bus.
  15. 15. Linux DD Course ContentOverviewUnderstanding the Linux kernel Understanding the development process Kernel Internals Root file system development from scratch Developing Linux device drivers Driver architecture Development of char driver Working with the kernel development community Practical labs with ARM boards as well as emulatedPC systems Duration 50 hrsFor further queries/enquiries contact
  16. 16. Thank you!