Set up Cygwin for Deviation Development

The Deviation project is a great opensource firmware for Walkera RC transmitter, allows players to custom the transmitter their own. When I was new to this project, most of the environment is MinGW or Linux. Although I am familiar with UNIX-like environments (Linux, FreeBSD, etc.), but I am using Windows 8.1 and there is not a UNIX box near me. So I have to make a choice between MinGW or Cygwin. After some studies, there are reasons make me to try setting up Cygwin for Deviation

  1. I am not familiar with MinGW but Cygwin.
  2. I use vim, but the mnitty of MinGW does not work well with the vim DOS batch scripts.
  3. Cygwin setup program selects and installs those packages related and required to package picked by user.
  4. There are lot of useful/powerful GNU software provided by Cygwin.

Set up Cygwin

There are 32 and 64-bit versions for Windows, both work well. I have both versions installed already in my Windows 8.1 box. The 32-bit is maturer in some ways, so I pick it to work for Deviation. It is pretty easy to install Cygwin, download and follow its direction. Get Cygwin installer

The article Development on Windows describes there FLTK and PortAudio are required for Deviation development. Cygwin has them already. Run Cygwin setup program, i.e. setup-x86 or setup-x86_64, set up search filters (see red mark in screenshot). Click on package’s ‘New’ column to cycle Skip or version number if the package is not yet installed. Keep, Reinstall, Uninstall, or another version number if there is a version already installed.

Cygwin-09-search_filter

Install all FLTK items in Libs @ Default. I have two installed:
1.3.3-1 / 400k / libfltk-devel: Fast Light Toolkit
1.3.3-1 / 452k / libfltk1.3: Fast Light Toolkit
Cygwin-09-fltk

Install all PortAudio items in Libs @ Default. I have four installed:
19.20140130-1 / 14k / libportaudio-devel: Cross platform audio I/O library
19.20140130-1 / 29k / libportaudio2: Cross platform audio I/O library
19.20140130-1 / 16k / libportaudiocpp-devel: Cross platform audio I/O library
19.20140130-1 / 11k / libportaudiocpp0-devel: Cross platform audio I/O library
Cygwin-09-portaudio

Get Deviation Source Code

My git is installed from Cygwin package also. It works well with mine and other Bitbucket projects, but fail to clone the Deviation repository constantly.

$ git clone https://bitbucket.org/deviationtx/deviation
Cloning into 'deviation'...
remote: Not Found
fatal: repository 'https://bitbucket.org/deviationtx/deviation/' not found

I do not dig this problem and eventually have the Deviation clone by using Atlassian SourceTree. It will be nice and much convenient if the git command line works.

Work on libopencm3

The GNU make stops work on the AR procedure about ‘libopencm3_stm32f0.a‘. When I looked into this problem found the source code of Deviation use ‘#include <...>‘ to include headers of libopencm3, the ‘<...>‘ tells gcc to look for headers from its system resource, so the gcc -I flag for libopencm3 will not work in Cygwin environment. There are lot of c files contain the libopencm3 heads. To modify those files can be really tedious, so I decide to install libopencm3 libraries system-wide.

When making libopencm3, AR did not create the specified archive somehow from the Makefile procedure, but would work if make it separately. To work on the libopencm3 problem may be tedious but not difficult if there is a road map on hand. I wrote a note of installing libopencm3 as a system resource for ARM gcc. Read Install libopencm3 for Cygwin

Once the system-wide libopencm3 is installed, the one comes as a subset of the Deviation is no longer needed and can be removed safely. Modify ‘src/target/common/devo/Makefile.inc‘ of Deviation to skip libopencm3 from make, comment out three lines:

# LIBOPENCM3 = /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a
# $(LIBOPENCM3):
# make -C $(SDIR)/libopencm3 TARGETS=stm32/f1 lib

remove a flag in CFLAGS:

CFLAGS = …
-I$(SDIR)/libopencm3/include ...

Something is missing?

Looks like everything is ready, but make stops work again


mkdir filesystem/devo8/language 2> /dev/null; \
../utils/extract_strings.pl -target devo8 -update -objdir objs/devo8
xargs: xgettext: No such file or directory
export tx=devo8; \
number=2 ; while [ $number -le 30 ] ; do \
cp model_template.ini filesystem/$tx/models/model$number.ini; \
number=`expr $number + 1`; \
done
+ Checking string list length for devo8
../utils/check_string_size.pl -target devo8 -objdir objs/devo8 -quiet
xargs: xgettext: No such file or directory
true

There is no issue about the Perl scripts. It fails because of the xgettext can not be found. The xgettext is a utility of gettext which can be installed from Cygwin packages also:
0.19.4-1 / 1501k / gettext-devel: GNU Internationalization development utilites
Cygwin-09-gettext

Done

This time, make done its job.

$ make
+ Compiling 'target/devo8/tx_buttons.c'
+ Compiling 'target/devo8/backlight.c'
...
+ Compiling 'pages/320x240x16/advanced/mixer_limits.c'
+ Compiling 'pages/320x240x16/advanced/mixer_curves.c'
+ Building 'devo8.elf'
c:/program files (x86)/gnu tools arm embedded/4.9 2015q2/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld.exe: warning: cannot find entry symbol reset_handler; defaulting to 08004000
ROM: 0x08004000 - 0x08005014 = 4.02kB
RAM: 0x20000000 - 0x20000000 = 0.00kB
+ Copying template files for devo8
+ Checking string list length for devo8

There may be issues in other targets, but I have the default devo8 target and the devo10 target made successfully, they seem ready to go.

Leave a comment