User Tools

Site Tools


getting_started:write_app:use_on_cb20

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

  1. Create a project directory and change into it with
    $ mkdir hello
    $ cd hello 
  2. 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;
    }
  3. 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)
  4. Create a build directory and change into it with
    $ mkdir build-armhf
    $ cd build-armhf 
  5. Source the script for the SDK which has been installed in Install SDK on the Host with
    $ . ~/ost-devel/tdx-xmayland/5.1.0/environment-setup-armv7at2hf-neon-tdx-linux-gnueabi

    This step has to be done only once. However, you have to repeat it as soon as you open another shell.

  6. Build the project with
    $ cmake ..
    $ make
  7. 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.

  1. Clone the code for the project and change into the directory
    $ git clone https://github.com/eeros-project/simple-motor-control.git
    $ cd simple-motor-control
  2. Create a build directory, change into it and checkout a stable version with
    $ mkdir build-armhf
    $ cd build-armhf 
    $ git checkout v1.0.0
  3. Source the script for the SDK which has been installed in Install SDK on the Host with
    $ . ~/ost-devel/tdx-xmayland/5.1.0/environment-setup-armv7at2hf-neon-tdx-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_FLINK=TRUE ..
    $ make

Continue with Deploy to cb20 Board.

getting_started/write_app/use_on_cb20.txt · Last modified: 2024/11/07 12:26 by ursgraf