29-Mar-2021 and 7-Apr-2021 OpenWSN 2.0

Tutorial by @Timothy Claeys on OpenWSN 2.0

Installation

  • clone https://github.com/openwsn-berkeley/openwsn-fw

    • switch to branch pr-cmake-build-system

  • install

    • CMake ( >= 3.13)

    • Python 3.9.2

  • build library

    • build OpenWSN firmware as Python extension for simulation

      • in repo root, type python3 setup.py install --user

      • creates openmote.so (include the parts from it) allows one to type import openmote

    • test

      • python3 -c “import openmote”

    • clean

      • python3 setup.py clean

Windows Specifics

  • install

    • Microsoft Visual Studio toolchain: https://visualstudio.microsoft.com/vs/features/cplusplus/

      • “Community 2019” known to work

      • why?

        • needed because since Python 3.4, Python extension needs to be compiled with MSVC compiler

    • MinGW

      • why?

        • MinGW generates the right Makefiles when running from command line

        • we can also run cmake from an IDE (then the IDE will provide the generator).

      • download from https://sourceforge.net/projects/mingw/

      • install only mingw32-base

    • cmake

    • Python

      • python-3.9.2-amd64.exe known to work

      • add Python interpreter to PATH environment variable

      • to be able to run OpenWSN Python extension in gdb, select the following from the advanced installation options

  • build

    • type python setup.py install --user

    • build process ends with line Finished processing dependencies for openmote==1.0

    • library ends up in C:\Users\twatteyn\AppData\Roaming\Python\Python39\site-packages

      • openmote-1.0-py3.9-win-amd64.egg/

      • easy-install.pth

  • import library

    • verify the following doesn’t fail python -c "import openmote"

MAC OS Specifics

  • Use homebrew python (brew install python or brew upgrade python) since MAC OSX system Python seems to lead to unstable results (depending on OS version).

  • Python 3.9.1 known to work

  • To build (and configure)

    • python3 setup.py install --user --prefix=

    • python3 setup.py install --user --configure --prefix=

  • When running into issue where

Issue David:

127.0.0.1 - - [14/Apr/2021 08:57:49] code 400, message Bad request syntax ('\x05\x01\x00')

Installing OpenVisualizer

  • clone https://github.com/TimothyClaeys/openvisualizer

  • switch to branch python3

  • move to root of the openvisualizer repository

  • run pip install -e . (Windows) / pip3 install -e .

    • causes the openvisualizer to be installed in Python as a symlink to the current source directory, i.e. this is “installed” but changes to the source code in the repo are reflected

We had to do the following:

  • first issue

    • delete everything OpenWSN related in C:\Users\twatteyn\AppData\Roaming\Python\Python39\site-packages

      • openmote-1.0-py3.9-win-amd64.egg/

      • easy-install.pth

    • rebuild the extension module

  • second issue

    • pip install appdirs

    • rebuild the extension module

Running Simulation

  • on first terminal

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 C:\Users\twatteyn\Desktop\openvisualizer>openv-server simulation 2 ___ _ _ _ ___ _ _ | . | ___ ___ ._ _ | | | |/ __>| \ | | | || . \/ ._>| ' || | | |\__ \| | `___'| _/\___.|_|_||__/_/ <___/|_\_| |_| openwsn.org 11:39:41 INFO Starting OpenVisualizer ... 11:39:41 [SimEngine:INFO] Starting engine (PID = 1988) 11:39:41 [Topology:DEBUG] create instance 11:39:42 [multiprocessing:INFO] Booting mote_1 (PID = 7500) ... 11:39:42 SUCCESS 1 [OPENWSN] booted 11:39:42 [multiprocessing:INFO] Booting mote_2 (PID = 9584) ... 11:39:42 SUCCESS 2 [OPENWSN] booted
  • on second terminal

    1 2 C:\Users\twatteyn\Desktop\openvisualizer>openv-client network root 0001 Ok!
  • this causes mote 0001 to be configured as DAG root, so on the first terminal:

    1 2 3 4 5 6 7 8 9 10 11 11:40:58 INFO registering DAGroot 14-15-92-cc-00-00-00-01 11:41:08 SUCCESS 2 [IEEE802154E] synchronized at slotOffset 0 to mote 1 11:41:08 SUCCESS 2 [SIXTOP] sixtop return code RC_SUCCESS at sixtop state WAIT_ADDRESPONSE 11:41:11 INFO received RPL DAO from bbbb:0:0:0:1415:92cc:0:2 - parents: bbbb:0:0:0:1415:92cc:0:1 - children: 11:41:13 INFO received RPL DAO from bbbb:0:0:0:1415:92cc:0:2 - parents: bbbb:0:0:0:1415:92cc:0:1 - children:

GitHub actions

works great

Cross-Compile for OpenMote-CC2538

  • on Windows, install from https://launchpad.net/gcc-arm-embedded/+download (I downloaded gcc-arm-none-eabi-5_4-2016q3-20160926-win32.exe)

  • 1 2 3 4 cd C:\Users\twatteyn\Desktop\openwsn-fw mkdir build && cd build cmake .. -G"MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/cc2538.cmake -DBOARD=openmote-cc2538 cmake --build .
  • Application available in C:\Users\twatteyn\Desktop\openwsn-fw\build\projects\common\03oos_openwsn\oos_openwsn.ihex

Scratchpad

temporary scratchpad during session, to be deleted after

Open Questions

  • OpenMote B and nRF52840-DK support (including toolchain)