|
|
# Examples
|
|
|
|
|
|
Here are a few examples that demonstrate how to run code on the respective targets on Flocklab.
|
|
|
<br />
|
|
|
|
|
|
## DPP: Hello World
|
|
|
|
|
|
To run a basic 'Hello World' example on our Dual Processor Platform, follow these steps (tested on a Linux machine):
|
|
|
|
|
|
* Make sure the following packages are installed on your computer:
|
|
|
```
|
|
|
sudo apt-get install msp430-libc binutils-msp430 gcc-msp430 msp430mcu
|
|
|
```
|
|
|
* Clone the code from our LWB repository and switch to the branch `dpp`:
|
|
|
```
|
|
|
git clone https://github.com/ETHZ-TEC/LWB.git
|
|
|
cd LWB
|
|
|
git checkout dpp
|
|
|
```
|
|
|
* Go into the apps folder and have a look at the `hello-world` example.
|
|
|
* Compile the code and generate the Flocklab XML config file:
|
|
|
```
|
|
|
cd apps/hello-world
|
|
|
make
|
|
|
make flocklab_xml
|
|
|
```
|
|
|
* Open the file `flocklab-dpp.xml` and go through the settings. By default, the following services are used:
|
|
|
* serial logging
|
|
|
* GPIO tracing
|
|
|
* GPIO actuation (only used to select the MCU from which we will get the serial output, default: CC430)
|
|
|
* Submit the XML file on the [Flocklab page](https://user.flocklab.ethz.ch/xmlvalidate.php) to schedule a test. Alternatively, use the [shell tool](Man/flocklab-cli) and submit your test directly from the command line:
|
|
|
```
|
|
|
flocklab -c flocklab-dpp.xml
|
|
|
```
|
|
|
* Note that Flocklab will automatically set the node ID to the observer ID. The ID can be accessed in the code via the global variable `node_id`.
|
|
|
* For more information about our DPP platform, visit our [DPP Wiki](https://gitlab.ethz.ch/tec/public/dpp/wikis).
|
|
|
|
|
|
<br />
|
|
|
|
|
|
## DPP: Glossy and LWB
|
|
|
|
|
|
Follow the instructions in the 'Hello World' example above. The 'Glossy' and 'LWB' code are in the respective folders in `apps`.
|
|
|
Note that you can pass additional arguments when generating the `flocklab-dpp.xml` file, for example:
|
|
|
```
|
|
|
make flocklab_xml OBSIDS="001 002 003 004 006 007 008 010" TESTDURATION=180 DESCRIPTION="a simple Glossy test"
|
|
|
```
|
|
|
|
|
|
<br />
|
|
|
|
|
|
## DPP2 LoRa: Blink LED
|
|
|
|
|
|
The DPP2 LoRa platform features an STM32L433CC MCU and the Semtech SX1262 LoRa radio. More information about the platform is available in our [DPP Wiki](https://gitlab.ethz.ch/tec/public/dpp/wikis).
|
|
|
To run a simple 'Blink LED' application on the platform, follow these steps:
|
|
|
|
|
|
* Download the `blink_led` example code from our [DPP repository](https://gitlab.ethz.ch/tec/public/dpp/tree/master/software/com/stm32l4_sx1262/blink_led).
|
|
|
* To open and compile the project, you will need [Atollic TrueStudio](https://atollic.com/truestudio/).
|
|
|
* After successful compilation, you should be able to find the file `STM32L433_BlinkLED.elf` in the folder `Debug`. Encode it to base 64 and insert it into the Flocklab XML configuration file. You can use the [`embed_image.sh` script](https://gitlab.ethz.ch/tec/public/flocklab/flocklab/blob/python3/tools/scripts/embed_image.sh) for this:
|
|
|
```
|
|
|
./embed_image.sh Debug/STM32L433_BlinkLED.elf
|
|
|
```
|
|
|
|
|
|
<br /> |