Western Carolina University Kilobots

Tip: local compiling

Compiling using your local compiler instead of the online compiler at kilobotics.

Note in Oct 2017: The online compiler is no longer working as the Dropbox has upgraded, and it is no longer compatible with the previous setting of the online compiler. The local compiler is essential now. Here is a step-by-step illustration on how we can compile in our local compiler. We use Atmel Studios 7.0 here, and you could use any other compiler you like.

Step 0: Download WinAVR and install it. Its installation folder is typically at the C: root drive.
An important tip for Windows 8 and 10 users:
The newer Windows systems are not compatible with WinAVR, and you need to follow the advice at this discussion board to download the older version of msys-1.0.dll. The link provided at the discussion board will allow you to download a zipped file, and you need to unzip it and copy it to the utils\bin directory of WinAVR.

Step 1: Download the Kilobotics libraries from the Kilobotics website. You will be given a link at GitHub, and you need to download the entire folder as a single zip file. Unzip it in a local folder of your choice on your computer.

Step 2: Open Atmel Studios 7.0, and start a new project:

Step 3: Choose a project of “C Executable”, and choose the processor “Atmega328P”. Remove the automatically-generated main.c file, as the blank.c file from the downloaded folder has a main() function in it already. Only one main() function is allowed in a project.

Step 4: Include the files you have downloaded from Kilobotics (every file except the Makefile) as existing items into the project (do not add them by “add a library” menu), and your solution should include the following files in the red box below, with their icons to be shown as c file or h file but not rectangles.

Step 5: Click the menu “Project” -> “Properties” and go to “Build” tab. Check “Use External Makefile” and browse to the Makefile in your downloaded and unzipped folder from kilobotics. Leave the rest of the options by default: “Build Commandline” is “all”, and “Clean Commandline” is “clean”.

Step 6: Open the file blank.c from within this solution, and build the solution (I named the solution as Kilobot).

Step 7: Use explorer to go to the folder where your solution is, and enter the “build” subfolder, then you should see the hex file that you can upload to Kilbots. Sometimes the “build” folder could be in the same folder as your Makefile, or the unzipped kilobotics folder. Find where it is and the hex file is inside this build folder. Atmel Studio does exactly what the online editor does but now you don’t have to rely on internet, and you could update the libraries and so on.