LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
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


Reply
  Search this Thread
Old 06-17-2015, 07:31 AM   #1
pepo007
LQ Newbie
 
Registered: Jun 2015
Posts: 2

Rep: Reputation: Disabled
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
 
Old 06-17-2015, 08:54 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,958
Blog Entries: 13

Rep: Reputation: 5000Reputation: 5000Reputation: 5000Reputation: 5000Reputation: 5000Reputation: 5000Reputation: 5000Reputation: 5000Reputation: 5000Reputation: 5000Reputation: 5000
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.
 
Old 06-19-2015, 07:23 AM   #3
pepo007
LQ Newbie
 
Registered: Jun 2015
Posts: 2

Original Poster
Rep: Reputation: Disabled
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.
 
Old 06-19-2015, 07:31 AM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,958
Blog Entries: 13

Rep: Reputation: 5000Reputation: 5000Reputation: 5000Reputation: 5000Reputation: 5000Reputation: 5000Reputation: 5000Reputation: 5000Reputation: 5000Reputation: 5000Reputation: 5000
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.
 
Old 07-09-2015, 06:18 PM   #5
blue_z
Member
 
Registered: Jul 2015
Location: USA
Distribution: Ubuntu, Lubuntu, Mint, custom embedded
Posts: 105

Rep: Reputation: Disabled
Quote:
Originally Posted by pepo007 View Post
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.
 
Old 07-09-2015, 06:30 PM   #6
ardvark71
LQ Veteran
 
Registered: Feb 2015
Location: USA
Distribution: Lubuntu 14.04, 22.04, Windows 8.1 and 10
Posts: 6,282
Blog Entries: 4

Rep: Reputation: 842Reputation: 842Reputation: 842Reputation: 842Reputation: 842Reputation: 842Reputation: 842
Quote:
Originally Posted by blue_z View Post
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...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
which linux Operating systems applied to Embedded systems? ubun2os Linux - Embedded & Single-board computer 3 03-14-2013 04:24 PM
A slightly complicated >50 MPBS bandwidth division for 2 systems Sinedie Linux - Networking 2 09-12-2009 08:50 PM
Read only file systems, custom live CDs, and embedded systems coffeecoffee Linux - Newbie 2 02-24-2009 11:09 PM
linux in embedded systems tanatan Linux - Newbie 1 05-22-2006 07:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 04:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration