This is an old revision of the document!
Writing EEROS Applications for cb20 Board
Say Hello with EEROS
- Edit the file
config.sh.in
as followscustom_application=hello
- Create a project directory and change into it with
$ mkdir hello $ cd hello
- Create a text file “main.cpp” and copy the following code into it
#include <iostream> #include <eeros/logger/Logger.hpp> #include <eeros/logger/StreamLogWriter.hpp> int main() { using namespace eeros::logger; Logger::setDefaultStreamLogger(std::cout); Logger log = Logger::getLogger(); log.info() << "Hello, EEROS"; return 0; }
- Create a text file “CMakeLists.txt” and copy the following text into it:
cmake_minimum_required(VERSION 3.5.1) project(helloworld) set(CMAKE_CXX_STANDARD 14) find_package(EEROS REQUIRED) include_directories(${EEROS_INCLUDE_DIR}) link_directories(${EEROS_LIB_DIR}) add_executable(helloworld main.cpp) target_link_libraries(helloworld eeros ucl ${CMAKE_DL_LIBS})
- Change back into your parent directory and build the project with
$ cd .. $ ./make.sh
Continue with Deploy to Beaglebone Blue Board.
Use Existing Project
As an example we use the Control a Single Motor demo program.
- Edit the file
config.sh.in
as followscustom_application=simple-motor-control
- Fetch the code of the application with
$ ./clone.sh
- Build the project with
$ ./make.sh
Continue with Deploy to Beaglebone Blue Board.
If you want to use CAN, choose
use_can=true
Setting the entry use_custom_application
to true will fetch an existing application from a git repository. Per default this will will be https://github.com/eeros-project/simple-motor-control.git. However, you could choose another repository in config.sh.in
. Or you could set the entry to false if you want to develop your own application.
Now you can run the clone
script
$ ./clone.sh
After this you can continue with Compile.
Test Application
There is a test application for the cb20 board in https://github.com/ntb-ch/cb20.git under the directory /Software. If you wish to use this you can alter config.sh.in
as follows
use_custom_application=true custom_application_name=cb20test
and further down
custom_application_git_remote_address=https://github.com/ntb-ch/cb20.git custom_application_git_version=master custom_application_source_dir="$wd/$custom_application_name/Software/$custom_application_name" custom_application_build_dir="$build_dir/$custom_application_name"
Now you can run the clone
script
$ ./clone.sh
After this you can continue with Compile.