Index of the Moto Mods Developer project:
Moto Mods Developer Part 1 - Getting Started - Virtual Machine Setup and Linux Install
Moto Mods Developer Part 2 - Getting Started - SDK Setup & Android Studio Install
Moto Mods Developer Part 3 - Firmware Setup
Moto Mods Developer Part 4 - Getting Started - Make Build-Folder, add Utility and OS files
Moto Mods Developer Part 5 - Flashing Firmware with MDK Utility
Moto Mods Developer Part 6 - Blinking an LED on the Moto Mods Perfboard
Moto Mods Developer Part 7 - Modifying the C file for the perfboard LED
Moto Mods Developer Part 8 - Configure Nuttx
Moto Mods Developer Part 9 - Updating the Hardware Manifests file
Moto Mods Developer Part 10 - Cont’d Configure and Compile Nuttx
Moto Mods Developer Part 11 - Load newly created Nuttx Firmware onto Reference Board
Moto Mods Developer Part 12 - Soldering the Test Points to use the perfboard
Moto Mods Developer Part 13 - Making custom App to control the Firmware
Be sure to see Part 1 of the Moto Mod Developer series, click this link.
Then see Part 2 after this link.
A wrong move means bigtime headaches. Follow it exactly. Then come on back here.
In order to build and compile the firmware we need to setup Ubuntu for USB/FTDI Libraries, OpenOCD, and GDB. Then install each utility, respectively.
Setup Ubuntu for Firmware building
In Ubuntu terminal type,
$ sudo apt-get install -y git gperf flex bison libncurses5-dev gcc-arm-none-eabi python-pip
$ sudo pip install pyelftools
This will install Ubuntu's package management system used for building the flashing and debugging tools.
Install USB, FTDI libraries, and OpenOCD for USB JTAG emulation
This tool allows us to flash the firmware to MuC and debug it with GDB. This is using the USB C cable plugged into USB C slot #1 on the side of the Reference Moto Mod, which is used for programming/debugging.
$ sudo apt-get install -y libusb-1.0-0-dev libftdi-dev libtool autoconf texinfo
$ git clone https://github.com/MotorolaMobilityLLC/openocd
$ cd openocd
$ git submodule init
$ git submodule update
$ ./bootstrap
$ ./configure --prefix=/usr/local
$ make
$ sudo make install
$ cd -
Note: If you are using Ubuntu 16.10 or later, you will need to install gcc-5 (sudo apt install gcc-5) and add "CC=gcc-5" to the above ./configure statement. This is only required for OpenOCD.
This will install libUSB and libftdi.
libUSB is a C library that provides generic access to USB devices
libftdi is an open source library used to talk to FTDI devices
Since OpenOCD uses the USB, we need to grant permissions to your linux username so it can use the FTDI. Enter the commands below in terminal:
$ id -u -n
$ sudo -s
# echo 'SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", MODE="0666", OWNER="<user name>"' >> /etc/udev/rules.d/20-ftdi.rules
# udevadm control --reload
# exit
Install GDB for low-level Debugging
The MDK provides utilities for using GDB, we will install with the commands below:
$ sudo apt-get install -y libexpat1-dev zlib1g-dev guile-2.0-dev python2.7-dev
$ wget http://ftp.gnu.org/gnu/gdb/gdb-7.11.tar.gz
$ tar -zxf gdb-7.11.tar.gz
$ cd gdb-7.11
$ ./configure --prefix=/usr/local --program-prefix=arm-none-eabi- --target=arm-none-eabi --with-python --with-guile
$ make
$ sudo make install