Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
06-17-2015, 07:31 AM
|
#1
|
LQ Newbie
Registered: Jun 2015
Posts: 2
Rep: 
|
It is writing driver in Linux for embedded systems complicated?
Hi,
I want to start writing drivers for Linux in embedded systems. All my friends warned me that is very complicated and tedious. Mostly they are programming in Java or c# (for X86 servers) and few are working on embedded system but in bare metal hardware in C (as I, but only short time). I have concept on HW part of working system (IRQ, timers, DMA, different buses, etc.) and worked for years in C and understand skeleton concept of creating drivers in Linux. So question which I want ask it is really so difficult if you compare it to other programming (create applications, bare metal embedded programming, etc.) and which part is most challenging (going over device documentation, integration into Linux, optimalisation, etc.). Thx
|
|
|
06-17-2015, 08:54 AM
|
#2
|
Moderator
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,958
|
You say you have experience working close to hardware so there's your answer. Which is it's exactly THAT level of complexity. A DRIVER is how the OS talks to hardware.
|
|
|
06-19-2015, 07:23 AM
|
#3
|
LQ Newbie
Registered: Jun 2015
Posts: 2
Original Poster
Rep: 
|
Thank for you point of view  . What is puzzling me is that even people programming embedded processors as bare metal considering writing Linux drivers complicated and I have no doubt that have a way to deal with HW complexity. If there are different thoughts please point them out.
|
|
|
06-19-2015, 07:31 AM
|
#4
|
Moderator
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,958
|
People working on embedded processors typically program in a non-OS or a traditional RTOS environment.
They do write code in C as well as assembler, some may use C++, but typically most programming is at the lowest level.
I think it's mainly the fact that they're uncomfortable or unfamiliar with the higher level OSes like Windows, Linux, and iOS.
The highest most embedded developers go are the commercial RTOSes like pSos, OSE, FreeRTOS, VxWorks, stuff like those. Linux's programming models are both similar, as well as different. And although Linux is pretty good embedded, I never claim it to be real-time. For those requiring true real-time behaviors, they go either no-OS or one of the free/commercial RTOSes.
|
|
|
07-09-2015, 06:18 PM
|
#5
|
Member
Registered: Jul 2015
Location: USA
Distribution: Ubuntu, Lubuntu, Mint, custom embedded
Posts: 105
Rep: 
|
Quote:
Originally Posted by pepo007
So question which I want ask it is really so difficult if you compare it to other programming (create applications, bare metal embedded programming, etc.) and which part is most challenging (going over device documentation, integration into Linux, optimalisation, etc.).
|
Linux (like any well-written operating system) has a high degree of modularity and abstraction. From what I've seen in some embedded projects (i.e. not mine), the concepts of modularity and abstraction are often considered optional or simply absent.
Linux is one of the few embedded OSes that use virtual memory and executes its kernel in a protected CPU mode. That is a big step up in complexity over a bare-metal environment. Device drivers are one of the few areas in the kernel that may have to deal with both virtual and physical memory addresses.
Processors for embedded Linux are typically RISC, and are often ARM, rather than x86. If you have only programmed for x86, then you will have to learn the restrictions of word alignment. Even if you program for Linux on x86, you need to learn about memory word alignment, since Linux is processor/architecture agnostic.
The Linux kernel requires adherence to its C coding style. Personally I learned C in order to do Unix kernel programming, so it's not an issue for me. But from reading code samples on the web and seeing how typical people are resistant to changing their own coding style, the Linux kernel code style can be difficult to use for some. Hint: posting your Linux driver code that does not conform to the kernel style
in a public forum brands you as a kernel newbie or clueless.
Regards
Last edited by blue_z; 07-09-2015 at 06:35 PM.
|
|
|
07-09-2015, 06:30 PM
|
#6
|
LQ Veteran
Registered: Feb 2015
Location: USA
Distribution: Lubuntu 14.04, 22.04, Windows 8.1 and 10
Posts: 6,282
|
Quote:
Originally Posted by blue_z
Linux (like any well-written operating system) has a high degree of modularity and abstraction. From what I've seen in some embedded projects (i.e. not mine), the concepts of modularity and abstraction are often considered optional or simply absent.
Linux is one of the few embedded OSes that use virtual memory and executes its kernel in a protected CPU mode. That is a big step up in complexity over a bare-metal environment. Device drivers are one of the few areas in the kernel that may have to deal with both virtual and physical memory addresses.
Processors for embedded Linux are typically RISC, and are often ARM, rather than x86. If you have only programmed for x86, then you will have to learn the restrictions of word alignment. Even if you program for Linux on x86, you need to learn about memory word alignment, since Linux is processor/architecture agnostic.
The Linux kernel requires adherence to its C coding style. Personally I learned C in order to do Unix kernel programming, so it's not an issue for me. But from reading code samples on the web and seeing how typical people are resistant to changing their own coding style, the Linux kernel code style can be difficult to use for some. Hint: posting your Linux driver code that does not conform to the kernel style
in a public forum brands you as a kernel newbie.
|
Hi...
That's quite a first post. Welcome to the forum
Regards...
|
|
|
All times are GMT -5. The time now is 04:56 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|