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
 
LinkBack Search this Thread
Old 12-21-2012, 01:07 AM   #1
Linraj
LQ Newbie
 
Registered: Dec 2012
Posts: 6

Rep: Reputation: Disabled
Question Linux porting


I used linux and done many programs in c and c++. But now i want to do progam for microcontrollers and test it on harware. I also want to write driver for RS232,PWM,USB etc. So how i start. Which board is best for ARM micontroller.

Linraj
 
Old 12-21-2012, 01:16 PM   #2
rtmistler
Member
 
Registered: Mar 2011
Location: Milford, MA. USA
Distribution: MontaVista, Ubuntu, MINT
Posts: 750
Blog Entries: 6

Rep: Reputation: 383Reputation: 383Reputation: 383Reputation: 383
Try a Beagleboard.

http://beagleboard.org/

http://code.google.com/p/beagleboard/

They have schematics available because it's a hobbyist board intended to give you ideas on how to design your own board using the ARM. There's a good amount of code written to run on them to get you started too.

To go further, you could look into Microchip PIC micro-controllers if your question was instead not for Linux but general micro-controller programming. There are other manufacturers with other varieties:

Freescale, Atmel, Intel 8051, Texas Instruments MSP430; all varieties of micro-controllers where you can grab a generic development board and play with the board for purposes of programming peripherals.

I'd suggest grabbing a development board which has I2C or SPI (or both) types of peripherals so that you can experiment with those as well as RS232, and some GPIO pins where you can hook up LEDS. Likely there are some LEDS already on that type of a board.

Last edited by rtmistler; 12-21-2012 at 01:24 PM. Reason: added more micro controller details
 
Old 12-21-2012, 04:17 PM   #3
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,388
Blog Entries: 2

