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
Flashing Firmware with MDK Utility
Flashing the firmware can be done in two ways, using the MDK Utility Android App (APK) which can be downloaded from the MotorolaMobilityLLC github repository or the Google Play Store. Or you can use OpenOCD to flash bootloader and firmware. We will use the Android app method.
In order to flash using the MDK Utility on the Motorola Z Droid. We need to check some parameters in our configuration. Enter:
$ cd ./nuttx/nuttx
$ make menuconfig
Once executed, a text based menu system in the terminal will pop up showing you the config menu. Navigate to the “Device Drivers” menu and make sure the parameters below are checked. Leave all other settings how they are, when finished, exit.
Device Drivers -->
Greybus support (GREYBUS [=y])
[*] Mods Protocol
[*] Support APK update of firmware
Now back in the terminal, we need to compile the bootloader, enter
$ cd /home/username/MotoModsFirmware/muc-loader
$ ./configure hdk/developer
$ make
This will create a file called ‘defconfig’, in the ./MotoModsFirmware/muc-loader/configs/hdk/developer directory. We need to check this file for a similar parameter.
CONFIG_GREYBUS_MODS_SUPPORT_VENDOR_UPDATES=y
Open the file using the explorer or terminal and the last parameter should be ‘y’. As highlighted below:
Close file, and plug in phone. We will transfer the generated firmware executable file to the phone so that the MDK Utility can flash it to the MuC. This can be also done but loading it onto an SD card and plugging that into the phone.
The device will show in the file explorer
Make sure the phone is in File Transfer Mode (MTP)
Navigate to ./MotoModsFirmware/nuttx/nuttx, where the output files were generated. We will ‘Copy To…’ the “nuttx.tftf” file to the phone. Lets save it in the /Downloads directory
Hit Select
Now that the .tftf file is on the phone we are ready to flash using the MDK Utility
On the phone, open your MDK Utility app
In the Mode section, make sure you are in “Developer mode” for firmware flashing. If not, hit “SET MODE” and select, “Developer Mode”.
Click “SELECT FILES” and navigate to the ‘./Download’ folder we saved the .tftf file on the phone.
Select “nuttx.tftf” and hit “PERFORM UPDATE”
Click Continue
Now the firmware is flashed, you can see that the firmware is a Blinky program that tests the built-in LED on the Reference Moto Mod. The LED is located above the personality card slot. You can toggle the “MDK LED Light” switch to turn on or off the blink. The light should illuminate for 1 second ON and 1 second OFF. You can Eject/unmount and unplug the phone.
Ta-da!