SCons
SCons is a software construction tool, much like make. It is written entirely in Python, so you have the power of a real programming language to customize your build environment at will.
It is not a compiler/linker, but rather a scripting tool to invoke the toolchain-specific compilers/linkers installed on your development host. That is, even if you install SCons, you still have to install the compilers/linkers SCons will invoke.
We thank Chris Snyder for his contribution to setting up this environment.
Installation
See the SCons project's Download page for installation and setup instructions. In our experience, the process is straightforward.
Building Firmware
This section describes the SCons command line and options, and shows an example build.
SCons commands are entered at the command line in the form:
scons [ options... ] [ name=val... ] [ project ] Always issue Scons commands from the top level directory, openwsn-fw/. It will not work if you navigate down into the directory structure.
Inline Help
Typing scons without any option will print the help text.
Options
The following options are available:
Name | Explanation |
|---|---|
| Display OpenWSN-specific help (see Inline Help section) |
| Display generic SCons help |
name=val Pairs
These pairs specify how to build the project, and optionally load onto hardware.
Name | Values | Notes |
|---|---|---|
|
|
|
|
|
|
| location of the target JTAG device | If you set this option, the executable, if built successfully, will be loaded onto the target over JTAG. |
| version number | When using the |
| location of the target mote(s) for bootload | If you set this option, the binary file, if built successfully, will be loaded onto the target(s) using the appropriate bootloader. You can specify multiple locations, separated by commas. The bootloading happens in parallel; 50 boards load as fast as a single board. |
|
| Print complete command/link command |
Project
The OpenWSN project to build. Don't include the numeric prefix in the project's directory name. For example, use 'bsp_leds' rather than '01bsp_leds'.
Example Build
To build the oobsp_leds project for the TelosB platform, using mspgcc on Windows, and load the resulting binary on TelosB boards connected to COM ports 12-14 of your computer, type:
scons board=telosb toolchain=mspgcc bootload=COM12,COM13,COM14 bsp_ledsYou should see console output like this:
C:\Users\Thomas\Desktop\openwsn-fw>scons board=telosb toolchain=mspgcc bootload=COM12,COM13,COM14 bsp_leds
scons: Reading SConscript files ...
___ _ _ _ ___ _ _
| . | ___ ___ ._ _ | | | |/ __>| \ |
| | || . \/ ._>| ' || | | |\__ \| |
`___'| _/\___.|_|_||__/_/ <___/|_\_|
|_| openwsn.org
scons: done reading SConscript files.
scons: Building targets ...
Compiling firmware\openos\projects\common\01bsp_leds\01bsp_leds.o
Compiling build\telosb_mspgcc\bsp\board.o
Compiling build\telosb_mspgcc\bsp\bsp_timer.o
Compiling build\telosb_mspgcc\bsp\debugpins.o
Compiling build\telosb_mspgcc\bsp\eui64.o
Compiling build\telosb_mspgcc\bsp\leds.o
Compiling build\telosb_mspgcc\bsp\radiotimer.o
Compiling build\telosb_mspgcc\bsp\spi.o
Compiling build\telosb_mspgcc\bsp\uart.o
Compiling build\telosb_mspgcc\bsp\cc2420\radio.o
Archiving build\telosb_mspgcc\bsp\libbsp.a
Indexing build\telosb_mspgcc\bsp\libbsp.a
Linking firmware\openos\projects\common\01bsp_leds_prog.exe
msp430-size firmware\openos\projects\common\01bsp_leds_prog.exe
text data bss dec hex filename
2912 0 38 2950 b86 firmware\openos\projects\common\01bsp_le
ds_prog.exe
msp430-objcopy --output-target=ihex firmware\openos\projects\common\01bsp_leds_p
rog.exe firmware\openos\projects\common\01bsp_leds_prog.ihex
msp430-objcopy --output-target=binary firmware\openos\projects\common\01bsp_leds
_prog.exe firmware\openos\projects\common\01bsp_leds_prog.bin
telosb_bootload(["firmware\openos\projects\common\01bsp_leds_prog.phonyupload"],
["firmware\openos\projects\common\01bsp_leds_prog.ihex"])
starting bootloading on COM12
starting bootloading on COM13starting bootloading on COM14
MSP430 Bootstrap Loader Version: 1.39-telos-8
MSP430 Bootstrap Loader Version: 1.39-telos-8
Mass Erase...
Mass Erase...
MSP430 Bootstrap Loader Version: 1.39-telos-8
Mass Erase...
Transmit default password ...
Transmit default password ...
Transmit default password ...
Invoking BSL...
Invoking BSL...
Invoking BSL...
Transmit default password ...
Transmit default password ...
Transmit default password ...
Current bootstrap loader version: 1.61 (Device ID: f16c)
Changing baudrate to 38400 ...
Current bootstrap loader version: 1.61 (Device ID: f16c)
Changing baudrate to 38400 ...
Program ...
Current bootstrap loader version: 1.61 (Device ID: f16c)
Changing baudrate to 38400 ...
Program ...
Program ...
2912 bytes programmed.
Reset device ...
2912 bytes programmed.
Reset device ...
2912 bytes programmed.
Reset device ...
done bootloading on COM14
done bootloading on COM13
done bootloading on COM12
scons: done building targets.