Code
This page provides source code for Flexibity products, together with pre-built firmware images and upgrade instructions (for Linux users). Please feel free to send patches and submit bug reports at our developers portal (user name guest password guest).
Connect

Flexibity Connect uses OpenWRT Linux distribution from the OpenWRT project. There are four main components in the Connect firmware:
- AT91Bootstrap early stage bootloader
- U-Boot bootloader
- Linux kernel
- OpenWRT distribution packages
AT91Bootstrap and U-Boot are located in on-board flash memory, while OpenWRT and Linux kernel use Ext2 formatted SD/MMC card. Kernel usually built as a part of OpenWRT, but you can also build it separately.
Flexibity Connect has the following memory configuration:
DataFlash: SPI0 CS1, 8M
- AT91Bootstrap - 0x0
- U-Boot - 0x8400
- U-Boot env - 0x4200
- Backup Linux & rootfs - 0x100000
SDRAM: 0x20000000, 64M
SRAM: 0x02000000, 4K
Building from Sources
For building AT91Bootstrap and U-Boot, the following instructions assume that you use CodeSourcery toolchain installed into the /opt/codesourcery/ directory to build AT91Bootstrap and U-Boot. You can download the toolchain from CodeSourcery or from this site. To build OpenWRT CodeSourcery toolchain is not necessary.
OpenWRT (Linux and Root Filesystem)
All source code of Flexibity project is stored at GitHub, in order to build the system you should clone necessary repositories, configure and build it as described below:
git clone https://github.com/Flexibity/openwrt.gitUsing your favorite editor, modify feeds.conf to look like this:
cd openwrt
cp feeds.conf.default feeds.conf
src-git flexibity https://github.com/Flexibity/packages.gitNext, download and install feeds and perform configuration:
src-svn packages svn://svn.openwrt.org/openwrt/packages
src-git luci https://github.com/Flexibity/luci.git
./scripts/feeds update -aIf you wish to build a complete Flexibity system for SD card, select the following options:
./scripts/feeds install -a
make menuconfig
Target System -> Atmel AT91For a minimal ramdisk-based system (installed into internal DataFlash as a backup image), select the following options:
Subtarget -> Flexibity Connect (AT91)
Target Profile -> Flexibity Connect (full)
Target Images -> tar.gz
Target Images -> Build Flexibity RootFS (with embedded kernel)
Target System -> Atmel AT91
Subtarget -> Flexibity Connect (AT91)
Target Profile -> Flexibity Connect (minimal)
Target Images -> ramdisk -> Compression (gzip)
Now simply run make and after some time the resulting images will be put into bin directory.
AT91Bootstrap
Download AT91Bootstrap 1.15 from Atmel or from this site. Apply Flexibity board support patch (AT91Bootstrap-1.15-flexibity.patch).
cd Bootstrap-v1.15/board/flexibity/dataflash/
make CROSS_COMPILE=/opt/codesourcery/arm-2007q1/bin/arm-none-eabi-
U-Boot
Download U-Boot 2010.03 from Denx or from this site. Apply Flexibity board support patch (u-boot-2010.03-flexibity.patch).
cd u-boot-2010.03/
make CROSS_COMPILE=/opt/codesourcery/arm-2007q1/bin/arm-none-eabi- flexibity_config
make CROSS_COMPILE=/opt/codesourcery/arm-2007q1/bin/arm-none-eabi-
Linux
Linux kernel is usually built as a part of OpenWRT distribution, but you can also build it from sources, using the following instructions. We assume that you’ve built an OpenWRT toolchain already or use other suitable Linux ARM toolchain, for example latest versions from CodeSourcery.
Download Linux 2.6.37.6 from kernel.org or from this site. Apply Flexibity board support patch (linux-2.6.37.6-flexibity.patch).
cd linux-2.6.37.6/
make ARCH=arm CROSS_COMPILE=arm-openwrt-linux- flexibity_defconfig
make ARCH=arm CROSS_COMPILE=arm-openwrt-linux- uImage
Firmware Updates
AT91Bootstrap and U-Boot using Atmel SAM-BA
In order to update the flash with SAM-BA, you should boot into the RomBOOT mode. You will need only USB device cable connected to the board and SAM-BA tool from Atmel or this site.
First, please download the following Flexibity Connect firmware files:
Now you are ready to update the board firmware:
- If you use Linux, change the USB serial module to work with SAM-BA:
rmmod pl2303 usbserial
modprobe usbserial vendor=0x03eb product=0x6124
- Remove the J2 jumper and power up the board.
- Start the SAM-BA application, select appropriate ttyUSBX and at91sam9260-ek board profile, hit Connect.
- Put the J2 jumper back.
- Select DataFlash AT45DB/DCB tab and perform the following:
Enable Dataflash (SPI0 CS1) Execute
Erase All Execute
Boot File (AT91Bootstrap-1.15-flexibity.bin) Execute
Set address to 0x8400 and Send File (u-boot-2010.03-flexibity.bin)
Set address to 0x100000 and Send File (uImage-flexibity.bin)
- If you use Linux, change USB serial module to work with debug cable:
rmmod usbserial
modprobe pl2303
Prepare a Linux filesystem image on MMC
- Inseart an MMC/SD card (minimum 256MB).
- If it was automatically mounted, unmount it:
umount /media/cardX
- Format the card, but make sure not to format your hard drive:
mkfs.ext3 -L flexibity /dev/sdXX
- Mount the card, change into the mounted directory and extract the root filesystem image:
tar xzf openwrt-at91-flexibity-rootfs.tar.gz
- Copy Linux kernel into filesystem:
cp linux-2.6.37.6-flexibity.bin uImage
- Unmount the card, inseart into the Flexibity Connect board and re-start the board.
That’s it!
Sensors
Flexibity sensors use Contiki OS embedded operating system from the Contiki OS project. Contiki OS provides an embedded IPv6 stack with RPL routing layer and CoRE CoAP protocol. Each Flexibity sensor (and router) runs a separate Contiki application and shall be built independently.
Building from Sources
For building Contiki OS you should use the CodeSourcery toolchain installed into the /opt/codesourcery/ directory. You can download the toolchain from CodeSourcery or from this site.
Contiki OS applications
All source code of Flexibity project is stored at GitHub, in order to build the system you should clone necessary repositories, configure and build it as described below:
git clone https://github.com/Flexibity/contiki.gitThe resulting images with *.bin extension will be put into the same directory directory.
cd contiki/examples/ipv6/border-router
make TARGET=flexibity
Flashing the image
To program sensor’s firmware you may use Connect device with XS3 and XS7 headers. After connecting a sensor’s radio board, login to Connect and perform the following:
Please note, that complete programming process may take several hours!
/etc/init.d/tunslip6 stop
mc1322x-erase.sh
mc1322x-load.pl -f /usr/lib/firmware/sensors/flasher.bin -s /usr/lib/firmware/sensors/border-router.bin -t /dev/ttyS1 -b 115200 &
mc1322x-reset.sh

