This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

*/

Franca IDL 예제

Eclipse-based Franca툴 설치하기

예제프로젝트 Import


  • Franca에서 제공하는 예제 프로젝트 org.franca.examples.basic를 이용하여 아래의 순서대로 import해보자.
    1. Eclipse에서 File > Import ... 순서로 선택한다.
    2. 열려진 다이얼로그박스에서, General > Existing projects into workspace.를 선택한다.
    3. Import 다이얼로그박스에서, Browse.. 버튼을 눌러 org.franca.examples.basic 디렉토리를 선택한다.
    4. Projects 리스트에서 위에서 추가한 프로젝트를 선택한다.
    5. Copy projects into workspace 항목은 체크하지않은 상태를 유지한다.
    6. Finish 버튼을 누른다.
  • 위의 순서대로 하면 예제 프로젝트가 Package Explorer창에 보인다. 거기에서 models/org/example/MediaPlayer.fidl을 더블 클릭하면 아래와 같이 fidl 에디터가 열린다.

Embedded Linux board에 Python 3.6 설치하기

먼저 레포지토리를 추가한다
$ sudo add-apt-repository ppa:jonathonf/python-3.6
apt를 업데이트한다.
$ sudo apt-get update
Python 3.6을 설치한다.
$ sudo apt-get install python3.6

Python 3.6을 실행시킨다.
$ python3

Franca 설치 가이드

Franca 설치 가이드
설치 환경
OS : Windows 10, 64bit

참고 : https://github.com/franca/franca/wiki/Franca-Quick-Install-Guide
설치 순서

  1. 이클립스 인스톨러를 사용하여 Eclipase Oxygen 2의 Eclipse DSL 도구 에디션을 설치한다.
    •   Franca는 JAVA 8에서 가장 잘 동작한다.
    • 설치시 JAVA 머신이 설치되어 있지 않으면다음과 같은 메세지 박스가 출력된다.
    • 아니요 선택시 Eclipse site에서 Java 1.8.0선택시 Oracle site로 포워딩후 JDK 다운로드한다.
    • JDK 설치후 다시 인스톨 진행한다. DSL Tools를 선택하고, VM위치와 작업디렉토리를 결정한다.
    • JDK 설치후 다시 인스톨한다. DSL Tools를 선택하고, VM위치와 작업디렉토리를 결정한다.
  2. eclipse.exe를 실행
  3. Franca extention을 위해 추가적으로 Eclipse plugin package들을 설치
  4. 구글드라이브에서 최신버젼을 다운로드 한다. Release 폴더에서 최신버젼(0.13.1 2018년 7월 23일)
  5. Help > Install New Software ...에서 Add 클릭하고 Archive.... 선택해서 위에서 다운로드 받은 zip파일을 Open하고 모든 것을 선택하여 설치한다.
  6. 설치완료.. empty 프로젝트를 생성하여 확장자 fidl파일을 추가 하여 Franca IDL Editor로 편집한다.
설치
Eclipse : https://www.eclipse.org/downloads/

관련링크 :
CommonAPI Stub? Proxy?
SOME/IP 헤더 구조와 fdepl파일 관계
CommonAPI Generator로 생성되는 file
Franca 설치 가이드
Linux Xubuntu에 CommonAPI C/C++ 개발환경 구축하기

CommonAPI C++ with SOME/IP Example

순서

  1. CommonAPI C++런타임 라이브러리 작성 
  2. 런타임라이브러리 작성
  3. Franca파일 작성 및 코드 생성
  4. 클아이언트 및 서비스 응용 프로그램 작성
  5. 빌드 및 실행
Dependencies
  • A C++11 enabled compiler like gcc >= 4.8 is needed.
  • vsomeip uses CMake as buildsystem.
  • vsomeip uses Boost >= 1.55:
  • JAVA JRE Runtime(Oracle JRE 참고)
Test Version
  • CommonAPI runtime : 3.1.12.6
  • SOME/IP runtime : 3.1.12.9
  • vsomeip : 2.14.16
  • libboost : 1.58
