ERTS 2008 - Using Linux for industrial projects


Published on

This slideshow gives feedback about using Linux in industrial projects. It is part of a conference held by our company CIO Informatique Industrielle at ERTS 2008, the European Embedded Real Time software Congress in Toulouse

Published in: Technology, Business
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

ERTS 2008 - Using Linux for industrial projects

  1. 1. Using Linux for industrial projects Return of experience C. Charreyre
  2. 2. License <ul><li>Attribution-Noncommercial-Share Alike 2.0 France </li></ul><ul><li>You are free: </li></ul><ul><ul><li>to Share - to copy, distribute, display, and perform the work </li></ul></ul><ul><ul><li>to Remix - to make derivative works </li></ul></ul><ul><li>Under the following conditions: </li></ul><ul><ul><li>Attribution. You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). </li></ul></ul><ul><ul><li>Non commercial. You may not use this work for commercial purposes. </li></ul></ul><ul><ul><li>Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one. </li></ul></ul><ul><li>For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page . </li></ul><ul><li>Any of the above conditions can be waived if you get permission from the copyright holder. </li></ul><ul><li>Nothing in this license impairs or restricts the author's moral rights. </li></ul>
  3. 3. CIO Informatique Industrielle <ul><li>Company dedicated to industrial software development </li></ul><ul><li>Incorporated in 1990 </li></ul><ul><li>15 engineers to help customers on embedded and real time software </li></ul><ul><li>Great investment on Linux technologies since 2000 Competence center created in 2001 </li></ul><ul><li>Located in St Etienne and Marseille </li></ul><ul><li>Member of Libertis, association of free software service companies in PACA </li></ul><ul><ul><li> </li></ul></ul>
  4. 4. Linux on the embedded market <ul><li>Linux is a fast growing actor on the embedded market </li></ul><ul><li>It is know representing about 50% of the market </li></ul><ul><ul><li>Source </li></ul></ul><ul><ul><li>Embedded Linux Market Survey 2007 </li></ul></ul>
  5. 5. Linux on the embedded market <ul><li>The Arm processor is the most used architecture with Linux </li></ul><ul><li>Linux + Arm is a great solution for low price mass market devices </li></ul><ul><ul><li>Source </li></ul></ul><ul><ul><li>Embedded Linux Market Survey 2007 </li></ul></ul>
  6. 6. Linux at CIO <ul><li>Typical projects : </li></ul><ul><ul><li>Software developments for industrials or aerospace/defense </li></ul></ul><ul><ul><li>With real time and embedded characteristics </li></ul></ul><ul><li>OS used until 2000 : </li></ul><ul><ul><li>Legacy RTOS like OS9, VxWorks, QNX etc.... </li></ul></ul><ul><li>Investment on Linux technologies in 2000 </li></ul><ul><li>A step by step approach : </li></ul><ul><ul><li>Use of Linux distribution on PC (desktop, PC104, SBC, Compact PCI) </li></ul></ul><ul><ul><li>Home made reduced Linux on same architecture </li></ul></ul><ul><ul><li>Use of real time extensions to get same performances as legacy RTOS </li></ul></ul><ul><ul><li>Use on other architectures used in projects : PowerPC, Arm </li></ul></ul><ul><li>We suggest such an approach to new adopters (from easiest to most difficult) </li></ul>
  7. 7. Linux for embedded device <ul><li>Requirements of embedded projects : </li></ul><ul><ul><li>Processor architecture can be Intel, but also PPC, Arm, microcontroller ... </li></ul></ul><ul><ul><ul><li>Linux available on many architectures used in embedded devices : X86, Freescale, Arm, SuperH, AVR32, Blackfin ... (24 arch. In 2.6.23) </li></ul></ul></ul><ul><ul><li>Low memory and storage requirements </li></ul></ul><ul><ul><ul><li>Linux distributions are huge (Gigabytes), and require Megabytes of memory </li></ul></ul></ul><ul><ul><ul><li>The good approach is to build a reduced embedded image, with the precise requirements of the project </li></ul></ul></ul><ul><ul><ul><li>By rebuilding a dedicated embedded image, one can reach sizes like 4 MB of mass storage and 8 MB of memory </li></ul></ul></ul><ul><ul><li>Flash support </li></ul></ul><ul><ul><ul><li>Compact Flash or Disk on Module emulate IDE, managed by IDE driver </li></ul></ul></ul><ul><ul><ul><li>NAND or NOR flash managed by the MTD framework, with a lot of chipsets supported </li></ul></ul></ul>
  8. 8. Linux for embedded device <ul><li>Requirements of embedded projects : </li></ul><ul><ul><li>Quick boot </li></ul></ul><ul><ul><ul><li>Boot time = Bootloader (+ BIOS if X86) + Linux startup </li></ul></ul></ul><ul><ul><ul><li>Bootloader must be tuned to reduce its time </li></ul></ul></ul><ul><ul><ul><li>Linux startup can range from few seconds to few tens of seconds depending on processor speed and quantity of services, for embedded images </li></ul></ul></ul><ul><ul><li>Switch off without shutdown </li></ul></ul><ul><ul><ul><li>Journaling capabilities of Linux filesystems reduce risks, but are not sufficient in embedded world </li></ul></ul></ul><ul><ul><ul><li>The solution is to use RAM disks as the root of the file system : in case of file system corruption, the copy in RAM is corrupted, not the file system itself </li></ul></ul></ul><ul><li>With an adequate strategy, Linux can deal with the requirements of embedded devices </li></ul>
  9. 9. An embedded project <ul><li>Customer requirements : </li></ul><ul><ul><li>Complete access to source code </li></ul></ul><ul><ul><li>Different hardware and form factor </li></ul></ul><ul><ul><li>Performant and reliable TCP/IP stack </li></ul></ul><ul><ul><li>Quick availability after power on </li></ul></ul>
  10. 10. An embedded project <ul><li>Linux chosen because : </li></ul><ul><ul><li>Linux and basic components governed by GPL, the sources of the developed application itself were also given to the customer </li></ul></ul><ul><ul><li>Linux available on first architectures (X86 on Compact PCI and PPC on VME) </li></ul></ul><ul><ul><li>Linux TCP/IP stack are performant (most Web servers run under Linux) </li></ul></ul><ul><ul><li>Very quick availability after power on thanks to very reduced dedicated image </li></ul></ul><ul><li>The project has been delivered successfully for the first 2 architectures, and it will be easy to swap to new ones </li></ul><ul><li>The customer performs later evolutions by itself </li></ul>
  11. 11. Real time with Linux <ul><li>Types of project : </li></ul><ul><ul><li>Embedded only : Linux OK </li></ul></ul><ul><ul><li>Soft real time : Linux OK with adapted strategy </li></ul></ul><ul><ul><li>Hard real time : Linux not OK, but Linux + Real time extension OK </li></ul></ul><ul><li>Linux is a general purpose OS, the scheduler's mission is to distribute the processor to all processes on a fair base in a large time scale (no fixed priority). </li></ul><ul><li>Soft real time is accessible through the scheduler API : </li></ul><ul><ul><li>« Real time » class implements same scheduling principles than RTOS </li></ul></ul><ul><ul><li>There is no guarantee on interrupt reaction duration, due to the internal structure of kernel, so hard real time not possible </li></ul></ul><ul><ul><li>Kernel 2.6 can be preemptible, but large sections of the kernel have interrupt masked or preemption disabled, so even 2.6 is not hard real time </li></ul></ul><ul><li>Preemptible kernel 2.6 + real time class scheduling  Soft real time </li></ul>
  12. 12. Real time with Linux <ul><li>Hard real time needs a real time extension : </li></ul><ul><ul><li>RTLinux : GPL, then commercial product, now bought by WindRiver </li></ul></ul><ul><ul><li>RTAI : GPL </li></ul></ul><ul><ul><li>Xenomai : GPL, skins available </li></ul></ul><ul><li>Extension implemented as kernel modules </li></ul><ul><li>Extension implements a RTOS </li></ul><ul><li>Application shared between Linux (not real time part) and extension (real time part) with IPC between the 2 worlds. </li></ul><ul><li>In the real time part, no access to Linux system calls nor drivers (a real time driver framework : RTDM) </li></ul><ul><li>Possibility to develop the real time part as : </li></ul><ul><ul><li>Full kernel modules </li></ul></ul><ul><ul><li>Linux processes managed by the real time extension </li></ul></ul>
  13. 13. A real time project <ul><li>The project is to develop a data recorder for high end automotives (to record data on vehicle's buses). </li></ul><ul><li>The hardware is built with PC104 board, with CPU, CAN board and a DSP board. </li></ul><ul><li>Real time requirements : precise time stamp of data, full determinism in exchanges between CPU and DSP </li></ul><ul><li>Kernel 2.4 choosen, due to Linux drivers availability, and conservative approach when project was launched </li></ul><ul><li>RTAI used for real time purposes </li></ul><ul><li>CIO's job : </li></ul><ul><ul><li>Soft choices </li></ul></ul><ul><ul><li>Linux + RTAI integration </li></ul></ul><ul><ul><li>Port of Linux drivers towards RTAI </li></ul></ul><ul><ul><li>Application skeleton development </li></ul></ul>
  14. 14. Porting from RTOS to Linux <ul><li>Why porting from RTOS to Linux : </li></ul><ul><ul><li>Replacing old hardware by newest one, not yet supported by RTOS </li></ul></ul><ul><ul><li>Avoiding licence costs .... </li></ul></ul><ul><li>To avoid important costs, it is interessant to port as much as possible at the OS level : </li></ul><ul><ul><li>System calls remapping </li></ul></ul><ul><ul><li>Compatibility library </li></ul></ul><ul><li>The goal is to change the applications sources the less possible, to avoid development and revalidation costs </li></ul><ul><li>A project example : port of a SNMP stack from 68K / OS9 towards PowerPC / Linux </li></ul><ul><li>This port was a mock up for a larger application </li></ul>
  15. 15. Porting from RTOS to Linux <ul><li>Main difficulties encountered : </li></ul><ul><ul><li>Compiler change reveals problems in the original sources. Gnu chain makes much more control than original OS9 compiler : </li></ul></ul><ul><ul><ul><li>Quality problems in original sources, syntax errors .... </li></ul></ul></ul><ul><ul><ul><li>Bad data alignment of structure members </li></ul></ul></ul><ul><ul><ul><li>Consequence : a lot of unforeseen work to correct the sources </li></ul></ul></ul><ul><ul><li>Memory model : </li></ul></ul><ul><ul><ul><li>OS9 processes shared data structures : members of shared data were pointers </li></ul></ul></ul><ul><ul><ul><li>No problem on OS9 with flat memory model </li></ul></ul></ul><ul><ul><ul><li>Impossible with Linux with segmented memory through MMU </li></ul></ul></ul><ul><ul><ul><li>Solved by using the shared memory API, with fixed mapping of the shared memory at same address for all processes </li></ul></ul></ul><ul><ul><li>Use of signals and alarms : </li></ul></ul><ul><ul><ul><li>Cooperation between OS9 process made with a lot of signals </li></ul></ul></ul><ul><ul><ul><li>Linux offers very few signals available to users </li></ul></ul></ul><ul><ul><ul><li>Development of an emulation API of OS signals based on SIGUSR1 </li></ul></ul></ul>
  16. 16. Porting from RTOS to Linux <ul><li>Main difficulties encountered : </li></ul><ul><ul><li>Use of signals and alarms : </li></ul></ul><ul><ul><ul><li>A lot of alarms running in parallel in the original OS9 application </li></ul></ul></ul><ul><ul><ul><li>Linux is not designed to have such an architecture </li></ul></ul></ul><ul><ul><ul><li>Solved by developping an alarm emulation API based on dedicated alarm threads </li></ul></ul></ul><ul><li>Other system aspects where quite easy to remap with wrappers (through include files) </li></ul><ul><li>The port was finally achieved successfully. It demonstrated the concept could be extended to the whole application </li></ul><ul><li>3 types of difficulties : </li></ul><ul><ul><li>Relative easy remapping of system calls (the majority) </li></ul></ul><ul><ul><li>More challenging points solved by emulation library (signals, alarms) </li></ul></ul><ul><ul><li>Most difficult points : memory model and original sources difficulties triggered by compiler change. </li></ul></ul>
  17. 17. More information <ul><li>Web site </li></ul><ul><li>Contact us : </li></ul><ul><ul><li>Tél : +33 4 95 05 19 41 </li></ul></ul><ul><ul><li>Mail : </li></ul></ul>