Skip to content

Instantly share code, notes, and snippets.

@tejo
Created May 9, 2016 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tejo/247b6e9a7081af5fe59ecb79cf02950e to your computer and use it in GitHub Desktop.
Save tejo/247b6e9a7081af5fe59ecb79cf02950e to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
set -o pipefail
dfu-util --alt 0 -s 0x08000000:force:unprotect -D "$1"
sleep 5
dfu-util -R -a 0 -D "$1"
@tejo
Copy link
Author

tejo commented May 17, 2016

Flashing the KISS FC from command line (Mac and Linux)

Note before start:

  • You will need to use the terminal for this guide
  • You will need to copy and paste some text into the terminal
  • You will learning something about command line interface.

Prerequisites Mac

You'll need to install the brew (http://brew.sh/) package manager for OS X, go to the site and install it (https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Installation.md#installation)

After you completed the installation be sure the brew installation is working typing:

$ brew

in the terminal (note: the $ is not intended to be copied)

you should see something like:

Example usage:
  brew [info | home | options ] [FORMULA...]
  brew install FORMULA...
  brew uninstall FORMULA...
  brew search [foo]
  brew list [FORMULA...]
  brew update
  brew upgrade [FORMULA...]
  brew pin/unpin [FORMULA...]
  [full output omitted]

Now you need to intall the dfu-util (http://dfu-util.sourceforge.net/) program we wiil use for flash the FC. Install it by typing:

$ brew install dfu-util

after that verify the correct installation typing:

$ dfu-util

you should see something like:

dfu-util 0.8

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.g
[full output omitted]

Prerequisites Linux

in linux you can install the dfu-util (http://dfu-util.sourceforge.net/) with your disto package manager, in ubuntu you can do it with:

$ sudo apt-get install dfu-util

after that verify the correct installation typing:

$ dfu-util

you should see something like:


dfu-util 0.8

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.g
[full output omitted]

Flashing

Now that you have dfu-util installed you can flash the FC. Download the FW extract it and go in the extracted directory.
If you type:

$ pwd

in the terminal you will see the directory where you are, mine for example is:

/Users/teo/

if we have downloaded and extracted the firmware in the Download directory, we can go there typing:

$ cd Downloads/

(you don't need to typing the complete word, type the initial letters and simply hit tab, the terminal will try to autocomplete it)

and we can verify the content of the directory typing:

$ ls

and you should see the list of the files, mine is:

KISSFC_v1.011_HWv1.02.dfu KISSFC_v1.02_RC16.dfu KISSFC_v1.02_RC25.dfu KISSFC_v1.02_beta74_HWv1.02.dfu
now you can grab a simple script that execs the dfu-command for you by doing:

$ curl -o flash.sh https://gist.githubusercontent.com/tejo/247b6e9a7081af5fe59ecb79cf02950e/raw/639c10266fbf29995a4929865f356a0109d93598/flash.sh
make it executable with

$ chmod +x flash.sh

Now if you flash for example the previously downloaded rc16 you can connect the FC (with soldered boot pins or pressing the boot switch) and then type:

$ ./flash.sh KISSFC_v1.02_RC16.dfu

if you see some text and progress bar flashing on the terminal you are done. Now you can un-solder the boot pins (or release the boot switch) and reboot the FC with the new firmware.

With linux you may have to prepend the flash.sh command with sudo and type your password, like:

$ sudo ./flash.sh KISSFC_v1.02_RC16.dfu

General troubleshooting

Your FC must been recognize by your system by the GUI. If you cannot connect your FC with the fiss GUI, this guide is unlikely will work for you.

Must issue with command line are related to file path and name cases. Make sure you are in the right directory with pwd and ls, and avoid to type the file names by your own, use the tab key to autocomplete them.

If you are curious about the script you can take a look at it here:

https://gist.github.com/tejo/247b6e9a7081af5fe59ecb79cf02950e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment