Documentation‎ > ‎Development‎ > ‎

Working with ArduMY™

ArduMY™ is an optional subsystem of OctoMY™ that allows you to control robots using Arduino devices.

In this page we will focus on how to practically go about working with ArduMY™. Please see here for an architectural overview and more in-depth description of this subsystem.

Makefile for Arduino
Before we can work with ArduMY™ we need to know a few things about how it is built. Normally when working with Arduino, you would simply install and open the Arduino IDE and type your code there.

Since OctoMY™ is a Qt5 based project, we naturally use QtCreator for development. So how does this mix with Arduino IDE?

The answer is throught a Makefile that comes with Arduino IDE that allows for building any Arduino project from command line using the tools and programs that come with Arduino IDE without having to use the IDE at all.

If you want to set this up for your own nonOctoMY™ project, I can recommend the following two excellent links which together were the inspiration for how it was set up in OctoMY™:
  1. Create a new folder
  2. Put all your your .c, .h, .cpp and .hpp files in the folder
  3. Make a new file called "Makefile" in the folder
  4. Put a few lines in the Makefile as seen in this example
As you can tell by looking at the example, what you really do is just specify which arduino board you want to build for, which libraries to include (the same that are available from inside Arduino IDE) and finally you include the "magic" Makefile that just makes the rest work by itself. You need of course to adjust all these 3 things to suit your project. So if you are on mega instead of uno, put that and if you use AccellStep library, put that. Finally, the path to the magic Makefile must be correctly specified or else this will not work at all.

Makefile for Arduino in OctoMY™
Now that you know the basics of building Arduino projects with Makefiles, we can go to the next step which is explaining how this has been integrated into the OctoMY™ build.

There are in fact two ways in which this has been integrated;
  1. Custom kit in QtCreator
  2. Docker build script
Custom kit in QtCreator
This is not necessary to set up for just building OctoMY™, but if you are making changes to ArduMY™ itself, then it is highly recommended because it has a very short turn-around time compared to the docker build script.
It is not very user friendly right now, but this will be improved in the future. You will have to look at the file under OctoMY/integration/ and transfer the useful bits over to your own file. Once this has been done, new build, run and deploy steps will become available that allow you to simply build ArduMY™ directly from QtCreator and upload the changes directly to a mounted board.

Docker build script
The docker build script is how the releases of OctoMY™ are built. Basically it is a bash script that generates a Dockerfile for each unique version of Qt5 and host/target hardware that you wish to build for. When each Docker file is run, it will simply produce the artifacts for it's inherent configuration. Please see the dedicated page to learn in more detail how the Docker build script works.

The Dockerfile that builds ArduMY™ artifacts can be created by invoking the build script with
  • target_os=arduino
  • target_ver=arduino version (1.8.7 for example)
  • target_arch=arduino core (avr for example)
The Dockerfile will then install Arduino IDE, and construct a Makefile that includes all the code for the ArduYM build. The code contains preprocessor macros to facilitate the necessary conditional build for each target board.

The build will be invoked for each of the boards in the list of supported hardware, producing a set of binary artefacts that fit with the respective supported hardwares.

It is a goal for the future of ArduMY to be able to dynamically build and dispense firmware for all supported targets. This means that we must work on build architecture. One approach is to intern avrdude and make online service for dynamically building the firmware. I am no fan of this approach because I think dependence on online services is not good. Next step is to make some kind of embedded infrastructure based on gcc/clang that can enable us to build to our supported arduino targets from OctoMY itself.

But this will most likely require a lot of work.