Get and compile M3 and A8-M3 Firmware code

 

Difficulty: Medium

Duration: 20 minutes

Prerequisites: Configure SSH Access

Description: The aim of this tutorial is to understand how to setup your environment and compile firmwares. As the toolchain (gcc-arm for M3 nodes) is provided on frontend SSH servers site we will use it. Moreover you have the possibility to install it on your computer ( See the GitHub IoT-LAB FAQ) and follow normally this tutorial.

  1. Setup your environment
    ssh <login>@<site>.iot-lab.info 
    <login>@<site>~$ git clone https://github.com/iot-lab/iot-lab.git
    Cloning into iot-lab...
    ...
    <login>@<site>~$ cd iot-lab
    <login>@<site>:~/iot-lab$ make
    
      Welcome to the IoT-LAB development environment setup.
    
      targets:
    	setup-wsn430 
    	setup-openlab
    	setup-contiki
    
    	pull
  2. Setup M3 or A8/M3 target and compile the code
    <login>@<site>:~/iot-lab$ make setup-openlab
    git clone https://github.com/iot-lab/openlab.git parts/openlab
    Cloning into parts/openlab...
    ...
    less parts/openlab/README-IoT-LAB.md
    <login>@<site>:~/iot-lab$ cd parts/openlab

    Compile for M3:

    <login>@<site>:~/iot-lab/parts/openlab$ mkdir build.m3 ; cd build.m3/  
    <login>@<site>:~/iot-lab/parts/openlab/build.m3$ cmake .. -DPLATFORM=iotlab-m3
    <login>@<site>:~/iot-lab/parts/openlab/build.m3$ cd ..

    Compile for A8/M3:

    <login>@<site>:~/iot-lab/parts/openlab$ mkdir build.a8-m3 ; cd build.a8-m3/  
    <login>@<site>:~/iot-lab/parts/openlab/build.a8-m3$ cmake .. -DPLATFORM=iotlab-a8-m3
    <login>@<site>:~/iot-lab/parts/openlab/build.a8-m3$ cd ..
  3. View and analyse the source code of the tutorial
    <login>@<site>:~/iot-lab/parts/openlab$ cd appli/iotlab_examples/tutorial 
    <login>@<site>:~/iot-lab/parts/openlab/appli/iotlab_examples/tutorial$ cat README.md
    <login>@<site>:~/iot-lab/parts/openlab/appli/iotlab_examples/tutorial$ cat main.c
    <login>@<site>:~/iot-lab/parts/openlab/appli/iotlab_examples/tutorial$ cat CMakeLists.txt 
    add_executable(tutorial_m3 main)  # this is the name to use to compile it
    target_link_libraries(tutorial_m3 platform lps331ap isl29020 mac_csma)
    <login>@<site>:~/iot-lab/parts/openlab/appli/iotlab_examples/tutorial$ cd ../../..
  4. Compile the tutorial in build.m3/ directory (generate binary files *.elf with radio chipset support at86rf231)
    <login>@<site>:~/iot-lab/parts/openlab$ cd build.m3
    <login>@<site>:~/iot-lab/parts/openlab/build.m3$ make tutorial_m3
    <login>@<site>:~/iot-lab/parts/openlab/build.m3$ ls bin/tutorial_m3.elf
    bin/tutorial_m3.elf