With Eclipse open source integrated development environment it is possible to write, compile and remotely debug software on Black Swift — over Wi-Fi or Ethernet connection.

VirtualBox VMOpenWRT SDK must be used under Linux OS, that's why we provide compelte VirtualBox virtual machine images with CentOS Linux, OpenWRT SDK, and Eclipse already set up. With VirtualBox you'll be able to develope OpenWRT software on Windows or MacOS machines, as well as on Linux machines if you don't want to install OpenWRT SDK and development tools on the host system.

  • Download Oracle VirtualBox here (it's free)
  • Download our VirtualBox HDD image (ZIP file, 2.4 GB).
  • Unpack HDD image (final size will be around 8 GB)
  • Install and run Virtual Box

Create new virtual machine for 32-bit Redhat Linux:

When asked about RAM size, choose 2048 MB or more, depending on your host machine RAM size:

Choose to use existing hard drive image and select VDI file you previously downloaded and unpacked:

Now you have new virtual machine. Right-click it and choose Settings.

On the System tab make sure Enable PAE/NX is checked:

On the Network tab enable 1st adapter, attach it to Bridged adapter and select your host machine network card your are using to access your local network. With such settings your virtual machine will appear in your LAN as a separate PC, obtaining IP address from your router in the same IP range as other LAN devices — so it will immediately get Internet access as well as access to other LAN-connected devices, including Black Swift (in client Wi-Fi mode).

If you plan to use Black Swift in AP (access point) mode, select host's Wi-Fi adapter which is connected to Black Swift. It is also possible to setup more than one network adapter and switch between them on the fly. E.g. if you are using machine with Ethernet card attached to your LAN and Wi-Fi card connected to Black Swift's AP, you can bridge 1st VirtualBox adapter with Ethernet card and 2nd — with your Wi-Fi card. In running VirtualBox machine network adapters can easily be enabled or disable on the fly using Devices → Network menu of the VirtualBox container.

On the General tab enable bidirectional drag'n'drop and clipboard sharing — these will allow you to easily copy-paste text and files between OpenWRT building environment and your main system.

Now it is time to start VM and log in. Login: openwrt, password: openwrt, root password: openwrt.

On a desktop you have few useful icons: shell access, file manager, Chromium web browser, Eclipse IDE, and official OpenWRT manual on setting up Eclipse.

In your home directory (/home/openwrt) you have some additional folders:

  • openwrt — OpenWRT sources, with Black Swift patches applied and firmware, SDK, and ImageBuilder packages already built
  • u-boot_mod — U-Boot bootloader sources with Black Swift patches
  • workspace — default Eclipse projects folder

Eclipse project settingsTo create and build new C or C++ project, start Eclipse by double-clicking its icon, and then select File → New → C++ Project:

Choose a name for your project and don't forget to select Cross GCC compiler toolchain:

Click Next and set toolchain options:

  • Cross compiler prefix: mips-openwrt-linux-
  • Cross compiler path: /home/openwrt/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2

Click Finish. Now click Project → Properties in Eclipse's main menu, select C/C++ General and click Configure Workspace Settings link. In the new window select C/C++ → Build → Environment, click Add... and add new variable STAGING_DIR with the value of/home/openwrt/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2:

Close preferences. Eclipse is ready, and now you can write and build your own C++ code for Black Swift:

Remote debugging with EclipseTo set up remote debugging over Wi-Fi or Ethernet network, click Window → Show View → Other...:

Select Remote Systems → Remote Systems in the new dialog window:

In the lower right part of Eclipse window new Remote tab will appear. Select it and click Define a connection button to create new remote connection:

Choose a name for this connection and enter Black Swift IP address (192.168.0.254 on the screenshot below is Black Swift's defaul access point mode IP address):

Click Next. Check ssh.files checkbox as shown below (by default dstore is checked — uncheck it):

Click Next. Check processes.shell.linux checkbox:

And the last one — check ssh.shells. Click Finish.

Now you should be able to connect to Black Swift board via SSH. Default Black Swift credentials is root:admin:

To set up debugging you need to perform a few more steps. Click Run → Debug Configurations:

Double-click C/C++ Remote Application, and a new subitem will appear. Click it, then enter full local path to your application's executable file in the C/C++ Application field and path where to store this executable on the remote Black Swift system in the Remote Absolute File Path field:

Switch to Debugger tab and enter path to GDB debugger executable compiled for the target system in the GDB Debugger field. With our VM image path is /home/openwrt/openwrt/build_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/gdb-linaro-7.6-2013.05/gdb/gdb (just copy-paste it):

Click Close. Now, if you click Debug button, Eclipse will compile your program, upload it to Black Swift via Wi-Fi and start it.

Happy debugging!