Starter kit for Embedded linux programming [closed] - c

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I want to begin learning embedded linux development (i'm not beginner in C nor in Linux) and i choose this book :
http://www.amazon.com/Embedded-Linux-Primer-Practical-Real-World/dp/0137017839
If you have a better choice let me know please.
I want to buy some hardware to do some practice, any suggestions?
Thanks for your help.

#Greg - not a duplicate. Clearly this post is looking for advice on embedded linux, not general embedded.
#funnyCoder - What sorts of things are you wanting to do? Beagleboard is nice but might not fit your needs. Are you looking for:
Battery powered
Video display
USB host capability
Running a full desktop environment
Removable storage
Expansion ability
Ethernet
Wireless (Bluetooth or 802.11 or Zigbee)
Buttons, switches, LEDs
Touch screen interface
Audio
Also, processor speed and RAM have a big influence on what you will be able to do. There are low-end systems and very high-end systems and lots in between. Give us some requirements and we can direct you a little better. Or maybe someone has a link to a comparison guide.
A good book I'd recommend is the O'Riley book Building Embedded Linux Systems, but the one you've got is pretty good too.

Linux programming is linux programming, even kernel level, so the question is what Luke asked. What is it that you really want to do? The computer you typed this question on may suffice for much of what you are interested in or none of it. Depends.
If you go beagleboard avoid the old one go for the xM, it is usable where the other just costs more money to make it usable. The raspberry pi should be out any time now but it is an unknown quanity. I didnt like the plug computer but did like the open-rd board, liked it much better than my beagleboard. I have one of the chinese clones of the beagleboard which I liked much better (because it was usable out of the box) the xM has bridged that gap though. embeddedarm.com has a number of boards. The hawkboard is fine as well, they have had that picture up about pcb design flaw forever but my boards so far are fine.
Oh the open-rd board has sata built in you can plug a laptop hard drive right into the board, all of the others use slow usb or flash based solutions (the open-rd might be a usb to sata though). there is a tegra2 based one out there with various flavors that did that usb to sata, pretty lame. The big problem with these arm based one is they use slow mass storage and you cant really take advantage of the instruction set or other things like that, they are also crippled with the amount of ram.
There is always qemu, its free and you can try different processors. I would make sure you put ARM on the list of things you want to try/learn but might be worth trying others as well, mips, ppc, etc.

Related

How to convert an Arduino sketch into a C file in Code::blocks? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
How to convert an Arduino sketch into a C file in Code::blocks?
I don't know why this industry (Embedded Systems) is so poor in documentation. Everybody told me that in this field there are a lot of documentation to read... fine... I know for datasheets, but for some little code conversion (Arduino sketch to C in Code::blocks) I can't find even 1 example to see how it works...
Although this might be more of a comment I'd like to use an answer hoping that my "comment" answers your question.
don't know why this industry (Embedded Systems) is so poor in
documentation.
That is not true. Documentation of hard and software for embedded systems is very well documeneted. The manuals for Atmel AVR MCUs that power most of the Arduino models is excellent.
Converting Arduino sketches to Code::Blocks is a very special project. It is not surprising that you won't find a complete working tutorial on it.
Rather learn how to use Code::Blocks, how Arduino works and how to program AVRs from scratch. You'll find a ton of tutorials/resources on that. Then you combine that knowledge to your project. (that's a good approach to pretty much any problem you'll face in life. break it down)
There is also a vibrant and very kind community. All you need to do is show that you actually did some own work and you'll be overwhelmed with support.
Arduino is aimed at people with zero to little programming experience. Their takes away most hard work and thinking. You don't have to read 400 page manuals and manipulate registers on bitlevel to get a LED to blink or a motor to turn. You just call a few functions and that's it.
It uses some simplified C++ dialect and a lot of libraries and convenience stuff behind the curtain to allow that.
You don't have to worry about programmers, flashing firmware, setting up project files, writing make files and whatnot.
If you want to do the same without the Arduino IDE I highly recommend that you get yourself a book on AVR programming in C++ and if you don't know C++ to at least a medium level another one on C++. Somehow frankensteining Arduino sketches into a normal IDE doesn't appear to promissing in the long run.
You can make more out of your time.
You can't just convert a arduino sketch into codeblocks. The problem is that the arduino ide does all sorts of things behind our backs which makes it easier for a novice to begin programming a microcontroller.
The easiest way would be to start a new avr project in codeblocks and follow a tutorial on how to program a generic avr microcontroller using codeblocks. This might involve getting a ISP programmer or figuring out how to program using the arduino bootloader over serial.
You can start converting your arduino project to codeblocks after you've wholly understood the basic programming method using codeblocks. This is going to involve you writing your own definitions for digital_write and pinMode.
Your assertions about poor documentation is plain wrong. AVR is really well documented. You should try to read their documentation instead of Arduino's since that is targeted at novices or hobbyist who just want it to work. They hide much of the more fine tuned information.

Introduction to driver programming [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Driver programming is one of those things that I wanted to at least have an idea about for quite some time, but whenever I had some time to spare at my hands and sat down for research, I almost exclusively found very special questions about the matter or very broad introductions.
Now I do understand that it is not a trivial topic, but I personally learn best from sitting down and doing stuff. Therefore, I hope that you can give me a few pointers where to start. So, for the sake of a hands-on approach, consider the following scenario: I have a Raspberry Pi at my hands and want to utilize the GPIO pins as a serial port. (I'd love to hear other suggestions if you believe this is to complex for a starter's project. It's really more for the sake of doing it, the result is secondary). So the Pi runs Debian wheezy, and that's where I start from.
Given this, what do I need (software-wise) to get started? Specifically I am asking for the following:
Which compiler do I use?
Apart from the compiler and a text editor, do I need more tools?
Is there a some kind of scheme that I could copy to get started?
Do you maybe know of a great introduction that I just haven't had the luck to come across? I found that recorded lectures can be extremely helpful, and I would absolutely be willing to sit through a full course if that gets me started.
Do you know of a project simple enough for a beginner to learn from it by reading the sources on e.g. github?
And finally, am I totally on the wrong track? I might well be; I have been programming for quite some time, but usually in the high abstraction levels that languages with runtimes provide. I do have some experience regarding C++ programming and pointers aren't black magic to me, but I am not on very familiar ground here.
Also, if a blatant lack of understanding of drivers speaks out of this post, please point it out to me.
I never wrote a full fledged driver for a specific hardware, but I've gone through some basics in driver programming.
If you're into linux, before getting into driver programming you need to know what are drivers..? types of drivers..? how are drivers inserted as modules in kernel..? Here is the link. There is a basic abstract how to insert a driver or how to remove a driver from kernel and lot more.
There are video tutorials in youtube.
After you get enough stuff here, go through the LDD Book(Very nice book for beginners) as suggested by Joe.
Here's some more..
character driver example.
you may also wanted to know about kernel compilation, which is an intresting and important topic before starting driver programming, understand static and dyanamic(loadable) drivers.
You're in Linux, so what you have already installed (or available to install) should be enough to build with - a modern C compiler and make system, along with a decent editor. You even get a debugger capable of debugging both user and kernel space code - gdb & kgdb. Depending on what hardware you're tinkering with you may need something to look at what it's doing.
As for an introduction to drivers, there's two aspects you're asking about here. 1) O/S specific driver models, for Linux - start here: Linux Device Drivers and if that makes no sense to you, you know you need to go back a step and get some more basics down! 2) General aspects of h/w and terminology. I'm not sure of a good general resource here.
One final thing, C++ is not C, which is also not assembler which is also not machine code. At the level of battling hardware into life, you start having to know about the dirty secrets below the abstractions you normally use. There's plenty of information around about this sort of stuff but that's sort of the problem, there is a LOT to know. You could try Ulrich Dreppers article about memory, What Every Programmer Should Know About Memory, or you could look into what goes on with pre-emption and multi-tasking. Or you could look at datasheets for the hardware you're looking to control. There's plenty out there.
You've asked an incredibly general question, I'm surprised it's not been closed, however come back here when you've got stuff going and you have some specific questions to ask!

GUI-Library for microcontroller [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I want to create a GUI driven application for a micro-controller (Atmel XMEGA) that is connected to a 128x64 dots graphics LCD (EA DOGL128-6) and 4 buttons for navigation.
Controlling the display itself (e.g. drawing pixels and characters) is no problem but in order to prevent me from reinventing the wheel I was googling for a GUI-Library/-Toolkit that is written in c, includes its source code, will run on a 32 MHz 8-bit micro-controller and provides at least the following controls:
panel (to group elements)
menu (scrollable)
icon
label
button
line-graph (optional)
But I didn't find any thing useful. Does anyone know (or better uses) such a library(preferably for free)?
I would consider rolling your own "immediate mode" GUI. Jari Komppa has a good tutorial about them. It's a lot easier than you may think, and you'll probably find most GUI libraries--even those targeting embedded systems--are a bit heavy-weight for your system.
If you insist on using a third-party library, below are a few I found. I've never used any of them and they are probably fairly expensive.
emWin
C/PEG
easyGUI
I personally used PEG (at work), but it is not for free. You just need to write a small layer of adaptation and use it. You can also look at Qt or minigui.
I also wrote a library which supports nearly any display technology: µGUI
http://www.embeddedlightning.com/ugui/
µGUI is a free and open source graphic library for embedded systems. It is platform-independent and can be easily ported to almost every micro-controller system. As long as the display is capable of showing graphics, µGUI is not restricted to a certain display technology. Therefore display technologies such as LCD, TFT, E-Paper, LED or OLED are supported. The whole module consists of two files: ugui.c and ugui.h.
This might be helpful as well
You should take a look at Contiki [wikipedia.org]
Besides being a small and elegant operating system for many 8/16/32-bit microcontrollers, it also features a GUI toolkit. It runs on the Atmel AVR!
For your convenience, here is a direct link to the The Contiki Toolkit (CTK) source code.
In addition to Judge Maygarden's list RAMTEX provide libraries specifically aimed at small graphic LCDs. Again not free, but is this is for commercial use, remember that if you did it yourself, it may take many man hours to achieve a polished product, so consider that before building your own.
At the rates my company accounts for my time (as opposed to my pay rate), if it took more than five hours, I'd be better off buying the Ramtex library (about two days if you only take my pay rate into account). If however you have the time and inclination, it is not a difficult task, and probably fun.
Rich Quinnell mentions
"... I saw a demonstration of Java applications running on an STM32-F3 MCU..."
http://www.microcontrollercentral.com/author.asp?section_id=1741&doc_id=253618
I guess it is what you are looking for?
Atmel (now owned by Microchip) actually makes a GUI library targeted at their microcontrollers.
This is part of the now called Microchip® Advanced Software Framework.
You may want to have a look at the Nano-X framework (formerly known as Microwindows): http://www.microwindows.org/
It claims to support down to a 16-bit DOS system, so I'm not sure if it's suitable for an 8-bit, but maybe the library can be pared down to just what you need.
I haven't used it, but at one point was considering looking into using it for some simple display UI (though on a 32-bit ARM system). Unfortunately, the project shifted gears before I actually did anything with it. I'd be interested in what your take on it is (or how well it works if you decide to try to use it).
We've started using easyGui and it seems good. You design the screens in a PC app then it generates the source code - making the design stage really easy.
It does most of the things on the list. Line graphs are coming soon. You can make up buttons pretty easily as reusable structures.
It comes with template drivers for lots of displays - depending on how closely the template matches your display (colour depth & interface are the biggest issues) you might be able to use the code unmodified or change it to suit.
I have been working on a similar project. Closest thing I could find are in the following links, but I doubt you will find a library with all the features you desire. These will only setup basic drawing functions, but it's a start. There are also some useful tools for bitmap converting and font creators if you dig around.
http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/glcd_dcf77/index.html
http://en.radzio.dxp.pl/
Almost everything else I have seen here is way overkill for what the poster seems to be asking for.
The CodeVisionAVR development environment now has graphical libraries for XMEGA.
The CodeVisionAVR C Compiler features a powerful graphic library for
LCDs with resolutions from 84x48 up to 800x480 pixels.
However, it is not free.
You can use the "Microchip Graphics Library" for free.
This includes GUI tool "Graphics Display Designer X" for designing screens and this outputs the "C" files for your designed screen.
I am using this tool which is very user friendly, but some of the widgets what you are looking you may not find.
Here is the link for GUI tool:
Click here!
NuttX is a real-time operating system for microcontrollers. The author has starting a developing some gui primitives for LCD displays for it.

Where can I find a simple graphics C library for writing directly onto a frame? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I need a simple graphics C library to use on a device where I will be writing directly to the frame.
The frame is located in regular memory.
There is no graphics acceleration hardware.
Nothing fancy. I just want to be able to draw lines, circles, OSD stuff like strings as well.
It would be nice to have functions that use good, lean algorithms (my CPU is an ARM9 running at 400MHz).
What are some recommendations for this?
For very simple needs (lines, circles, polygons, text) I have always just made my own. Check out bresenham's algorithm for lines and circles, Wu's modifications for antialiasing on circles and lines.
Gimp will output C code for images, which is what I do for fonts, and drawing them is pretty easy. I have used anti-aliasing (gimp --> grayscale, use the grayscale value as the alpha), but haven't done proportional fonts. They aren't much harder, and can make the display a bit nicer, but I haven't needed them yet.
Polygons are simply multiple lines, and filled polygons are quite fun to implement.
It's not a lot of work, and you'll grow from the experience.
If, however, you decide you want to render SVG or some other complex vector language, then a library is in order. But for simple things, this isn't complex.
-Adam
I'd like to second OpenGL, especially the OpenGL|ES variant.
Here is a link to a Software based OpenGL-Renderer: http://sourceforge.net/projects/ogl-es
I've spend the last three years writing commercial software rasterization codes on ARM9 and similar processors, so I think I can comment on use of cairo and other high level APIs:
They work very well and are incredible powerfull, but on a target as limited as an ARM9 you will never be happy with the performance. The graphic libs are written with your typical Desktop PC in mind, and they trade precision for performance. This is nice for high quality SVG rendering, but to slow on a humble ARM.
The Vincent OpenGL|ES I've suggested above has a on the fly dynamic code generation engine for ARM-CPUs in place, so you get almost the performance of hand-optimized assembler code.
If you can limit yourself to just one bitmap-format, just two blend-modes and a hand full of rendering primitives you may get better performance by writing a dozen of render-routines yourself. Depending on your experience and requirements that can take anything from two days to a month though..
Cairo is pretty powerful and easy to use. I think Mozilla uses it as the basis for the <canvas> element and the SVG renderer.
From your requirements it appears you need something like an embedded framebuffer library (or whatever it is called). I played around with some of the following a few years back for an embedded browser (which didn't make it to the market). Unfortunately, I can't remember much to give you any analysis. Have a look:
DirectFB
GTK/X (or a port using directFB)
Cairo (as another poster has suggested -- this is very powerful)
Also, this article may be of interest.
Try SDL. From the web page:
Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer. It is used by MPEG playback software, emulators, and many popular games, including the award winning Linux port of "Civilization: Call To Power."
OPenGL has a set of 2d functions, not sure if it is too bloated for you or if it can be trimmed down. It is written in C, at least.
I found the Adafruit GFX library to my liking.
Very very simple and basic:
https://github.com/adafruit/Adafruit-GFX-Library

Best way to get started with programming other things than your computer? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
What is the best way to get started with programming things outside of your computer?
I don't mean mainstream things like cell phones with APIs.
Please assume working knowledge of C/C++
I vote for the Nintendo DS:
Nice hardware : 2 CPUs, 2 screens, touchscreen, mic, speakers, wireless, 2D and 3D acceleration
No OS to speak of
Freedom to talk to the bare metal without restriction
Well-documented
Very active dev community
Enthusiastic audience for anything cool you create
Cheap (shockingly so if you go for 1st-gen units)
All-in-all it's really excellent fun to play with.
To get started:
Get a DS
Get a SLOT1 flash-cart (I've got a DS-X, but there are plenty of others)
Get devkitpro
Go here for help or advice
Brian, you might find the Arduino interesting. It is inexpensive and pretty popular. I started playing around with micro controller boards and such a few years back and that lead to an interest in robots. Kind of interesting, at least to me.
If one is interested in a .NET-flavored development environment, there is an analog to the arduino call netduino that is worth a look.
Embedded programming is fun.
You can start with things like the Basic stamp or PIC, or since you know c/c++ you can use a real microcrontroller like an Atmel AVR. look at the Butterfly or Arduino kit
The Arduino has an amazing community of projects and info behind it.
It's not a microcontroller, but the Lego Minstorm is a good place to start learning the ins and outs of embedded programming.
I recently heard about the BUG which calls itself "open source hardware development". Is this the sort of thing you're looking for?
Buy yourself an HP 10C Calculator, and then program all those "programming 101" math algorithms using its insanely small but practical calculator language. Reminds me of assembler, but it's not.
I'd strongly recommend to find an open-source project next to one of your leisure occupations.
First, open-source because the support is mostly very friendly, then open-source because other contributors will have at least one comparable hobby, and then favorite pastime occupation so you can see a need for tools etc.
Two projects I have been playing around with very successfully:
Music: Rockbox, a firmware replacement for many mp3-players and portable media players.
Photography: CHDK, a firmware addition to numerous Canon compact still cameras.
Give SparkFun a shot. For me, servos are what I love to hack around with.
You can try with BeagleBoard, though its kind of mainstream, nonetheless very impressive performance to speak off at just 149$.
I'd look into stuff like (unofficial) GBA development or the like, sure there are "Libraries" but you can go digging and just stick bits into specific addresses and make stuff happen. You can't get more "No API" then raw memory-mapped hardware access.
Maybe start with small microcontroller projects.
This may be helpful: http://www.kmitl.ac.th/~kswichit%20/
What sort of things do you want to program?
Sounds like you might be interested in MAKE magazine, and some of their compilations, such as Making Things Talk. With a little bit of experience with basic electronics, you can follow their recipes to do all sorts of odd and interesting things. When you get more comfortable, you can start modding their designs.
Good luck, :)
I have personal experience and would recommend using these products to program PICs:
Programming board
GCBasic (Open Source Basic)
The PICs are cheap ($2 bucks or so) and the board will cost you around $120.
Recently, I have been impressed with TIs wireless USB chips/programmers. You can get 2 chips and a programmer for $50 bucks. It also comes with a free C compiler. By default it comes with a sample remote temperature program.
TI wireless target board
I think it's fun to hack old iPods. You can get a fourth generation iPod (or any of a number of supported devices), run Rockbox on it, then get the source and help hack on it.
I would also recommend AVR (8-bit) and Butterfly or DB101 kit. The main advantage is that there is a GCC compiler available and that you can program them through the Serial Port, without the need of a tool. Inexpensive programming and debugging tools are also available. There is a very strong AVR community in AVRFreaks
Another alternative is ARM7 and ARM9 microcontrollers (32bit). If you are interested in using an OS (ucLinux/FreeRTOS for ARM7, Linux for ARM9), you should go that way. There is of course a free GCC compiler. You can buy kits and tools at Olimex
If you would like to create a cool gadget using a microcontroller as a learning experience, you can look at the starter kits from Rabbit (website). They have a variety of low-cost kits with 8-bit microcontrollers to get started with a particular technology.
There are a lot of programmable robots around. In fact, even some of the Roombas (automated vacuums) can be programmed. This is particularly good if you want to teach kids how to program.
If you have a Nintendo Wii, you can crack it using Twilight Princess. You don't even have to buy it. I just rented it for a couple days. Go to WiiBrew.org and check out some of the projects that are available there. Most if not all are open source, and should give you a good starting point. Lots of ports of existing stuff, along with some original programs written specifically for the Wii. You would of course do the programming on your computer, and transfer the compiled binaries to the Wii. I haven't looked into how hard it is to get a development environment set up and having it build for the Wii, but if you email they project maintainers from wiibrew.org, they may be able to set you up.
[EDIT]
Just browsing around, I found DevkitPro, which seems to be the toolkit of choice for developing on many different console and handheld systems, including the Wii.
To ease yourself into embedded programming, you may want to try using XNA for either the Xbox or the Zune. You won't be doing memory management, but you'll get used to the constrained hardware if you do it on the Zune. Admittedly, it's using C#; but you could always do the programming itself using CIL.

Resources