User Tools

Site Tools


getting_started:write_app:use_on_cb20

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
getting_started:write_app:use_on_cb20 [2021/03/24 16:02] ursgrafgetting_started:write_app:use_on_cb20 [2021/04/30 13:44] – [Say Hello with EEROS] ursgraf
Line 2: Line 2:
 Back to [[getting_started:install:use_with_cb20|]]. Back to [[getting_started:install:use_with_cb20|]].
  
-Edit the file ''config.sh.in'' as follows +You will use C++ to develop your EEROS applications. For this you need at least some knowledge of the basic language featuresA good starting point might be [[https://www.cplusplus.com/doc/tutorial/]]. Minimal help can also be found under [[tools:cplusplus|]].
-<code> +
-use_simulator=false +
-use_flink=true +
-use_bbblue=false +
-use_comedi=false +
-use_ros=false +
-use_can=false +
-use_custom_application=true +
-use_cross_compilation_environment=true +
-use_ros_setup_script=false +
-</code>+
  
-The entry ''use_cross_compilation_environment'' ensures that you compile using an SDK built for the target platform. Make sure to install the SDK by +What do you want to do next?
-  * downloading the SDK from [[https://wiki.bu.ost.ch/infoportal/software/linux/images/start|Linux Images]]  +
-  * installing the SDK as described in [[https://wiki.bu.ost.ch/infoportal/software/linux/toradex/toradex-sdk]]+
  
-Edit the file ''config.sh.in'' as follows +  * [[getting_started:write_app:use_on_cb20#Say Hello with EEROS|]] 
-<code> +  * [[getting_started:write_app:use_on_cb20#Use Existing Project|]] 
-environment_setup_script=/opt/tdx-xwayland/5.0.0/environment-setup-armv7at2hf-neon-tdx-linux-gnueabi+ 
 +===== Say Hello with EEROS ===== 
 + 
 +  - Fetch the [[https://github.com/eeros-project/eeros-build-scripts.git|EEROS scripts]] on your host and checkout the branch for the cb20 board <code> 
 +$ git clone https://github.com/eeros-project/eeros-build-scripts.git eeros-project 
 +$ cd eeros-project 
 +$ git checkout sdk_cb20
 </code> </code>
-This will guide your make script to use the SDKMake sure that the above path matches your installation path.+  - Edit the file ''config.sh.in'' as follows <code> 
 +custom_application_name=hello 
 +</code> 
 +  - Create a project directory and change into it with <code> 
 +$ mkdir hello 
 +$ cd hello  
 +</code> 
 +  - Create a text file "main.cpp" and copy the following code into it <code cpp> 
 +#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";
  
-If you want to use CAN, choose  +  return 0; 
-<code> +}
-use_can=true+
 </code> </code>
 +  - Create a text file "CMakeLists.txt" and copy the following text into it: <code cpp>
 +cmake_minimum_required(VERSION 3.5.1)
 +project(helloworld)
  
-Setting the entry ''use_custom_application'' to //true// will fetch an existing application from a git repositoryPer 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. \\ +set(CMAKE_CXX_STANDARD 14) 
-Now you can run the ''clone'' script  + 
-<code>+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}) 
 +</code>  
 +  - Change back into your parent directory and build the project with <code> 
 +$ cd .. 
 +$ ./make.sh 
 +</code> 
 +  - Make changes to "main.cpp", save them and rebuild with <code> 
 +$ ./make.sh 
 +</code> 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_cb20|]]. 
 + 
 +===== Use Existing Project ===== 
 +As an example we use the [[getting_started:tutorials:oneaxis|]] demo program. 
 +  - Edit the file ''config.sh.in'' as follows <code> 
 +custom_application=simple-motor-control 
 +</code> 
 +  - Fetch the code of the application with <code>
 $ ./clone.sh $ ./clone.sh
 </code> </code>
 +  - Build the project with <code>
 +$ ./make.sh
 +</code>
 +
 +Continue with [[getting_started:deploy:deploy_cb20|]].
 +
 +
  
-After this you can continue with [[getting_started:compile_eeros|]]. 
  
  
Line 43: Line 84:
 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 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
 <code> <code>
-use_custom_application=true 
 custom_application_name=cb20test custom_application_name=cb20test
 </code>   </code>  
Line 55: Line 95:
 </code>   </code>  
  
-Now you can run the ''clone'' script  +After this you continue as given above in [[getting_started:write_app:use_on_cb20#Use Existing Project|]].
-<code> +
-$ ./clone.sh +
-</code> +
- +
-After this you can continue with [[getting_started:compile_eeros|]].+
  
getting_started/write_app/use_on_cb20.txt · Last modified: 2024/06/13 13:54 by ursgraf