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:
brew install mpfr gmp libmpc texinfo libusb-compat libftdi wget
brew install openocd
Then install Xcode command line tools:
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
Navigate to /scripts/interface and locate the script called stlink-v2.cfg.
It looks like this (vim):
Now change the hla_vid_pid from
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:
That’s it! Now we can flash our own .elf files to it!
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:
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. :
- Check this awesome list for more tools for embedded programming on the Mac.
- Here again is the Hackaday link to the overview of the OpenVR project.
- Check out Yetifrisstlama’s further blog posts on the Foculus – part 2 here and part 3 here.