Trouble compiling brewPi Spark firmware [SOLVED]

I have troubles compiling brewPi Spark code.
I cloned “firmware” and “spark-firmware” repositories into the same folder.
I also downloaded and installed the required dependencies.
My machine is running Debian Wheezy 64-bits.

So, to compile I did the following:

cd firmware/platform/spark
make

(Note: the firmware/spark/ directory listed in the readme doesn’t exist… I guess it was a typo).

The terminal output is the following

make[1]: Entering directory `/brewpi/spark-firmware/main'
../../firmware/platform/avr/arduino/cores/arduino/WInterrupts.c:28:20: fatal error: avr/io.h: No such file or directory
 #include <avr/io.h>
                    ^
compilation terminated.
make[1]: *** [../build/target/main/prod-0/../../firmware/platform/avr/arduino/cores/arduino/WInterrupts.o] Error 1
make[1]: Leaving directory `/brewpi/spark-firmware/main'
make: *** [run_make] Error 2

Any clue what could be the problem? Am I doing anything wrong?
Is that normal that the makefile is trying to compile code for avr?

Thanks in advance for your help :smiley:

Can you try running make clean before running make?

I had already tried that, but after recompiling some of the file the compilation exits at the same point.
See terminal output here below.

GNU Make 3.81 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This program built for x86_64-pc-linux-gnu Reading makefiles... Updating goal targets.... File `all' does not exist. File `wiring' does not exist. Must remake target `wiring'. make[1]: Entering directory `/brewpi/spark-firmware/main' Successfully remade target file `wiring'. File `services' does not exist. Must remake target `services'. Successfully remade target file `services'. File `communication' does not exist. Must remake target `communication'. Successfully remade target file `communication'. File `hal' does not exist. Must remake target `hal'. Successfully remade target file `hal'. File `platform' does not exist. Must remake target `platform'. Successfully remade target file `platform'. File `elf' does not exist. File `../build/target/main/prod-0/../../firmware/platform/spark/targetbrewpi.elf' does not exist. File `../build/target/main/prod-0/../../firmware/platform/avr/arduino/cores/arduino/WInterrupts.o' does not exist. Must remake target `../build/target/main/prod-0/../../firmware/platform/avr/arduino/cores/arduino/WInterrupts.o'. ../../firmware/platform/avr/arduino/cores/arduino/WInterrupts.c:28:20: fatal error: avr/io.h: No such file or directory #include <avr/io.h> ^ compilation terminated. make[1]: *** [../build/target/main/prod-0/../../firmware/platform/avr/arduino/cores/arduino/WInterrupts.o] Error 1 make[1]: Leaving directory `/home/fleppi/prj/brewpi/spark-firmware/main' make: *** [run_make] Error 2

FYR, I’m on develop branch on both repositories.

You need to use the feature/hal branch for spark-firmware and I’d try the feature/sparktest branch for the firmware.

May I also suggest SourceTree as a git GUI?

SourceTree doesn’t exist for Linux :pensive:, but I’m using tig and it works ok.

FYI, this the content of my /brewpi directory

├── core-common-lib
├── core-communication-lib
├── core-firmware
├── firmware
└── spark-firmware

According to your last reply this is what I tried today:

cd ~/prj/brewpi/firmware/
git checkout feature/sparktest

So, I’m on 7161f3e commit for the firmware repository.

cd ~/prj/brewpi/spark-firmware/

The problem here is that there is no feature/hal branch.
Did you push it into the origin?

I can see some references to a feature/hal branch in the commit comments and I can see the branch in the core-firmware repository, but not in the spark-firmware repository.

I tried anyway different commits or branches in the spark-firmware repository

git checkout cca6791
git checkout brewpi
git checkout develop

But when I try to compile the code…

cd brewpi/firmware/platform/spark
make clean
make

… the error is always the same.

../../firmware/platform/avr/arduino/cores/arduino/WInterrupts.c:28:20: fatal error: avr/io.h: No such file or directory
 #include <avr/io.h>

:disappointed:

You don’t need the core-* directories. The feature/hal branch should include everything.

Get both spark-firmware and firmware from the BrewPi github.

Run make from firmware/platform/spark

make APP=sparktest

@mdma and I use Netbeans. I have a topic on the spark forum that explains how to set that up

Ok, looking at your instructions on the spark forum I found what I was missing.
I just didn’t have the official firmware repository as a remote.
Now that it’s added and the correct commits are checked out, the compilation works like a charm under my linux machine.

Thanks for the support and can’t wait to receive the BrewPi Spark hardware to start contributing! :grinning:

1 Like

If you’d like - a write-up of how to setup the various repos would be a great place to start contributing!

Good point mdma!

So here is a summary of the steps I did to get it to work on my pc running Debian:

Install git, make & tig (use tig --all to see all the commits and branches)

   sudo apt-get install git make tig 

Install the arm gcc compiler (latest version here). Check the readme for more details.

mkdir ~/bin
cd ~/bin
wget https://launchpad.net/gcc-arm-embedded/4.9/4.9-2014-q4-major/+download/gcc-
arm-none-eabi-4_9-2014q4-20141203-linux.tar.bz2
tar xjf gcc-arm-none-eabi-4_9-2014q4-20141203-linux.tar.bz2

I had also to install ia32-libs (may only be needed on 64 bits systems)

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install ia32-libs

Add gcc-arm to your path (add to your .bashrc file)

export PATH=$PATH:~/bin/gcc-arm-none-eabi-4_9-2014q4/bin

Create your brewpi working directory and clone the repositories into it.

mkdir brewpi
cd brewpi
git clone https://github.com/BrewPi/firmware.git
git clone https://github.com/BrewPi/spark-firmware.git

Repositories setup, last commits fetch and branches checkout

cd brewpi/firmware    
git fetch
git checkout feature/sparktest
cd brewpi/spark-firmware
git remote add spark https://github.com/spark/firmware.git
git fetch --all
git checkout feature/hal

Compile

cd brewpi/firmware/platform/spark
make APP=sparktest

Compiled code is in target/ directory

Enjoy :grinning:

Awesome! Thanks for the write-up.
I reached a little milestone myself today:

We are going to use eGUI for window management and the GUI in general.

Hey! That’s great Elco!
Looking forward to receive the hardware to see it with my own eyes! :grinning: