ASGARD installation and basic concepts.

advertisement
ASGARD installation and basic concepts
Oscar Tonelli – Aalborg University
October 30th 2013
Web resources
The ASGARD website
http://asgard.lab.es.aau.dk/
The wiki
http://wiki.asgard.lab.es.aau.dk/projects/asgard/wiki
email
asgard-info@es.aau.dk
Software Defined Radio concepts
Task
Where it happens
Execution of the
system application
A UserSpace process
running in the OS
Interfacing with the
hardware
Hardware Drivers
Streaming of samples
to/from the hardware
The SDR motherboard
Radio TX/RX
Radio Front-end
Data domains
HIGH-LEVEL DATA OBJECTS
BITS
Asgard
COMPLEX
SAMPLES
RADIO SIGNAL
The USRP
board
application
Ethernet/USB
Interface
ASGARD building elements
Components
Comm.
Objects
Software container
for the
implementation of
data processing tasks
Software objects
which manage the
data transfer and
other interactions
between components
Software
abstractions for the
threads of execution
ASGARD application
defines the architecture of the
communication system and manages its
execution
Structure of the ASGARD libraries
Third-party
libraries
dependencies
Poco
Google
Test
IT++
Boost
ASGARD Core
Library
ASGARD
Components
Library
ASGARD
Applications
UHD
Communication
Objects
Modules
Data
Structures
Others...
System
Messages
OFDM
Modulator
UHD
Communication
Another
Component...
Bit Generator
example_app
GNU
Radio
Intel TBB
tx_from_file_app
tx_from_file_app
my_radio_app
Getting the ASGARD code
• Check the software dependecies:
http://wiki.asgard.lab.es.aau.dk/projects/asgard/wiki/Dependencies
• Checkout a copy of the ASGARD EDU repository:
In a linux terminal type:
git clone http://asgard.lab.es.aau.dk:8080/git/asgard_edu.git
• Compile the ASGARD library:
Enter the ASGARD main folder...
git checkout UniTN
cd core
mkdir build
cd build
cmake ../
make
make test
sudo make install
• The same compilation procedure holds for other ASGARD folders, e.g.
unstable
• For compiling the applications (from the main ASGARD folder):
cd applications
mkdir build
cd build
cmake ../
make
Where is my app?
• After compilation, application executables are
typically found in:
asgard_edu/applications/bin/app_folder
• The settings file (settings.xml) related to the app,
should also be in the same folder of the executable
• The components tests executables are in:
asgard_edu/core/build/tests/components/component_folder
• To execute an app from its folder just type:
(sudo) ./my_app_name
• Add ”sudo” when you use an app with the USRP
hardware
Application Example
Clock
Timer
Set()
Event
Timer
Event
Wait()
Get()
Set()
Int
Frame
Number
Periodically
generates data
Event Controlled
Component
Push()
Int
Data
Buffer
Pop()
Terminal Print
Component
Prints the received
data to screen
Developing an Asgard Component fundamental steps:
my_component.h
class MyComponent: public
api::Component
{
public:
MyComponent();
~MyComponent();
void Do();
private:
....
my_component.cpp
#include ”my_component.h”
MyComponent::
MyComponent() {...}
my_component_test.cpp
#include
”asgard_components/basic/m
y_component.h”
using namespace asgard::api;
MyComponent::~MyCompone
nt() {...}
void MyComponent::Do()
{...}
MESSAGE(STATUS " Compiling
the basic Components")
## Add includes and
dependencies#
# Build the library from source
files#
SET(sources
my_component.cpp
) ...
Compile the
Component Library
namespace asgard
{
TEST (MyComponent, Do)
{ ...}
# Build executables, register as
tests, and install
#SET(test_sources
my_component_test.cpp
)
ADD_DEFINITIONS(
${TEST_COMPILER_FLAGS} )
#....
Compile the Tests
1. Component Header
2. Component Source (*.cpp)
3. Test Source
4. Edit the Component
CMakeLists.txt
5. Edit the Tests CMakeLists.txt
Compiling and testing a Component
• Compile the Component:
Enter the Components folder (either asgard/core or
asgard/unstable):
make
sudo make install (you can call directly this in most cases):
• Compile and execute tests:
Enter the tests folder (either asgard/core/tests or asgard/unstable/tests):
make test (this will compile and execute all the tests of the folder in a non-verbose mode)
To execute and debug more carefully a single test, use the debugger (gdb) and
execute directly the test binary. In the case of a component located in the
basic folder of the asgard/core, for example, the binary will be located in
asgard/core/build/tests/components/basic.
gdb ./my_component_test (to run the debugger)
run (to run the test)
Developing an Asgard Application
step-by-step
Headers of Components and COs
#include ”my_component.h”
#include ”another_component.h”
#include ”
asgard_api/the_communication_objects_i_need.h
”
namespace asgard
{
class MyAsgardNode : public AsgardSystem
{ ...
my_setting_file.xml
<!– This is the Setting file, settings.xml -->
<settings>
<!– List all the Components utilized in the application-->
<ComponentA>
<parameter_1>10</parameter_1>
<parameter_2>a text string</parameter_2>
<ComponentA>
my_application_app.cpp
#include ”my_component.h”
#include
”another_component.h”
#include ”
asgard_api/the_communication_
objects_i_need.h”
namespace asgard
{
class MyAsgardApplication :
public Poco::Util::Application {
...
CMakeLists.txt
# Build executables, register as
tests, and install
#SET(test_sources
my_application_app.cpp
)
ADD_DEFINITIONS(
${TEST_COMPILER_FLAGS} )
#....
<ComponentB>
<another_parameter>10</another_parameter>
</ComponentB>
</settings>
Compile the
Application
1. Create the Application Source
(*_app.cpp)
a) Create the Components
and COs Objects
b) Connect all objects
c) Create Modules and load
Components
d) Manage the execution of
the Modules
2. Prepare and create the
application setting file
3. Edit the Applications
CMakeLists.txt (remember the
to copy the setting file)
4. Compile the Application
5. Run the application in the ”bin”
folder
Developing an Asgard Application (2)
• In relation to point 1 from the previous slide:
› The operations from a) to d) can be either implemented
directly in the main() method of the application (e.g.
my_application_app.cpp) or in a separate header
(e.g. my_asgard_node.h) file creating an
AsgardSystem object.
› The second method is preferrable if a single application is
meant to manage multiple node architectures or, more in
general, when a compact object is preferrable to manage a
complex system implementation.
• The configuration settings file:
› Should contain all the parameters required by each
component, in a proper XML format.
› It’s loaded in the application and typically given as an input
to the system objects and to the Components constructors
Additional Info
• Read the PDF file available at the bottom of the
page:
http://wiki.asgard.lab.es.aau.dk/projects/asgard/wiki/Further_Documentation
• Check the Google Test Documentation:
https://code.google.com/p/googletest/wiki/V1_5_Documentation
• Check the POCO Library Documentation:
http://pocoproject.org/
• Check the IT++ library: http://itpp.sourceforge.net/devel/index.html
Download