Kwabena W. Agyeman edited this page Aug 15, 2018 · 34 revisions

Hi, thanks for being interested in installing the OpenMV Firmware Development Environment. This guide will cover how to install the development environment on Windows, Mac, and Linux.

If you are looking for information on how to use the OpenMV Cam from the python level interface please see our forums or docs. This page is for low-level firmware programming info.

Windows Installation

Okay, I lied, there's no Windows development environment. Instead you can install Ubuntu on a virtual machine running on your windows machine:

  1. You can get VMware Player for free here to run Ubuntu. Or, you can get VirtualBox here. Both options are free, but, I've never used VirtualBox so I can't vouch for it. VMware player is great however.
  2. Download Ubuntu here. Then use whatever virtual machine software you installed to install the operating system. VMware Player makes this easy with a automated install option where it will install everything for you without you having to do anything other than enter your name and password initially.
  3. Install any updates, etc. for your operating system. Also, if you're using VMware Player make sure to install VMware Tools so you can drag and drop files between your Windows desktop and Ubuntu desktop.

Mac Installation

Okay, I lied, there's no Mac development environment. Instead you can install Ubuntu on a virtual machine running on your mac machine:

  1. You can get VMware Fusion (paid) here to run Ubuntu. Or, you can get VirtualBox here. VirtualBox is free, but, I've never used VirtualBox so I can't vouch for it. VMware Fusion is great however.
  2. Download Ubuntu here. Then use whatever virtual machine software you installed to install the operating system. VMware Fusion makes this easy with a automated install option where it will install everything for you without you having to do anything other than enter your name and password initially.
  3. Install any updates, etc. for your operating system. Also, if you're using VMware Fusion make sure to install VMware Tools so you can drag and drop files between your Mac desktop and Ubuntu desktop.

Linux Installation

Open a terminal and run the following commands:

sudo apt-get remove gcc-arm-none-eabi
sudo apt-get autoremove
sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
sudo apt-get update
sudo apt-get install gcc-arm-embedded
sudo apt-get install libc6-i386
sudo apt-get install python2.7 python-dev python-pip
sudo apt-get install libusb-1.0-0 libusb-1.0-0-dev
sudo apt-get install python-gtksourceview2
sudo pip install numpy pyserial==2.7 pyusb==1.0.0b2 Pillow
sudo apt-get install git

This should install all the libraries and stuff on your computer. If you get an error Google for the solution. You also need to install OpenMV IDE which you can download here. Anyway, next you need to install the OpenMV GitHub Repo. First, cd in your terminal to a place where you want to put the repo then:

git clone --recursive https://github.com/openmv/openmv.git
cd openmv/udev
sudo cp 50-openmv.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo adduser (username) dialout

Then log back out and log back in again. You should be ready to go now with the Firmware Development Environment.

If you're interested in submitting code fixes back to us you'll need to fork our repo first and clone your fork so that you can send pull requests. You need to fork these two repos:

https://github.com/openmv/openmv.git
https://github.com/openmv/micropython.git

If you are forking and cloning your own micropython repo in /src make sure to checkout the openmv branch:

git checkout openmv

Please follow this guide here for how to set the upstream repo after doing the fork so you can get our updates and see this here for how to merge our updates into your fork. You need to do this for both repos. Anyway, we'll only accept pull requests for a few files at a time. So, make sure that your edits are concise.

Qt Creator Installation

Alright, so if you're a VIM or Emacs user skip this section. If you're not, or you're looking for something new download QtCreator here. QtCreator will give you a great development environment to work with on Linux.

I have the complete Qt Development Environment installed on my Linux machine. If you just install QtCreator without the Qt Libraries you may run into Kit issues. Just Google for how to setup a GCC kit on Linux for QtCreator to get around these issues.

After installing QtCreator open it up and:

  1. Go to File -> New File or Project... -> Import Project -> Import Existing Project - a dialog box will then popup.
  2. Set the project name to openmv and the location to openmv (the git repo you just installed) and then click Next.
  3. QtCreator will scan the Repo for all the source files and let you select which files to be part of the project. Set Show files matching: to * and clear Hide files matching:.
  4. Hit Apply Filter and then click Next.
  5. Finally, hit the Finish button. Also, notice that QtCreator has automatically detected that the project is a Git Repo. However, we don't want QtCreator's project files added to Git Repo, so, please switch the Add to version control: combo box to <None>. Then click Finish. If QtCreator crashes on you after this go to Options -> Build & Run -> Kits and make one of the Auto-detected kits the default by clicking Make Default.
  6. Next, we really don't want to see *.config, *.creator, *files, and *.includes files in the Repo. So, please open up a terminal and execute the following commands:
