6
\$\begingroup\$

Can somebody make me a recommendation of some stable development environment (platform + programmer device + sw/ide) for beginning programming microcontrollers under linux (not arduino)?

I find it difficult to pick all this components, and I'm afraid I'll have to resort to windows. Thanks!

Update: Thanks for your answers! I'll give Microchip and Netbeans based MPLAB a try. Nothing against Atmel, but I think the former will be easy to setup for me;-)

\$\endgroup\$
2
  • \$\begingroup\$ Sadly, I have to admit I use Microchip's MPLAB under Virtualbox in Windows XP when programming on Ubuntu. It works. I'll be switching to MPLAB X soon. \$\endgroup\$
    – Thomas O
    Oct 4, 2011 at 7:00
  • \$\begingroup\$ My development system described here: electronics.stackexchange.com/questions/10580/… \$\endgroup\$
    – markrages
    Oct 4, 2011 at 15:54

8 Answers 8

6
\$\begingroup\$

Microchip has a new MPLAB X using the NetBeans platform that installs under Linux, either 32-bit or 64-bit. It is still under beta release, but has been out for awhile now, and has support through their forums.

You can develop for any of the Microchip MCU lines, PIC10/12/16/18 (all 8-bit), PIC24 (16-bit), or PIC32 (32-bit). I would recommend starting with at least the PIC18 line -- the smaller ones are best programmed with assembler, and it's much easier to start with C.

You can get "lite" versions of the compilers for free (the main limitation is that some optimizations expire after 60 days, but there is no code limit like some development systems).

Microchip has a combined development board/programmer -- MPLAB Starter Kit for PIC18F MCU that costs $60. It includes USB communication, a capacitive touch pad, potentiometer, acceleration sensor, MicroSD memory card, and an OLED display.

\$\endgroup\$
4
  • \$\begingroup\$ Thanks! Also heard of MPLABX, but thought it was still not usable. Why do you think its better to start with PIC18 instead of 16 line? \$\endgroup\$
    – grieih
    Oct 4, 2011 at 20:01
  • \$\begingroup\$ The PIC18 is an improved version of the PIC16. In particular it has a real data stack with a frame pointer, so that the instruction set is much more friendly to C compilers. I just finished doing a PIC16 project (the processor was picked by my client before I came on board), and I ended up writing the entire application in assembler. \$\endgroup\$
    – tcrosley
    Oct 4, 2011 at 21:57
  • \$\begingroup\$ From what I see listed on Mouser/Digikey the PIC16/18 series are all 8-bit MCUs and PIC24 is where the 16-bit parts start. \$\endgroup\$ Jul 18, 2016 at 22:49
  • \$\begingroup\$ @Captainj2001 thanks for the correction. In my previous comment, I had said the PIC18 is an improved version of the PIC16 (which is also 8-bit), but I see in my answer I refer to it as 16-bit. I'll correct that. \$\endgroup\$
    – tcrosley
    Jul 18, 2016 at 23:48
8
\$\begingroup\$

I've had good success with Atmel AVRs using:

  • the GCC C compiler with AVR libraries (packaged in APT for Debian based distros)
  • avrdude for flashing devices (using a cheap Atmel AVRISP mkII programmer)
  • AVR Eclipse plugin for an IDE

Googling will find some guides on setting it all up under a recent Ubuntu install. It's a lot easier than it used to be, it's now pretty much just installing packages from the repos.

\$\endgroup\$
3
  • \$\begingroup\$ Thanks for your answer. Are those AVRISP programmers enough to start getting in touch with AVR micros or is more hw needed? \$\endgroup\$
    – grieih
    Oct 4, 2011 at 19:56
  • \$\begingroup\$ The AVRISP micros and a simple breadboard power supply are all you need to get an LED blinking. For $50, though, the AVR Dragon is worth every penny. \$\endgroup\$
    – Zuph
    Oct 13, 2011 at 17:03
  • \$\begingroup\$ Sorry @grieih, I missed your comment. As Zuph says, it's simple on the hardware side, just the programmer and power supply needed. Here's a good reference on the few pins you need to hook up for programming: evilmadscientist.com/article.php/avrtargetboards \$\endgroup\$
    – Al Bennett
    Oct 18, 2011 at 9:10
3
\$\begingroup\$

If you wish to work in C, you can check out either SDCC or the list of supported GCC cross-compilers. There is a long list. If you wish to work in assembly, most of the 8-bit micros have well supported Linux tools e.g. gputils.

As for programming devices, most of the newer micros these days come with built-in boot-loaders that no longer require purchasing any expensive programming device. Otherwise, you can always build one yourself. For the PIC, there's the PICKIT2, which comes with schematics.

As for the IDE, you can just use emacs or eclipse in general.

\$\endgroup\$
1
  • \$\begingroup\$ SDCC would be awesome, but sadly, it supports only some devices. Great, if your device is in it's list; not so great when you migrate to a chip with slightly more RAM and suddenly have no support for it. Can even try this on Windows with gputils, and even in MPLABx with the SDCC toolchain, however that is "experimental" at best. \$\endgroup\$
    – rdtsc
    Jul 19, 2016 at 14:59
2
\$\begingroup\$

You should be able to get a development environment set up for the TI/Stellaris ARM Cortex M3 parts using arm-eabi-gcc to compile code and OpenOCD for flashing and debugging on the target board. I have done it all on Mac OS X so I can't give you a straight how-to but I did a couple quick Google searches and it looks like there are plenty of setup guides out there. Honestly it's kind of a pain and you'll probably have to do some fiddling to get everything working even if you get a great setup guide, but once everything is configured the workflow is pretty good. You should also be able to use Eclipse as an IDE and configure it to load your binaries onto the board automatically if you are so inclined. The Stellaris line are great parts too.

\$\endgroup\$
4
  • 2
  • \$\begingroup\$ It is possible, but not nearly as easy as setting up an environment for AVR. I know because I'm just doing it for an LPC17xx ARM Cortex M3. \$\endgroup\$
    – starblue
    Oct 4, 2011 at 10:30
  • \$\begingroup\$ There's a straight how-to for Mac OS X which I've used here for the Stellaris parts. \$\endgroup\$ Oct 4, 2011 at 10:51
  • 1
    \$\begingroup\$ @starblue - The OP said "not Arduino" so I figured AVR was out. Maybe he's cool with plain AVR but AVR is weak compared to ARM Cortex parts. Of course it depends on your application and an M3 would be overkill in a super-simple mass-produced device, but for a hobbyist setting out to learn micros you get a lot of power and features with an ARM part. The advantages of AVR as Arduino are the tools, community and accessories, so if you don't want the whole Arduino package, might as well pass on AVR. \$\endgroup\$
    – Suboptimus
    Oct 4, 2011 at 18:10
2
\$\begingroup\$

The Eclipse IDE is Java based, so works fine under Linux. There is a plugin for the IDE available that supports C/C++ development for AVR microcontrollers and also allows you to upload compiled code to the device via a variety of programmers.

\$\endgroup\$
2
\$\begingroup\$

I have a number of linux based embedded microcontroller examples at github https://github.com/dwelch67. Note the ide is your favorite text editor and a command line where you type make.

Note the free tools for microchip (pic32) (not the ones FROM microchip) have optimization, 16 bit instruction set support, etc. And you get to see what is going on (cause you are doing it yourself). These of course being the mainline gcc and llvm (not the ones from microchip).

The mbed or stellaris are probably more along the lines of what you want. Or arduino like go with the maple perhaps. I hate to say maybe the fez panda. The msp430 launchpad is $4.30, at that price might as well buy a couple to save for a rainy day. The stm32 value line discovery is around $10, same deal get one save it for a rainy day.

If you let the libraries and environment do all the work for you then its no different than just writing applications on your desktop computer, a bit of a waste of time going embedded, just write desktop apps. If you go with embedded you should roll up your sleeves and get your hands dirty...something to think about...Otherwise just buy the arduino and get it over with. Atmel is hard to touch for customer satisfaction, not sure why but it is what it is. The avr instruction set is not great, nowhere near as bad as the PIC (not counting the PIC32) but not as good as the msp430 or ARM instruction sets. I have used the arduino ide on linux, likely wont need to reboot to windows. There isnt anything as easy as the arduino except maybe the BASIC based stamps like parallax and some others.