시작하기 전에 개발환경구축했는지 확인하고 하자..

    1.CommonAPI C++런타임 라이브러리

    • COMMONAPI 다운로드                           
    $ git clone https://github.com/GENIVI/capicxx-core-runtime.git

    $ cd capicxx-core-runtime
    capicxx-core-runtime$ mkdir build
    capicxx-core-runtime$ cd build
    capicxx-core-runtime/build$ cmake ..


    capicxx-core-runtime/build$ make

    capicxx-core-runtime/build$ mkdir ../../COMMONAPI 
    capicxx-core-runtime/build$ cp -d lib* ../../COMMONAPI 
    capicxx-core-runtime/build$ cd ../..

    2. CommonAPI SOME/IP 런타임 라이브러리 작성

    • SOME/IP
    $ git clone https://github.com/GENIVI/capicxx-someip-runtime.git


    • Boost Install
    $ sudo apt-get install libboost-system1.55-dev libboost-thread1.55-dev libboost-log1.55-dev

    :

    ** Package가 없다고 메세지가 나올때 "sudo apt search libboost" 명령어로 버젼을 확인후 해당버전을 인스톨한다.

    $ git clone http://github.com/GENIVI/vSomeIP.git

    ** SOME/IP는 코어 네트워크 펑션을 사용하기 위해 표준 크로스플랫폼 C++라이브러리 Boost.Asio를 사용함으로 vsomeip라이브러리를 사용하기 전에 Boost를 시스템에 인스톨해야한다.
    ** vsomeip를 빌드하기 전에 2.xx 버전에서 실행한다.  vsomeip의 버젼이 3.xx버전일 경우 2.xx버젼에서 수행 하도록 한다.
    • Build vsomeip
    $ cd vSomeIP
    vSomeIP$ mkdir build
    vSomeIP$ cd build
    vSomeIP/build$ cmake ..


    vSomeIP/build$ make


    vSomeIP/build$ cp -d lib* ../../COMMONAPI
    vSomeIP/build$ cd ../..
    • Build CommonAPI C++ SOME/IP
    $ cd capicxx-someip-runtime/
    capicxx-someip-runtime$ mkdir build
    capicxx-someip-runtime$ cd build
    capicxx-someip-runtime/build$ cmake -DUSE_INSTALLED_COMMONAPI=OFF ..

          ** cmake시 vsomeip관련 오류 발생시 vsomeip의 버전 체크 필요.
          ** vsomeip의 버젼이 3.xx버전일 경우 2.xx버젼에서 수행

    capicxx-someip-runtime/build$ make

    capicxx-someip-runtime/build$ cp -d lib* ../../COMMONAPI
    capicxx-someip-runtime/build$ cd ../..

    3. Franca파일 작성 및 코드 생성

    프로젝트 디렉토리 생성하고  디렉토리의 하위에 fidl 디렉토리생성 및 해당 디렉토리상에 아래의 deployment specification를 작성
    • HelloWorld.fdepl
    import "platform:/plugin/org.genivi.commonapi.someip/deployment/CommonAPI-SOMEIP_deployment_spec.fdepl"
    import "HelloWorld.fidl"
    define org.genivi.commonapi.someip.deployment for interface commonapi.HelloWorld {
      SomeIpServiceID = 4660 method sayHello {
         SomeIpMethodID = 31000
      }
    }
    define org.genivi.commonapi.someip.deployment for provider MyService {
      instance commonapi.HelloWorld {
         InstanceId = "test"
         SomeIpInstanceID = 22136
      }
    }
    • HelloWorld.fidl
    package commonapi
    interface HelloWorld {
       version {major 1 minor 0}
       method sayHello {
          in {
             String name
          }
          out {
             String message
          }
       } 
    }
    • Get CommonAPI, SOME/IP Code Generator
    $ wget https://github.com/GENIVI/capicxx-core-tools/releases/download/3.1.12.4/commonapi-generator.zip

    $ wget https://github.com/GENIVI/capicxx-someip-tools/releases/download/3.1.12.2/commonapi_someip_generator.zip
    $ unzip commonapi-generator.zip -d ~/commonapi-generator
    $ unzip commonapi_someip_generator.zip -d ~/commonapi_someip_generator
    $ chmod +x ~/commonapi-generator/commonapi-generator-linux-x86
        * OS가 64bit일경우 commonapi-generator-linux-x86_64 파일에 적용
    $  chmod +x ~/commonapi_someip_generator/commonapi-someip-generator-linux-x86
        * OS가 64bit일경우 commonapi-someip-generator-linux-x86_64 파일에 적용
    • Generate SOME/IP Code
    $ mkdir hello
    $ cd hello
    hello$ ~/commonapi-generator/commonapi-generator/commonapi-generator-linux-x86 -sk ./fidl/HelloWorld.fidl
    hello$ ~/commonapi_someip_generator/commonapi-someip-generator-linux-x86 -ll verbose /fidl/HelloWorld.fdepl

    hello$ cd src-gen/v1/commonapi
    hello/src-gen/v1/commonapi$ ls -la

    ** generator는 JAVA 머신상에서 돌아감으로 JRE가 설치되어 있어야 동작함.. 설치방법 참조

    4.클라이언트 및 서비스 응용프로그램 작성

    • Create src and build directories
    hello$ mkdir src
    hello$ mkdir build
    hello$ ls
    >>> build  cgen  fidl  src  src-gen
    hello$ cd src
    src 디렉토리에 아래의 4개화일을 생성한다.
    • HelloWorldClient.cpp
    #include <iostream>
    #include <string>
    #include <unistd.h>
    #include </CommonAPI.hpp>
    #include <v1/commonapi/HelloWorldProxy.hpp>
      
    using namespace v1_0::commonapi;
      
    int main() {
        std::shared_ptr <CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
        std::shared_ptr<HelloWorldProxy<>> myProxy = runtime->buildProxy<HelloWorldProxy>("local", "test");
    
      
        std::cout << "Checking availability!" << std::endl;
        while (!myProxy->isAvailable())
            usleep(10);
        std::cout << "Available..." << std::endl;
      
        CommonAPI::CallStatus callStatus;
        std::string returnMessage;
        myProxy->sayHello("Bob", callStatus, returnMessage);
        std::cout << "Got message: '" << returnMessage << "'\n";
    
        return 0;
    } 
    • HelloWorldService.cpp
    #include <iostream>
    #include <thread>
    #include <CommonAPI/CommonAPI.hpp>
    #include "HelloWorldStubImpl.hpp"
    
    using namespace std;
    
    int main() {
         std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
         std::shared_ptr<HelloWorldStubImpl> myService = std::make_shared<HelloWorldStubImpl>();
         runtime->registerService("local", "test", myService);
         std::cout << "Successfully Registered Service!" << std::endl;
      
         while (true) {
             std::cout << "Waiting for calls... (Abort with CTRL+C)" << std::endl;
             std::this_thread::sleep_for(std::chrono::seconds(30));
         }
       
         return 0;
      }
    • HelloWorldStubImpl.hpp
    #ifndef HELLOWORLDSTUBIMPL_H_
    
    #define HELLOWORLDSTUBIMPL_H_
       
    
    #include <CommonAPI/CommonAPI.hpp>
    
    #include <v1/commonapi/HelloWorldStubDefault.hpp>
       
    
    class HelloWorldStubImpl: public v1_0::commonapi::HelloWorldStubDefault {
    
    public:
         HelloWorldStubImpl();
         virtual ~HelloWorldStubImpl();
         virtual void sayHello(const std::shared_ptr<CommonAPI::ClientId> _client, std::string _name, sayHelloReply_t _return);
    
    };
      
    
    #endif /* HELLOWORLDSTUBIMPL_H_ */

    • HelloWorldStubImpl.cpp
    #include "HelloWorldStubImpl.hpp"
    HelloWorldStubImpl::HelloWorldStubImpl() { }
    HelloWorldStubImpl::~HelloWorldStubImpl() { }
    void HelloWorldStubImpl::sayHello(const std::shared_ptr<CommonAPI::ClientId> _client, std::string _name, sayHelloReply_t _reply) {
        std::stringstream messageStream;
        messageStream << "Hello " << _name << "!";
        std::cout << "sayHello('" << _name << "'): '" << messageStream.str() << "'\n";
        _reply(messageStream.str());
    };

    5.빌드및 실행

    프로젝트 디렉토리(hello)에 아래 파일을 생성한다.
    • CMakeLists.txt

    cmake_minimum_required(VERSION 2.8)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -std=c++0x")
    include_directories(
        src-gen
        ~/work2/capicxx-core-runtime/include
        ~/work2/capicxx-someip-runtime/include
        ~/work2/vSomeIP/interface
    )
    link_directories(
        ~/work2/COMMONAPI
    )
    add_executable(HelloWorldClient
        src/HelloWorldClient.cpp
        src-gen/v1/commonapi/HelloWorldSomeIPProxy.cpp
        src-gen/v1/commonapi/HelloWorldSomeIPDeployment.cpp
    )
    target_link_libraries(HelloWorldClient CommonAPI CommonAPI-SomeIP vsomeip)
    add_executable(HelloWorldService
        src/HelloWorldService.cpp
        src/HelloWorldStubImpl.cpp
        src-gen/v1/commonapi/HelloWorldSomeIPStubAdapter.cpp
        src-gen/v1/commonapi/HelloWorldStubDefault.cpp
        src-gen/v1/commonapi/HelloWorldSomeIPDeployment.cpp
    )
    target_link_libraries(HelloWorldService CommonAPI CommonAPI-SomeIP vsomeip)

    • Build
    hello$ cd build
    hello/build$ cmake ..
    hello/build$ make




    Reference
    1. GENIVI Git hub : https://github.com/GENIVI
    2. CommonAPI C++ SOME/IP in 10 minutes( https://at.projects.genivi.org/wiki/pages/viewpage.action?pageId=5472320 )

    Orange Pi Lite 2 O/S 설치하기

    Orange Pi Lite 2의 O/S 이미지와 설치 파일 위치 ( http://www.orangepi.org/downloadresources/) 에서 필요한 파일들을 다운로드 받는다.


    기본적으로 메뉴얼 및 단말에 설치하고자 하는 이미지를 선택한다. 예를 들어 데비안을 선택하면 아래와 같이 나오고 구글드라이브나 메가크라우드, 바이두 크라우드에서 다운 받을수 있는 화면이 나온다.

    마음에 드는곳에서 다운받고, 화면 제일 하단에서 Win32DiskImager-0.9.5-binary 를 다운받아 압축을 해제하고 실행시킨다.

    위에서 다운받은 이미지(압축해제한)를 선택하고, 준비된 8GByte이상의 SD카드를 PC에 넣고 ‘Write”시킨다.

    Write가 끝나면 SD를 OrangePi에 넣고  전원을 넣으면 HDMI로 로그인 화면을 볼수 있다.
    ID와 PW는 O/S 이미지 다운받을때 적혀있던 root/orangepi를 사용한다.




    Ubuntu에서 어떤 종류의 package가 있는지 검사하는 방법

    리눅스에서 어떤 프로그램(package)가 있는지 검사할때 아래와 같이 apt-cache 명령을 쓴다
    $apt-cache search <key word>

    예를 들어 crossbuild-essential-armhf는 아는데 다른 종류의 크로스빌드툴은 어떤게 있는지 확인하고자 할때 다음과 같이 검색할 수 있다.
    @ubuntu:~$ apt-cache search build-essential
    
    build-essential - Informational list of build-essential packages
    crossbuild-essential-arm64 - Informational list of cross-build-essential packages
    crossbuild-essential-armhf - Informational list of cross-build-essential packages
    crossbuild-essential-powerpc - Informational list of cross-build-essential packages
    crossbuild-essential-ppc64el - Informational list of cross-build-essential packages
    devscripts - scripts to make the life of a Debian Package maintainer easier
    crossbuild-essential-armel - Informational list of cross-build-essential packages
    crossbuild-essential-s390x - Informational list of cross-build-essential packages
    dh-buildinfo - Debhelper addon to track package versions used to build a package
    sbuild - Tool for building Debian binary packages from Debian sources

    Ubuntu 사용중 Could not get lock /var/lib/dpkg/lock 오류 발생할 때

    E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
    
    E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

    우분투 사용중 위와 같은 오류가 발생하는 경우가 있다. 이경우는 /var/lib/dpkg/lock파일이 존재할때 생기는 문제로 아래와 같이 해당 파일을 지워주면 해결된다
    sudo rm /var/lib/apt/lists/lock
    
    sudo rm /var/cache/apt/archives/lock
    
    sudo rm /var/lib/dpkg/lock
    
    sudo dpkg --configure –a