echo "*.config" >> ~/.gitignore_global
echo "*.creator" >> ~/.gitignore_global
echo "*.files" >> ~/.gitignore_global
echo "*.includes " >> ~/.gitignore_global
echo "*.creator.user" >> ~/.gitignore_global

This will make sure these files don't show up in the Git Repo without you having to modify the .gitignore file in the Repo. Note: We may change our mind on QtCreator files being in the repo in the future so as to make this setup process easier. The above ignores are completely undoable by just removing the .gitignore_global in your home directory. Anyway, for now, QtCreator is just something I (Kwabena) am using to develop with. You may like it too.

  1. Next, click on Projects in the left hand sidebar. Add /src to the Build directory.
  2. Under make arguments add TARGET=OPENMV3 to build for the OpenMV Cam M7 (or TARGET=OPENMV2 to build for the OpenMV Cam M4). If you don't add this the firmware is built for the OpenMV Cam M4 by default.
  3. Then switch over to the Run Tab (top area) and go to the Run configuration area on the same page. Add a Custom Executable option. For the executable write /home/(username)/openmvide/bin/openmvide if you installed OpenMV IDE to the default location. This will allow you to launch OpenMV IDE from Qt-Creator which has the boot loader we'll use to program your OpenMV Cam.
  4. And... that's it, you're all setup now.

Okay, so now go back to the edit pane by clicking the Edit button on the left hand side bar. Feel free to explore the and play around with QtCreator - it's a very powerful IDE. Next, click on the Hammer icon on the bottom left hand corner. This will build all the code. If there's a problem building the firmware the IDE will automatically find all of the sections of the code with issues and take you exactly to the file with the problem when you clicking on the issue in the issues pane. When you're ready update the firmware click the Run button (green arrow) and this should launch OpenMV IDE. From there you can use OpenMV IDE to update the firmware and then test your changes.

There are two ways to use OpenMV IDE to update your firmware, either through BIN files or DFU files. Both binary file types are generated by our build system. To update your firmware go to Tools -> Run Bootloader in OpenMV IDE. Then browse for the openmv/firmware/openmv3 (or openmv2) directory and select either the firmware.bin file or the openmv.dfu file. If you're lucky (you may not be if you are on a VM) then OpenMV IDE should be able to re-program your OpenMV Cam using our fast bootloader using the firmware.bin file. If you aren't luckily (because you're using a VM) then OpenMV IDE won't be able to connect our our bootloader in time to update the firmware. In this case you have to use DFU then (which is slooow). So, select the openmv.dfu file instead and load this onto your OpenMV Cam. Note that you have to put your OpenMV Cam into DFU mode first by attaching a jumper between the BOOT and RESET pins. OpenMV IDE will walk you through the steps you need to do for either firmware programming case.

As a note, here's some info about the binary files generated:

  • bootloader.bin -> Pure binary of the bootloader (no firmware) - intermediate output.
  • bootloader.elf -> Raw ELF file output from compile - intermediate output.
  • bootloader.dfu -> DFU file of the bootloader - not useful.
  • firmware.bin -> Pure binary of the firmware (no bootloader). OpenMV IDE's BIN loader uses this.
  • firmware.elf -> Raw ELF file output from compile - intermediate output.
  • firmware.dfu -> DFU file of the firmware - not useful.
  • openmv.bin -> Pure binary of the bootloader+firmware - intermediate output.
  • openmv.dfu -> DFU file of the bootloader+binary. OpenMV IDE's DFU loader uses this.

Anyway, to end this section - QtCreator is awesome. I love the IDE. You're going to love the fact that it indexes the whole project and makes it super easy to edit the code. The IDE has a ton of features. I implore you to explore the menus, options, and click on everything to see what the IDE has to offer. Your ability to navigate through the code will be greatly increased with QtCreator.

If you notice the IDE has a green line under includes this means you need to add the directory that include is starting from to the include path. Micropython always processes includes from the top level source directory which has no files in it so OpenMV IDE usually doesn't automatically add that directory to the search path.

OpenMV Development

I hope you read the above section. It automates all this for you using QtCreator. Anyway, you need to use OpenMV IDE to load firmware onto your cam if you want to program it. Please see the last section on using QtCreator (directly above).

OpenMV Releases

If you want to use released firmware versus code that's on the bleeding edge of development then do git checkout (tag) to checkout a versioned firmware release. For example git checkout v2.5 will point your Repo Clone to that release. Then, once you've done this you can follow all the above steps like normal. When you're ready to switch back to the main firmware branch do git checkout master.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.