Rep: Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900Reputation: 900
Linux generally requires more CPU than a traditional microcontroller has (unlees we've started calling things like ARMs microcontrollers). Linux definitely requires a Memory Management Unit (MMU), and while I haven't played with microcontrollers for a few years, there was never an MMU on any that I knew of.
It is quite possible to use Linux as a development platform for microcontroller target hardware. I don't know of any particular cross development systems, but I know they're out there. Some might be feeware.
--- rod.
 
Old 12-22-2012, 12:02 AM   #4
gdejonge
Member
 
Registered: Aug 2010
Location: Netherlands
Distribution: Kubuntu, Debian, Suse, Slackware
Posts: 285

Rep: Reputation: 70
The ARM Cortex-M3 processor is what most people would call a micro controller. But those chips come normally with flash and ram memory in kbyte ranges, which is really not enough to run an operating system like linux.
There are several boards out there. Look for 'arm maple board' or 'arduino due arm' on google.
If the OP really wants to run linux on an ARM then he should look for the beagleboard as rtmistler mentioned or the raspberryPI. Just google for them.

@theNbombr I use my linux machine to develop for avr microcontrollers. works perfect with avr-gcc.

Last edited by gdejonge; 12-22-2012 at 12:07 AM.
 
Old 12-24-2012, 03:46 AM   #5
Linraj
LQ Newbie
 
Registered: Dec 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thanks rtmistler,gdejonge,theNbomr. I think now i got good link to start.
 
Old 12-24-2012, 03:59 AM   #6
Linraj
LQ Newbie
 
Registered: Dec 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
@ rtmistler their are three boards which one should buy. I new to this but i wanna buy board which i can use in future also, i mean i want to buy advance board. Please suggest me.
 
Old 12-27-2012, 08:44 AM   #7
rtmistler
Member
 
Registered: Mar 2011
Location: Milford, MA. USA
Distribution: MontaVista, Ubuntu, MINT
Posts: 750
Blog Entries: 6

Rep: Reputation: 383Reputation: 383Reputation: 383Reputation: 383
Been away for the holidays, just saw your follow up question.

I guess it really depends on what you wish to accomplish. As others have mentioned, ARM processors are not always considered to be micro-controllers that's why I added information about Microchip, ATMEL, and such.

Sounds like you wish to play with a board that is simple, has peripherals and allows you to add more stuff. I didn't evaluate more than one board and just got the BeagleBoard. However the main reason was to prove that we could run our Linux based applications on an ARM so that our hardware team could then design a board for our product; based on the ARM. The xM board has more stuff on it and in fact has a header to interface for I2C and SPI; it also has Ethernet on the board. You can add Ethernet to the regular BeagleBoard, but if you wish to have it already there and want to experiment with the driver, you're better off with the xM. Not totally sure, but I think the microSD card uses SPI so that at least is one item on the board that uses that type of interface.

You don't have to run Linux on the board, micro-controller programming typically is a main loop coupled with one or more interrupts. As I've said, it really depends on what you were looking to concentrate on.

Playing with Linux on the ARM and experimenting with drivers, I'd recommend the BeagleBoard-xM and starting with their Angstrom distribution.

If you're interested instead with programming for a micro-controller I'd recommend something like the pic24 devkit:

http://<br /> http://www.microchip....en535092<br />

Where you get their tools, a board and debugger capability for about $60. Then you can play with the various things on the board like capacitive touch, flash drive, RTC, PWM, and ADC.
 
Old 12-28-2012, 03:22 AM   #8
Linraj
LQ Newbie
 
Registered: Dec 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thanks @ rtmistler, you caught me right i already used GUI development kit and already familiar with PIC, AVR , MSP430, ARM7 and done lots of development But thing is that Linux is free so can i do all things which is had done in GUI like keil , MPLAB, AVRStudio etc.

I mean can i program ARM7(like LPC2194) or 32 bit micro controllers (PIC24 etc.) using Linux environment. I am very new to LINUX. till now just done shell programming in c and c++.
 
Old 12-28-2012, 10:55 AM   #9
rtmistler
Member
 
Registered: Mar 2011
Location: Milford, MA. USA
Distribution: MontaVista, Ubuntu, MINT
Posts: 750
Blog Entries: 6

Rep: Reputation: 383Reputation: 383Reputation: 383Reputation: 383
You can for ARM like I've described with something like the BeagleBoard. For a specific ARM processor, it's a matter of searching for a distribution or trying one that doesn't require MMU on the processor you've chosen. I'd recommend first using something that someone has already resolved so that you can understand how the kernel was configured and the HAL was done. Also important is the boot loader where the chip and environment are set up in advance for the kernel to load and utilize that specific processor's resources.

PIC, no. If there is one I suspect it's very limited and not really Linux with most of the capabilities, instead just that someone got it working to a degree so that they could say, "I did it!".

I'd recommend two things.

(1) Program for real in Linux on a current full blown machine, running Linux. You can attach all kinds of stuff via the USB or serial ports, or USB-Serial. You can attach a camera, a game controller, an IR detector; just something which can give you input via USB or serial where you can write a program to attach to that port and grab the data. Here what you want to learn are two things (a) how to interface with Linux resources (b) how to architect under the Linux system services.

I'm not sure there's any specific guide unless someone reading this knows of good references. Probably opinion based too.

My example is that I program a lot in Linux utilizing numerous serial devices. The architectures we use are Linux core computer running a GUI which is driven by one of the various vendors; such as Qt, under which there are various sensors performing real time data collection, but sending either raw or filtered data via serial connections to my Linux core. Linux processes grab that data and communicate via pipe(2). Since there are some cross communications; such as the top GUI needing to send commands down to the other processes, and also those processes always sending data upwards to the GUI, I've developed architectures using fork(2) and execvp(2) so that the pipes are known to each other. Then I use select(2) and recv(2) to determine if there is new data and process it accordingly.

That's a little disorganized, sorry. Summary is: On boot up, I create a daemon, here's a good example.

http://<br /> http://www.netzmafia....wto.html<br />

Of course I extend that because things like exiting or other things are not conducive to an embedded system; i.e. we have speakers, LEDs etc to indicate critical failure, or we retry and retry indicating we are in a phase of booting until we can either succeed or the user has to attach a serial terminal and debug the problem.

Next from that daemon I create common resources, for instance my pipe(2) mechanisms for communications to/from each process I plan to use. I've developed a function to fork() and exec() my child processes. And because the daemon created these processes, it has their pid's and therefore can wait on signals from them and determine if they were killed or exited in error. And then the daemon can then re-spawn a failed process or indicate critical error. But that's all the daemon does, gets it going and then monitors and either attempts recovery or indicates failure. Remember that this is for an embedded system, not really a keyboard or monitor, but instead lights and limited push buttons; like a Coke machine or something, right?

The next step is that each process does something specific; for instance one talks to accelerometers, another talks to an environmental sensor, another one talks to a metal detector maybe. So to extend the Coke machine thought example, acceleration is whether or not some idiot is trying to bang the machine over and maybe that process indicates danger to the idiot that a thousand pound machine may fall on top of them. The environmental sensor detects whether or not refrigeration is working properly, and metal detector detects coins inserted. Each process may inject information to the GUI to tell the user what's happening. I.e. You inserted 5 cents, I got it, but that's not enough yet to make a selection; touch REFUND or insert more coins ... That information was conveyed via one process sending to another, which I use pipes for; however there are a variety of IPC mechanisms in Linux, see:

http://<br /> http://www.tldp.org/L...de7.html<br />

And you can choose how to communicate between two processes in a manner which best suits you.

You may wish to read that whole reference, it talks a lot about Linux in general:

http://<br /> http://www.tldp.org/L...de1.html<br />

Further, because it's embedded there may be a serial port or some way for the administrator/owners to communicate; which isn't available to a normal user. We keep logs on the system so when someone attaches via networking or a terminal, they'll be able to obtain those logs and diagnose.

The second recommendation is to then explore customizing distributions where you cut down the kernel and services that are included in the boot so that you have a minimal version; running what you want, but not running extras that are not needed. For instance, if you're an embedded device with a custom display, you may not need an XServer at all, you may not need CUPS (printer driver), you may not even need any network stacks if you are solely communicating via serial to a device, although most things usually use networking or wireless to interface these days.

So if coming up to speed more on how you can use Linux user programming to accomplish things like talking to peripherals and such, there are some thoughts. I'm not really a kernel person, I do what I need to get things accomplished on that front and the most I've done is customized an existing driver to add more features to it. But reading up on Linux drivers is good too:


http://lwn.net/Kernel/LDD3/
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in linux porting rjeyakodi Linux - Embedded & Single-board computer 6 01-11-2010 03:17 AM
Porting VC++ to Linux g++ linux_chris Linux - Software 2 02-10-2009 11:17 AM
HP-UX to linux porting arunprakash Other *NIX 2 03-01-2005 10:53 PM
Porting C++ from HP-UX 11.0 to Linux paul sachs Other *NIX 2 01-10-2005 05:37 PM
Porting to Linux?? 00-00-00 Linux - General 1 05-27-2002 09:20 PM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration