After maintaining CodeBlocks Arduino Edition, which is an out-of-box distribution for Windows only, for several months, I finally got everything to work on Linux. Thanks to Ubuntu that makes life a lot easier on Linux, I have the chance to get this done in one day. I put all my addons and tweaks on CodeBlocks IDE into a single downloadable package, so it’s easy for everyone to get this done from scratch. Here is a guide showing all the steps for setting up a productive Arduino development environment with CodeBlocks on a Linux box.
1. Install necessary packages
The packages we need to install are:
- Code::Blocks (the open-source IDE, why on earth do they like two commas in between)
- G++ (C++ compiler for host machine, used for building simulation target)
- GCC AVR (C/C++ compiler for AVR)
- GCC C library for AVR
- AVRDUDE (the AVR download/upload utility)
- CuteCom (a serial terminal program)
Yes, you don’t need to install Arduino IDE package. Hoping this won’t piss off the Arduino IDE developers. You can use Ubuntu’s Software Center to search and install all these packages, or you can simply pull in all these packages with one command line:
# sudo apt-get install codeblocks g++ gcc-avr avr-libc avrdude cutecom
After a confirmation prompt, these packages will be fetched and installed like a charm.
2. Get and extract the Arduino addon files for CodeBlocks
There are two ways to get the package which I put all my addon and tweaks in, either by downloading the release file or checking out latest files from subversion. You need to put all the files in ~/.codeblocks which is the user data directory of CodeBlocks.
# mkdir ~/.codeblocks # cd ~/.codeblocks # wget https://downloads.sourceforge.net/project/arduinodev/codeblocks-arduino-addons-20120606.tar.bz2 # tar jxvf codeblocks-arduino-addons-20120606.tar.bz2
As an alternative to the aboves, you can check out the latest code directly into .codeblocks directory if you have subversion installed.
# svn checkout svn://svn.code.sf.net/p/arduinodev/code/trunk/cbaddons ~/.codeblocks
3. Modify the CodeBlocks project wizard configuration script
This has to be done by an text editor. The file to be modified is located at:
You need to sudo to modify this file. Insert following line in the range of function RegisterWizards().
RegisterWizard(wizProject, _T("arduino"), _T("Arduino Project"), _T("Embedded Systems"));
Yes it’s done. Now launch CodeBlocks, click Create Project and you will see Arduino Project marked in red. You can then create a ready-to-build Arduino project by proceeding with the project wizard.
If you have any problems, please post them in this forum and let me know.