14

I'm a software developer. I've been programming in high level languages for a few years.

I would like to know, how to take my first step into programming hardware. Not something crazy complicated, but maybe some ordinary CE device? Assuming I don't need to put the PCB together with varies components, but just to program the tiny cpu?

How low-level do I have to go? ASM? C? manipulating registers? or are the dev kit quite high level now? Is Java even in the picture? OO coding in hardware, is that even a dream or a reality? Need a reality check.

I also tend to learn better with books or sites that are written in a tutorial format. Something that guides the way for me from something simple to something more complex. Any recommendations? Maybe something that will introduce me to the popular hardware (microprocessor/micro-controller) available today?

Much appreciated, thank you everyone.

Earlz
  • 57,517
  • 89
  • 275
  • 484
Henry
  • 31,972
  • 19
  • 112
  • 214

6 Answers6

8

The actual programming isn't a big deal. The frustrating, annoying part is getting your development environment setup and getting the tools working. Once you've done that, you're half done.

I'd suggest buying a development kit ('dev kit') that has USB built in and works with your chosen OS. Get that working, and you're halfway done.

If you're missing the knowledge, it's also important to know the basics of how a processor works. You'll be programming at a much lower level than any other programming, so the fundamentals are a bit more important.

Peter
  • 114,224
  • 47
  • 167
  • 205
  • what kind of dev kit do you recommend specifically? – Henry Jan 25 '10 at 21:28
  • or.. are there any VM for uController/microprocessor on PC? Like.. doing J2ME development without J2ME phone? Just wondering... – Henry Jan 25 '10 at 22:55
  • @Henry: I'd recommend starting with an Atmel processor (they're quite popular and simple) or a Motorola MSP430 or similar (low power). Basically just any dev kit with usb will be good. As to a VM on a PC - I don't know if you can get them these days, but I'd recommend *not* getting one - half the challenge / practice / satisfaction is getting the toolchain working. – Peter Jan 25 '10 at 23:18
  • If I wanna go for Atmel processor, I can use Arduino, what if I wanna go for Motorola/Freescale processor? Which dev kit shall I get? and how different will it be programming Atmel vs Motorola/Freescale? – Henry Jan 26 '10 at 00:57
  • Seconding Peter here. Try hard to get *some* image - whatever it does - that you can download to the board and run. Maybe some linux, maybe a demo provided by the manufacturer. Thay way, you can make sure that *that* part of the proces works. Then, try to build your own program ("Hello World") and get it to download. Next thing you know, embedded fun. – doppelfish Feb 03 '10 at 20:07
  • I'd suggest staying away from Arduino for a while since it abstracts quite a lot of things that a programmer is exposed to when programming the processor directly. After some low-level work you can pick-up Arduino coder-friendly environment. – Saulius Žemaitaitis Apr 17 '10 at 13:42
2

If you know C then it's only a matter of learnig the tool chain steps to download the code.

Easy place to start (cheap hardware/software) http://www.arduino.cc/en/Guide/HomePage

