Skip to content

Generic wiselib application shawn

Anubhav Yadav edited this page Mar 11, 2014 · 5 revisions

Basic Requirements

Before compiling your first application, the appropriate paths must be set. Therefore the file

wiselib/apps/generic_apps/Makefile.template

must be copied to

wiselib/apps/generic_apps/Makefile.local

and the paths for the platforms to be used for compilation must be adapted.

Without an existing Makefile.local (see above), it is not possible to compile any application in the applications folder!

Once this is done, change to

wiselib/apps/generic_apps/example_app

There is already a Makefile included, so that you only need to call

make shawn

Compile your Generic Application for Shawn

Preparing Shawn

At first, Shawn must be prepared to be compiled as a lib containing a main function, so that it can be linked against the routing test application. When executing ccmake ../src in the shawn/buildfiles directory, a few requirements must be fulfilled:

  • Option BUILD_LIB_WITH_MAIN must be set to ON (then, a Shawn library with an own main() function is generated)
  • MODULE_APPS_EXTERNAL_APPLICATION must be set to ON
  • MODULE_APPS_ISENSE must be set to OFF
  • MODULE_LEGACYAPPS_WISELIB must be set to ON

Compile Application

At first, the paths WISELIB_BASE, WISELIB_PATH, WISELIB_PATH_TESTING, SHAWN_INCLUDE_DIR, and SHAWN_LIB_DIR must be set in your Makefile.local. Furthermore, SHAWN_LINK_LIBS must be adapted to your local Shawn setup.

Apart from that, the setup in SHAWN_LINK_LIBS depends on the enabled modules: For each enabled module (e.g., MODULE_APPS_EXAMPLES), the corresponding library must be linked (e.g., -lapps_exampleslib added to SHAWN_LINK_LIBS). If a module is disabled, the corresponding library should not be added (since it is not available).

If this is fulfilled, the generic compilation can easily compiled via

  • make shawn,

and a binary called example_app is generated.

Running the Application

This is an ordinary Shawn binary, containing a processor which calls the above described application_main. The corresponding processor factory is named wiselib_shawn_standalone, and must be used when nodes are generated. An example can be found in wiselib.stable/external_interface/shawn/standalone/start_wiselib_shawn_example.conf, hence just type

./routing_test -f ../../wiselib.stable/external_interface/shawn/standalone/start_wiselib_shawn_example.conf

to execute the recently compiled generic Wiselib application in Shawn.

You then should an output as follows:

init_apps: init_examples(sc); init_external_application(sc);
Initialising examples
Initialising External_Application  Shawn module
Initialising Wiselib-Shawn-Standalone module
Initialising Wiselib-Examples module
Initialising Wiselib-Shawn module
Simulation: Running task 'random_seed'
[...]
Simulation: Running task 'rect_world'
Simulation: Task done 'rect_world'
Simulation: Running task 'simulation'
------------------------------ BEGIN ITERATION 0
Hello World from Example Application!
Hello World from Example Application!
Hello World from Example Application!
[...]
Simulation: Running task 'dump_transmission_stats'
---- stats_chain transmission model information -----------------
general all_types messages 0
general all_types size 0
-----------------------------------------------------------------
Simulation: Task done 'dump_transmission_stats'
Simulation: Running task 'connectivity'
tasks.connectivity: Mean connectivity: 11.68
tasks.connectivity: Min connectivity: 2
tasks.connectivity: Max connectivity: 25
Simulation: Task done 'connectivity
Clone this wiki locally