====== Writing EEROS Applications for Beaglebone Blue Board ======
Back to [[getting_started:install:use_on_bbb|]].
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 [[tools:cplusplus|]].
All the necessary libraries are already on our images, notably eeros, librobotcontrol and bbblue-eeros.
What do you want to do next?
* [[getting_started:write_app:use_on_bbb#Say Hello with EEROS|]]
* [[getting_started:write_app:use_on_bbb#Use Existing Project|]]
===== 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
#include
#include
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::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 [[getting_started:install:use_on_bbb#Install_SDK_on_the_Host|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 [[getting_started:kdevelop|]].
Continue with [[getting_started:deploy:deploy_bbb|]].
===== Use Existing Project =====
As an example we use the [[getting_started:tutorials:oneaxis|]] demo program.
- Clone the code for the project, change into the directory and checkout a stable version with
$ git clone https://github.com/eeros-project/simple-motor-control.git
$ cd simple-motor-control
$ git checkout v1.0.0
- 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 [[getting_started:install:use_on_bbb#Install_SDK_on_the_Host|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 -DUSE_BBBLUE=TRUE ..
$ make
Continue with [[getting_started:deploy:deploy_bbb|]].