Martin Beckett
  • 90,457
  • 25
  • 178
  • 252
  • 2
    There's also learning about how IO ports work, memory limitations/requirements incl. possibly paging, interrupt service routines. It's quite a bit more than just knowing C and the toolchain. – Paul Nathan Jan 25 '10 at 19:47
  • Paul, do you have a book you recommend for learning those that you mentioned? thank you. – Henry Jan 25 '10 at 21:29
  • @Henry: I have not personally run into a nice textbook/walkthrough for those things. I should write one up. :-) You will find discussion of those(to some degree) in technical documentation for a given processor. Some of those areas are in 1 cpu, not in another. – Paul Nathan Jan 25 '10 at 21:50
  • I'm not sure if this is even the right Q to ask, but here it is.. what are some of the most popular processors for basic CE devices that are widely available? And generally, what are their capabilities? – Henry Jan 25 '10 at 22:07
  • @Henry: define CE. Window CE? – Paul Nathan Jan 25 '10 at 22:10
  • Consumer Electronics, like... something as simple as having some sensors, do some easy calculation in the processor, and control some hardware (e.g. display) real-time? Thanks. – Henry Jan 25 '10 at 22:14
  • @Paul - yes, but it's easy to get started. As long as you know C and have an idea what a bit is then you should be able to make a micro turn a pin on and off. It was suppsoed tobe a quick encouraging answer – Martin Beckett Jan 25 '10 at 22:20
  • @Henry: You want something called a 'development kit'. Popular ones are the Atmel AVR, the Rabbit, the Arduinio, the Beagle(I gather that it's popular). I also suggest the XMOS & the Parallax Propellor dev kits for multicore work. www.digikey.com is generally a respectable and responsible distributor. – Paul Nathan Jan 25 '10 at 22:34
  • I don't know that it's as popular in the hobbyist world as others, but it's definitely a major player overall. The Coldfire softcore(ie loadable onto a FPGA) CPU seems well thought-of. – Paul Nathan Jan 25 '10 at 22:44
  • just found this post, quite interesting , atmel-v-microchip-v-freescale: http://diydrones.com/profiles/blogs/atmel-v-microchip-v-freescale – Henry Jan 25 '10 at 22:54
  • Paul, it'd be nice if you can provide some resource on "learning about how IO ports work, memory limitations/requirements incl. possibly paging, interrupt service routines". Dev kits don't come with manual that go over those right? – Henry Jan 26 '10 at 00:58
  • @Henry: you will find that most tools for embedded programming are lousy & each processor is usually oriented towards a given goal. – Paul Nathan Jan 26 '10 at 01:01
  • So Arduino still the best choice for beginner? How about something that directly supports AVRStudio? Will that be better? – Henry Jan 26 '10 at 01:12
  • AVR studio isn't bad. It's not awesomesauce like visual studio, but it's decent! – Paul Nathan Jan 26 '10 at 01:21
2

I have been coding in C both as a hobby and professionally for about 16 years now, but always for userland code (i.e., programs, not kernel or drivers). Most of my jobs involved high level languages (I have done a lot of Perl and Ruby programming, with the occasional Java, Python and shell scripting in between). I did develop a lot for MS-DOS (which was probably as close to bare-metal programming as you would get on a x86 machine), but my last job involved 5 years of Perl and Ruby on Rails web development.

That being said, I am now a senior engineer for embedded Linux development, developing drivers (including an emulator for a legacy simple microprocessor inside a kernel module) for uClinux on the Blackfin platform. There are times when my inexperience with hardware related issues (i.e., floating signal levels due to lack of a pull-up/pull-down on a pin) did get in the way, but it has been mostly a highly enjoyable and thrilling experience. As stated by others, understanding your tools is essential -- for uClinux, that meant the GNU Toolchain, which fortunately I was already familiar with due to my background on FOSS technologies.

The Blackfin is hardly an entry-level microprocessor (in particular, it does not have a MMU, which has some relevant effects on Linux development), but as already stated, you can buy a Beagleboard for around US$200 with all required accessories and start messing around with it in just a few days. If you want something simpler, there are many Arduino options out there, though if you have some real development experience under your belt I believe you will find their development environment a little limiting (I know I did).

After you get comfortable with your tools you might want to spend some money on an in-circuit emulator (or ICE). These are usually highly platform specific (both in terms of target architecture and development environment), but are highly recommended for anything beyond the usual blink-LEDs-after-button-press examples I am sure you will quickly outgrow.

In few months you will find yourself building custom images for hackable customer devices using Buildroot and having a lot of fun. All I can say is, go for it, it's highly addictive and not particularly expensive to do nowadays.

  • Beagleboard, how does it compare to Arduino? Seems like it is already a computer on Linux... like micro-controller on steroid? It runs on linux already? Then.. would programming it be higher level, relative to Arduino? Thank you. – Henry Jan 26 '10 at 00:42
  • @Henry Beagleboard is almsot a PC from a few years ago, it runs linux has a network, plugs into a keyboard and monitor - you can probably even develop on it directly Arduino is a real micor controller. It's raw C plus commands to change voltages on pins. You code on a PC, download the finished program, connect the power and hope! – Martin Beckett Jan 26 '10 at 01:18
  • Can Beagleboard also do what Arduino do? like... changing voltages on pins and stuff? – Henry Jan 26 '10 at 01:34
  • The Beagleboard doesn't seem to have any GPIO pins. Do try to prove me wrong, though. – doppelfish Feb 04 '10 at 20:39
0

Also something to look into is the Microsoft Robotics Studio. They support quite a lot of hardware boards (including CE), and with it is is fairly easy to get a small robot up and running. And what's more cool a project to learn embedded programming?

It all integrates nicely in Visual Studio (express) and their devkit also comes with a free express edition.

Toad
  • 14,569
  • 13
  • 76
  • 125
  • irobot, fischertechnik, roombo, mindstorms, pioneer, etc... Best thing is you can just program in C#. And better yet, before buying a robot, you can simulate the whole thing and it's world in 3D. And when it starts to work, you buy the hardware and it should run with minimal tweaks – Toad Jan 26 '10 at 07:26
0

Get a beagleboard. Cheap, lots of users (community support will be key), many OS options. http://beagleboard.org/

ergosys
  • 43,069
  • 5
  • 38
  • 67
  • Beagleboard, how does it compare to Arduino? Seems like it is already a computer on Linux... am I right? Would programing this similar to writing a linux app? – Henry Jan 26 '10 at 00:44
  • Arduino is lower level, great for interfacing to hardware. That's why I think beagleboard is probably more approachable for someone not into hardware hacking. Example: http://letsmakerobots.com/node/11252 – ergosys Jan 26 '10 at 00:55
  • I see... programming Beagleboard is like programming a high end LEGO MINDSTORMS? – Henry Jan 26 '10 at 01:04
0

Well, if you want to know what you're doing, you need to understand the assembly language of the processor and the processor's architecture.

You will need to learn C to be competent in microcontrollers. There is no way around that.

There are some VM-level languages on embedded systems. I see the Java out-of-memory exception from time to time on my cell phone(which also helps to give me a strong opinion on VM-level embedded languages).

The ARM has some support for hardware-level Java bytecodes.

Your best bet is to pick up something like the PIC or the Atmel chips and begin hacking with them.

If you want to do it with your existing hardware, get a hypervisor for your PC and begin writing a basic kernel.

Paul Nathan
  • 37,919
  • 28
  • 110
  • 204