was successfully added to your cart.



How to compile Oculus Rift DK2 Firmware

By | STM32

DK2 Firmware


The Oculus firmware is licensed under the BSD-style license at

We also provide for the Oculus firmware an additional grant of patent rights at

The firmware incorporates or references materials of third parties that are
subject to other licenses.  Please see the individual headers on each file to
determine which license applies. For ease of reference, headers that include
the link http://www.st.com/software_license_agreement_liberty_v2 refer to the
license reproduced in en.ultimate-liberty-v2.txt.

External Libraries

The ARM CMSIS library is not included, but can be downloaded from:

The firmware was originally developed with CMSIS 3.01

This should be placed in lib/CMSIS

Building DK2 Firmware

Building DK2 firmware currently requires IAR EWARM. You can get a 30-day trial
here: http://supp.iar.com/Download/SW/?item=EWARM-EVAL

Programming DK2 Firmware to a Board

### Updating an already programmed board

You can update a DK2 over USB using the Oculus Configuration Utility:

In this case, you should use the most recent DK2.bin available for your board.

* Rev 3 (GDC units): prj/REV3/Exe/DK2.bin
* Rev 3.3 (Pilot run and production units): prj/REV3_3/Exe/DK2.bin

### Programming to a blank board

For a blank board, you’ll need to program it over the SWD header using an ST-Link programmer.

In this case, you’ll need the ST-Link utility and DK2Bootloader.bin

* Rev 3 (GDC units): bootloader/prj/REV3/Exe/DK2.bin
* Rev 3.3 (Pilot run and production units): bootloader/prj/REV3_3/Exe/DK2.bin

CooCox CoIDE Nucleo STM32F103RB Example

By | STM32

GPIO Example

#include "stm32f10x.h"
#include "stm32f10x_rcc.h"
#include "stm32f10x_gpio.h"

int main(void)
    GPIO_InitTypeDef GPIO_InitDef;

    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);


    GPIO_InitDef.GPIO_Pin = GPIO_Pin_5;
    GPIO_InitDef.GPIO_Mode = GPIO_Mode_Out_PP;
    GPIO_InitDef.GPIO_Speed = GPIO_Speed_10MHz;

    //Initialize pins
    GPIO_Init(GPIOA, &GPIO_InitDef);

    static int count=0;
    static int i;
    static int led_state=0;

        static int count=0;
        static int i;
        static int led_state=0;

        for (i=0; i<10000; ++i)
            GPIO_WriteBit(GPIOA, GPIO_Pin_5, led_state ? Bit_SET : Bit_RESET);
            led_state = !led_state;
            GPIO_WriteBit(GPIOA, GPIO_Pin_5, led_state ? Bit_SET : Bit_RESET);
            printf("%d\r\n", ++count);

PWM Example