c4ev3 is a software package for programming stock-firmware LEGO® Mindstorms® EV3 in C/C++. The package contains a C API that exposes the hardware capabilities of the device, an uploader able to transmit the compiled binaries over WiFi/Bluetooth/USB and an Eclipse Plugin that integrates the two components into an easy-to-use development environment.
Binaries only provided for Windows. Source build works on Windows (MinGW), Linux and Mac OS X.
How to use
- Just run the c4ev3 installer. It includes the ARM GCC toolchain, Eclipse plugin and all the needed library headers and files.
- In Eclipse, File → New → Project.
- Choose Project type as "Hello World EV3 Project" and "Cross ARM/EV3 GCC" as the toolchain.
- Project can be run via the EV3 → Upload and run menu entry.
- If you want to run the executable later again, you can find it on the EV3 under SD_Card/myapps/
- Happy programming!
In order to compile C/C++ applications you will need the
arm-linux-gnueabi GCC (Both are the same thing). The symlink_cross.sh script with the ev3duder can be used to symlink the latter to the former.
- Windows users can get it via the CodeSourcery Lite package.
- Debian/Ubuntu's repositories offer the Linaro toolchain, but I couldn't get that to work. CodeSourcery to the rescue again:
$ wget -c http://www.codesourcery.com/sgpp/lite/arm/portal/package4571/public/arm-none-linux-gnueabi/arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 $ mkdir CodeSourcery $ tar -jxvf ~/arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 -C ~/CodeSourcery/ $ echo export PATH=~/CodeSourcery/arm-2009q1/bin/:$PATH >> ~/.bashrc && . ~/.bashrc
- Carlson-Minot Inc. provides binary builds of CodeSourcery's GNU/ARM toolchain for OS X.
If not done by the installer, you will additionally need to add the compiler to the PATH.To write somewhat useful programs, you'll want to link against the Sensor/Actor API, which can be built by a simple
The uploader requires a gnu99 compatible compiler, that is GCC 3.2 and above or compatible compilers. Any recent version of gcc, clang or icc should be able to compile it. MS Visual C++ isn't supported, due to the use of C99 features and GNU extensions. Also required is GNU Make.
You can get the source with git:
$ git clone --recursive https://github.com/c4ev3/ev3duderIf you haven't got git, you will have to download these seperately:
https://github.com/signal11/hidapi/archive/master.zipthen unpack the hidapi archive into the hidapi directory of the ev3duder extraction path.
Building is an easy
$ makeOn Linux, you additionally need libudev-dev to be installed. On Ubuntu and other Debian-based system this can be done via
$ sudo apt-get install libudev-dev. Also to allow access to the ev3 over USB without requiring root, appropriate udev rules must be created. This can be easily done with
$ make install.
The test/ directory contains some sample projects that do stuff on the EV3.
perl flash.pl Test_Motors uploads and executes the Test_Motors project.
The Eclipse Plugin
The plugin is packaged as a single .jar file, which just needs to be dropped into the Eclipse/Dropins directory.
Alternatively, change Eclipse's Workspace to the Plugin's source directory and build it yourself.
This project was originally written for use in the teaching of Informatics at the Hochschule Aschaffenburg.
The work is part of the EVELIN project, which is funded by the German Federal Ministry of Education and Research (Bundesministerium für Bildung und Forschung) under grant number 01PL12022B.
The authors are solely responsible for the content of this publication.
In agreement with the University, The project's components are released under their respective open source licenses.
Contribution or Contact
Feel free to open a bug report or pull request. You can also drop by at our Gitter channel if you got questions or want to tell us what you're doing with c4ev3! :-)