As with linux/unix development in general, dont focus on looking for an IDE. Focus on the compiler, gcc or llvm, then your favorite editor and thats it, start coding. Apply that to a microcontroller and look at the targets the compilers support. ARM and MIPS are a natural fit, you wont have any problems getting the tools up and running, any time you are taking a patched gcc versions and trying to make that work on your up to date Linux box you are going to struggle from time to time, avr, msp, and pic fall into that category. Same goes for sdcc, it is hit or miss, and anyway you have to ask yourself: C on the 8051? Not as bad as C on the PIC but close. If you are really looking for a polished, supported, up to date, stable IDE, etc, you have to go to windows. Keil, IAR, Code Red, etc. The demand just isnt there, linux/unix developers historically spend their time arguing vi vs emacs as those are the dominant ides for lack of a better term. throw in gdb if you get desperate.

\$\endgroup\$
3
  • \$\begingroup\$ This is the problem with Linux, the only option is GCC. And there will only be reliable, maintained GCC ports for the most hyped, mainstream MCUs. \$\endgroup\$
    – Lundin
    Oct 14, 2011 at 11:23
  • \$\begingroup\$ llvm is catching and passing gcc, and is by default a cross compiler. It may someday be a boat anchor, also, but for now it is not. The msp430 port took less than 24 hours so they say. \$\endgroup\$
    – old_timer
    Oct 14, 2011 at 11:44
  • \$\begingroup\$ Thanks for your answer, @dwelch! My principal concern here is finding a suitable programmer board supporting linux developments, but I thought an IDE could free me from putting all the necessary software pieces together, at least at the begining. \$\endgroup\$
    – grieih
    Oct 14, 2011 at 15:56
2
\$\begingroup\$

Programming PIC Microcontrollers in Linux is prety easy. I have a Pickit2 Clone, MPLAB X IDE, And QPickit which uses pk2cmd as backend. I have programmed dsPIC33 without problems with this programmer. To program your device:

  1. Build your project on MPLAB X. In the output window, the .hex file path will be shown. For example: /home/user/MPlabx_projects/Test/dis/default/production/test.hex
  2. Copy that route and use pk2cmd -p -f /home/user/MPlabx_projects/Test/dis/default/production/test.hex -m -r
  3. Your device will be detected automatically, then programmed and the MCLR will be released to start operation.

Remember to choose the correct voltage in your pickit. For dsPIC33 is 3.3V generally. You can choose it from your pickit2 clone, selecting the correct jumper. Also, you can power your MCU from a independent power supply of 3.3V, and use the default settings on pk2cmd.

If you want, you can use QPickit. Is a QT based application to program pic microcontrollers with a very simple and useful interface. I will load the program sources in the next days.

Download pk2cmd from here

\$\endgroup\$
2
  • \$\begingroup\$ Welcome to EE.SE! Thanks for the informative answer. You may want to update your link(s) to be for the Microchip software download page, not the direct download link, so that future users can see updated versions of the software immediately. \$\endgroup\$ Jul 19, 2016 at 0:17
  • \$\begingroup\$ Updates made. Link changed to the PICkit 2 Development Programmer/Debugger archive page. \$\endgroup\$
    – GTRONICK
    Jul 19, 2016 at 13:01
0
\$\begingroup\$

Good recommendations,And if you want to try ARM architecture you have even more choice:

  1. LPC ARM cortex m0~m4 MCU families from NXP by LPCXPRESSO(eclipse & gnu based presetted IDE) as one of best choice ,based on LPCOPEN libraries & LPC-LINK2 debauger
  2. STM32 ARM cortex m0~m7 MCU Families from ST BY setting & configuring eclipse & gnu gcc (as i believe you can set this one for any other ARM chip ,but there are plenty of template project & libraries for stm32) with SPL or HAL libraries & ST-LINK debauger
\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.