Foculus Rift with STM32F3 Discovery on Yosemite – the Macintosh way to do it!

This is a follow-up to my earlier article which was my terribly confused way of modifying the instructions garnered from setting up flashing an STM32F3Discovery on Linux, and other instructions involving messing about with MacPorts and Homebrew with the F4 board on Mavericks from here, here, and here! (The last one is probably the most useful since we will need to return to Eclipse for all the compiling later on). I say ‘probably’ because Eclipse loves to throw errors on its own repositories, and I’ve just about given up on it.

Meanwhile, I started from scratch on a new installation of Yosemite 10.10 on my Dellintosh, and decided to eliminate the inessential bits to have the Discovery board recognised and flash with an .elf

Of course, there’s always an easier way with Mac!

First we’ll prep the installation with some Terminal magic:

  1. brew install mpfr gmp libmpc texinfo libusb-compat libftdi wget
  2. brew install openocd

    Then install Xcode command line tools:

  3. xcode-select --install

    Finally, for Yosemite we’ll need to fix the openocd installation, viz. the STLINK-V2 config hardware profile for the F3 Discovery. Homebrew installs it in

    /usr/local/Cellar/open-ocd/0.9.0/share/openocd

    Navigate to /scripts/interface and locate the script called stlink-v2.cfg.

    It looks like this (vim):

Screen Shot 2016-10-04 at 23.05.39.png

Now change the hla_vid_pid from

0x0483 0x3748

to

0x0483 0x374B

Ha! Now you can attach your Discovery board via USB, and check the connection. In the Terminal do this:

openocd -f /usr/local/Cellar/open-ocd/0.9.0/share/openocd/scripts/board/stm32f3discovery.cfg

You should get an output like this:

Screen Shot 2016-10-04 at 23.17.31.png

That’s it! Now we can flash our own .elf files to it!

Foculus Rift

The “Foculus” Rift is an open source version of the commercial Oculus Rift. The plan is to build my own head-mounted display at some point, and getting my hands on the Discovery board has only kindled the fire, as has this video of Ahmet Yildrim playing Portal with his DIY Rift:

Get Started

Download the project from Yetifrisstlama’s Github repository.

In a terminal, navigate to the Foculus Rift folder and run this:

openocd -f /usr/local/Cellar/open-ocd/0.9.0/share/openocd/scripts/board/stm32f3discovery.cfg -c init -c"reset halt" -c"flash erase_sector 0 0 127" -c"flash write_image stm32f3_HID_for_real.elf"

The Foculus Rift will be flashed and when you reconnect the board via USB USER, you’ll see a glorious display of circling colors on the LED!

The System Report shows it as Tracker DK, Manufacturer: Oculus VR, Inc. :

Screen Shot 2016-10-04 at 23.37.37.png

Further reading:

  1. Check this awesome list for more tools for embedded programming on the Mac.
  2. Here again is the Hackaday link to the overview of the OpenVR project.
  3. Check out Yetifrisstlama’s further blog posts on the Foculus – part 2 here and part 3 here.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s