SROZ.net

Home » Building Mooltipass from source, Part 1

Building Mooltipass from source, Part 1

My first attempt at building the Mooltipass firmware from source didn’t go so well: There were a few defines that need to be modified in the source or provided in the Makefile to build for a particular target (Olivier’s design TODO: Link to design/pictures, v1). While writing this up, I found a simpler and slightly better way to build things properly, see commit 2856f843fda26f758c90c3a40778c70d53a1fbd6.

Even w/ the proper defines, it turned out that the version of avr-gcc in Ubuntu 12.04’s reposistories is much too old and doesn’t handle some specific tricks that MP uses to locate the executable outside of the DFU bootloader’s flash space. Trying to program the binary just gave me an error from the dfu program stating that I was about to overwrite the DFU bootloader. Next step? Build avr-gcc from source to get latest versions :-)

The avr-libc website has some excellent instructions for doing precisely this. I ended up following their instructions pretty much verbatim, using /opt/avr-gcc as my installation prefix. I download the latest stable version of each package:

  • binutils 2.24
  • gcc 4.8.3
  • avr-libc 1.8.0

Follows is a log of the commands I used:

export PREFIX="/opt/avr-gcc"
export PATH="${PREFIX}/bin:${PATH}"
###
### binutils
###
cd binutils*
mkdir obj-avr
cd obj-avr
../configure --prefix="${PREFIX}" --target=avr --disable-nls
make -j16
make install
###
### gcc
###
cd ../../gcc*
mkdir obj-avr
cd obj-avr
../configure --prefix=${PREFIX} --target=avr --enable-languages=c,c++ --disable-nls --disable-libssp --with-dwarf2
make -j16
make install
###
### avr-libc
###
cd ../../avr-libc*
./configure --prefix=${PREFIX} --build=$(./config.guess) --host=avr
make -j16
make install

[Edit] If you’re trying to build on OSX, Dimme has a nice write-up on how to use MacPorts to build everything.

Posted 2014-08-03T18:48:40-05:00