I am having trouble selecting a microcontroller/processor for a robotics project in C++. I have a program working on my computer that is 1.5+ KLOC and relies on data in twenty other files to function, so please do not suggest I use another language. I tried translating it to C, but could not get it to work, perhaps because of the program's heavy reliance on fstream and strings. The program is about 1 MB on my computer right now and takes up 3 MB while running, so I suppose the microcontroller/processor would need either to be capable of supporting 4 MB of ram if it is von-Neumann/MHA and 1 MB of flash and 3 MB of ram for Harvard. I need PWM, SPI and UART/USART on the processor to communicate with other sensors, and I plan to use a hard drive for the other files and external ram for the program and its data. I will need at least 90 IO pins (40 IDE + 40 servos + sensors).


  • >90 IO pins
  • PWM
  • SPI
  • if von-Neumann/MHA, capable of supporting >4 MB of ram
  • if Harvard, >1 MB program flash and >3 MB of ram
  • supports C++

What do you suggest? Please also provide information on how to program the processor, if possible.

So far, I have found Freescale’s i.mx25, but I am not sure how to connect this processor to my computer for programming, if it uses C++, or the details of how to turn my current Windows .exe program into a .hex compatible with this processor.

@m.Alin I am using a hard drive because I started out with AVR and found a tutorial describing how to communicate with an hdd from an AVR. I could not find a similar SD card tutorial.

@MikeJ-UK The program currently runs on my laptop, an x86-64 Windows 7.


"1MB binary implies more than 1500 LOC" The program is 643 KB now, not 1 MB. I apologize for the confusion. I said 1 MB because I am still working on and expanding the program, so the prospective processor will need to be able to handle its future larger size.

"add a peripheral board for the servos" "io offloading onto an FPGA..." I do not know how to do this. After a quick search, I was unable to find any affordable FPGA's. Do you know of any >$50?

@Rocketmagnet 1500 lines.

@vicatcu I do not think 8 io pins will be enough.

@AndrejaKo For the most part, the servos will not need to be controlled at the same time. I like your multiple microcontroller/demultiplexer option, but I do not understand what is wrong with using an i.MX25 with Linux? It has 128 io pins.

  • 3
    Also, it's not the processor that has to support C++, it's the compiler you use, which takes your C++ code and makes it in a .hex file – m.Alin Jul 6 '12 at 13:22
  • 2
    You can't just take the amount of RAM which the program needs on one architecture and assume that's how much it will need on another. The difference could be very big! Also trying to directly run your Windows program on something else will almost certainly not work without some major modifications. The correct way to do it would be to start developing directly on the platform. Right now you have a program which could very well be unportable. The least painful solution I see would be to try to port the program to GNU/Linux and find a processor that runs it. – AndrejaKo Jul 6 '12 at 13:42
  • 3
    Rasberry Pi perhaps? – vicatcu Jul 6 '12 at 13:58
  • 2
    You need to rethink what you're trying to do here. You sound really out of your depth. 1500 lines of code is not large (did you mean more? 1MB binary implies more than 1500 LOC). 40 servos is a LOT to control from a micro without something like an FPGA. 99% of the time, you'd put Linux or CE on an iMX25 platform... not load code on it directly. The supporting ICs (DDR RAM, flash, etc) and the overall board design makes using that chip a task for a fairly advanced designer. What are you trying to do? – darron Jul 6 '12 at 14:27
  • 2
    @toran I do not want to sound rude, but the 1500 lines of code are the least of your problems here. That's practically nothing. You are currently describing the problems you're facing implementing your solution. Instead, I recommend that you present us the main problem of what you're trying to do. For example do servos all have to work at the same time? How precise control do you need? There are many cheap ways to control servos if they don't have to be constantly controlled or if they move in logical groups. – AndrejaKo Jul 6 '12 at 16:07
up vote 6 down vote accepted

This sounds like a job for embedded Linux.

  1. Persistent file system. Forget IDE (save yourself 40 pins) and go for a board that uses a flash card.
  2. More RAM and Flash. Typical embedded Linux boards have RAM in the megabytes.

As for peripherals, driving 40 servos could be a question here on its own. How are you doing this now? For the rest of your peripheral requirements, here's a board that seems to fit that has a good community as well:


The tool chain has a C++ compiler, it has SPI, UARTs, and even a PWM. This is what's being claimed in the PDF at least, you'll have to make sure that there are drivers for all those peripherals available to you at the application level for whichever distro of Linux that you put on. Hopefully the one they provide has everything you need.

So basically, if you can port whatever you've written to a Linux PC, there's a good chance you can port it to an embedded linux target. However, I'm willing to bet that if all you're using from C++ is <fstream> and <string>, you could probably do a C re-write and save yourself the overhead of Linux.

  • Thank you for your answer. I cannot forget IDE because I cannot find an SD card tutorial. I cannot afford the Beagle Bone. Do you know of any other embedded Linux boards? – user10708 Jul 6 '12 at 18:03
  • @toran, If you can get your hands on a raspberry pi, the lowest model is $25. It may not have the IO that you want as configured, but you should be able to expand it with various adapters and some creativity. These boards have a flash card slot on them and you can access files from it in Linux as a mounted drive. If you can buy SD cards wherever you are, you will be far better off using that than an IDE drive. – Jon L Jul 6 '12 at 18:37
  • 3
    If you can't afford the beagle bone then you absolutely can't afford to make a custom MX25 PCB. Please find an existing development platform of some kind (like the Pi as @Jon L mentions) The MX25 is a BGA chip, and a 0.8mm pitch BGA at that. I built a custom board based on the i.MX283 (same BGA package), and it cost $2500-$3000 to make 50 3x3" boards (or $1750+ to make 1). The small pitch requires advances processes (tiny vias, trace/space) that PCB manufacturers are going to charge a lot for... and it's totally beyond the reach of any home PCB process. – darron Jul 6 '12 at 18:50
  • @darron Thank you very much for pointing that out! I was not aware motherboards were that expensive, both to buy and to develop! I will transfer my program to Linux and use Raspberry Pi with an IO expander. You mention below "...prototyping card for it and expand it to handle the IO you need." Please provide more information. Is this something Raspberry Pi specifically sells or do you mean I will have to find IO expanders somewhere? – user10708 Jul 6 '12 at 19:05
  • Here's a link to a story mentioning a couple. Adafruit's is supposedly coming in about 5-10 days. hackaday.com/2012/07/05/… – darron Jul 6 '12 at 19:09

I would suggest getting a tiny PC, and using an IO expander to give you your 90 pins. There are a surprising number of really tiny PCs out there. They run Linux, and you can use gcc and gpp to compile code for them. Here are a few:

Picotux 100 <- Picotux 100

Cotton Candy PC <- Cotton Candy PC

Gumstix <- Gumstix

  • Thank you for your answer. I cannot afford the Gumstix. How much do the Cotton Candy and Picotux cost? – user10708 Jul 6 '12 at 17:59
  • 1
    It really sounds like the Rasberry Pi is the one for you. You can grab a prototyping card for it and expand it to handle the IO you need. There's no need for IDE or SD driver work, as it will have a full working OS (Linux) installed already with support for the SD. – darron Jul 6 '12 at 18:51
  • @darron - Yeah, I think the Pi is also a very good option. Not that easy to get hold of at the moment though. – Rocketmagnet Jul 6 '12 at 19:17

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.