This is an old revision of the document!
Writing EEROS Applications for cb20 Board
Back to Use on a cb20 Board.
You will use C++ to develop your EEROS applications. For this you need at least some knowledge of the basic language features. A good starting point might be https://www.cplusplus.com/doc/tutorial/. Minimal help can also be found under C++ for Beginners.
What do you want to do next?
Say Hello with EEROS
- 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.10) project(helloworld) set(CMAKE_CXX_STANDARD 14) find_package(EEROS REQUIRED) add_executable(helloworld main.cpp) target_link_libraries(helloworld PRIVATE eeros)
- Create a build directory and change into it with
$ mkdir build-armhf $ cd build-armhf
- Source the script for the SDK which has been installed in Install SDK on the Host with
$ . ~/ost-devel/1.0/environment-setup-cortexa8hf-neon-poky-linux-gnueabi
This step has to be done only once. However, you have to repeat it as soon as you open another shell.
- Build the project with
$ cmake .. $ make
- Make changes to “main.cpp”, save them and rebuild with
$ make
In order to be able to write your own EEROS programs, you could use any text editor. However, we recommend to use an integrated development environment, see Use KDevelop with Existing Build Configuration.
Continue with Deploy to cb20 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 cb20 Board.
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
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"
After this you continue as given above in Use Existing Project.