이전에서 CommonAPI 관련 라이브러리를 설치 완료하였다.



이번에는 Franca 형식으로 인터페이스를 작성하고 Dbus , Someip 코드로 생성해보도록 하겠다.


원문링크

https://github.com/GENIVI/capicxx-someip-tools/wiki/CommonAPI-C---SomeIP-in-10-minutes#step4



1. 폴더를 생성후 HelloWorld.fidl 을 작성한다.


다음 명령을 통하여 파일을 검색한다.

$ find ./ -name "CommonAPI-SOMEIP_deployment_spec.fdepl"



./capicxx-someip-tools/org.genivi.commonapi.someip/deployment/CommonAPI-SOMEIP_deployment_spec.fdepl


kj@kj:~/GENIVI/ComAPI_New/tools/test$ mkdir project

kj@kj:~/GENIVI/ComAPI_New/tools/test$ cd project/

kj@kj:~/GENIVI/ComAPI_New/tools/test/project$ ls

kj@kj:~/GENIVI/ComAPI_New/tools/test/project$ mkdir fidl

kj@kj:~/GENIVI/ComAPI_New/tools/test/project$ cd fidl/

vim HelloWorld.fidl


package commonapi


interface HelloWorld {

  version {major 1 minor 0}

  method sayHello {

    in {

      String name

    }

    out {

      String message

    }

  }

}






2. 코드 생성하기 

제너레이더 파일을 다운받는다.


툴을 다운받아 두개의 폴더에 각각 압축을 해제하였다.


dbus_gen  someip_gen


http://genivi.github.io/capicxx-dbus-tools/

http://genivi.github.io/capicxx-someip-tools/


생성되는 폴더명은 v[M버전]/ package 내임 . 별로 폴더생성 과 같다.

dbus_gen 폴더로 이동 후 zip 파일을 압축해제


 ./commonapi-dbus-generator-linux-x86_64 ../fidl/HelloWorld.fidl 


Executing CommonAPI DBus Code Generation...


Using Franca Version 0.9.1.201412191134

Generating code for /home/kj/GENIVI/ComAPI_New/tools/test/project/dbus_gen/../fidl/HelloWorld.fidl 




3. 결과물 확인




src_gen 폴데에 해당 소스파일들이 생성된다.

src-gen/v1/commonapi


[FileName]+DBusDeployment.cpp

[FileName]+DBusDeployment.hpp

[FileName]+DBusDBusProxy.cpp

[FileName]+DBusDBusProxy.hpp

[FileName]+DBusDBusStubAdapter.cpp

[FileName]+DBusDBusStubAdapter.hpp



Deployment , Proxy, StubAdapter 라는 파일이 생성된다.



다음으로 someip  코드도 작성하여 생성해보도록 한다.


원문 : https://github.com/GENIVI/capicxx-someip-tools/wiki/CommonAPI-C---SomeIP-in-10-minutes


1. 파일 생성 

vim 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 = 123

        }

}


define org.genivi.commonapi.someip.deployment for provider MyService {

        instance commonapi.HelloWorld {

                InstanceId = "test"

                SomeIpInstanceID = 22136

        }

}


2. someip_gen 

 

제너레이터 폴더로 이동후 코드 생성하기


./commonapi-someip-generator-linux-x86_64 ../fidl/HelloWorld.fdepl 




3. 생성된 파일확인

  src-gen 폴더에 생성된다.


[FileName]+SomeIPDeployment.cpp

[FileName]+SomeIPDeployment.hpp

[FileName]+SomeIPDBusProxy.cpp

[FileName]+SomeIPDBusProxy.hpp

[FileName]+SomeIPDBusStubAdapter.cpp

[FileName]+SomeIPDBusStubAdapter.hpp 


파일이 생성된다. 




/commonapi-generator-linux-x86_64 를 사용하여 코드생성시에 옵션이 존재한다.

-sk 옵션

 -sk,--skel <arg>                   Generate skeleton code. The optional argument specifies the postfix. 

Without argument, the postfix is 'default'

 






생성된 코드를 활용하여 어플리케이션 코드 작성은 다음에 정리 

'Embedded > CommonAPI' 카테고리의 다른 글

[Memory-1] fidl 작성하기 -작성중  (0) 2019.01.04
[GENIVI] ARA integration project  (0) 2019.01.04
[CommonAPI C++] D-Bus binding  (0) 2019.01.03
[CommonAPI] tool 설치 작성중  (0) 2019.01.02
[Dbus] 사용하기  (0) 2018.12.28


http://genivi.github.io/capicxx-dbus-tools/


D-bus를  위한 CommonAPI C++


CommonAPI C++ 은 내부 프로세스간 통신을 하기위한 C++ 프레임워크이다. high-level 의 C++  API 로 구성되어 있으며 D-Bus 와 같은 다양한 IPC 메커니즘에서 사용할 수 있다.



자세한 사항은  http://genivi.github.io/capicxx-core-tools/ 를 참고


CommonAPI C++ D-Bus 바인딩은 표준 D-Bus 라이이브러리를 기반으로 하지만 런타임 코드와 함께 게시되는 libdbus 패치가 필요하다.


기본 기능

 D-Bus 메시지의 고성능 직렬화



링크 


CommonAPI D-Bus C++ User Guide


CommonAPIDBusCppUserGuide.pdf 문서 참고


의존성

 libdbus , CommonAPI , cmake


제한사항

 Dbus 서명의 경우 255자를 넘지 않아야 함



설치시 관련 필요 라이브러리

 DBus 

dbus-1.12.2-r0

dbus-c++ 1_0.9.0

common-api-c++ 3.1.12-r0

common-api-c++-dbus 3.1.12-r0

common-api-c++-someip 3.1.12-r0

vsomeip 2.10.21



관련 소스코드 다운로드


/home/kj/GENIVI/ComAPI_New


$ git clone https://github.com/GENIVI/capicxx-core-runtime.git

$ git clone https://github.com/GENIVI/capicxx-dbus-runtime.git

$ git clone https://github.com/GENIVI/dlt-daemon.git

$ git clone https://github.com/GENIVI/vsomeip.git

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


#!/bin/bash

git clone https://github.com/GENIVI/capicxx-core-runtime.git

git clone https://github.com/GENIVI/capicxx-dbus-runtime.git

git clone https://github.com/GENIVI/dlt-daemon.git

git clone https://github.com/GENIVI/vsomeip.git

git clone https://github.com/GENIVI/capicxx-someip-runtime.git


브랜치 변경



현재 우분투의 dbus 버전 확인

$ dpkg -l | grep dbus


$ dpkg -l | grep dbus

dbus                        1.12.2-1ubuntu1                              amd64        simple interprocess messaging system (daemon and utilities)

dbus-user-session  1.12.2-1ubuntu1                              amd64        simple interprocess messaging system (systemd --user integration)


인터넷 검색하여 Ubuntu16.04 dbus download

https://launchpad.net/ubuntu/+source/dbus/1.12.2-1ubuntu1


dbus_1.12.2.orig.tar.gz2.0 MiB272bb5091770b047c8188b926d5e6038fa4fe6745488b2add96b23e2d9a83d88
dbus_1.12.2-1ubuntu1.debian.tar.xz61.0 KiB7c968a77cc7f8512229f190b51a619cf7b5901db0cf43fcae6c367eff1ede78c



두파일을 다운로드 한다.

한폴더에 압축해제

tar xvf dbus_1.12.2-1ubuntu1.debian.tar.xz

tar xvf dbus_1.12.2.orig.tar.gz



debian/patches/ubuntu 폴더의 패치 파일 복사 cp * ../../../dbus-1.12.2/



capicxx-dbus-runtime/src/dbus-patches 폴더안에 패치파일을 dbus 폴더로 복사한다.

소스의 패치적용



dbus-1.12.2 설치하기


./configure --prefix=/opt/Ngenivi --with-system-socket=/run/dbus/system_bus_socket



make -C dbus

make -C dbus install

make install-pkgconfigDATA


  /bin/mkdir -p '/opt/Ngenivi/lib/pkgconfig'

 /usr/bin/install -c -m 644 dbus-1.pc '/opt/Ngenivi/lib/pkgconfig'


환경변수 적용하기

export PKG_CONFIG_PATH=/opt/Ngenivi/lib/pkgconfig:$PKG_CONFIG_PATH

export LD_LIBRARY_PATH=/opt/Ngenivi/lib/:$LD_LIBRARY_PATH



설치시 폴더이동후 build 폴더생성은 생략하도록 한다.

capicxx-core-runtime 설치하기



mkdir build

cd build

cmake -D CMAKE_INSTALL_PREFIX=/opt/Ngenivi ..



capicxx-dbus-runtime 설치하기


mkdir build

cd build

cmake -D CMAKE_INSTALL_PREFIX=/opt/Ngenivi ..


vsomeip 설치 


cmake -D USE_INSTALLED_COMMONAPI=ON -D CMAKE_INSTALL_PREFIX=/opt/Ngenivi/ ..



capicxx-someip-runtime  설치



cmake -D USE_INSTALLED_COMMONAPI=ON -D CMAKE_INSTALL_PREFIX=PREFIX=/opt/Ngenivi/ .. 



dlt-daemon 까지 동일하게 설치



관련 라이브러리 설치완료 

환경변수 파일 생성



소스코드 생성은 다음 포스팅을 참고

2019/01/02 - [Embedded/CommonAPI] - [CommonAPI] tool 설치 작성중



'Embedded > CommonAPI' 카테고리의 다른 글

[GENIVI] ARA integration project  (0) 2019.01.04
[Franca] 작성하고 코드 생성하기  (0) 2019.01.03
[CommonAPI] tool 설치 작성중  (0) 2019.01.02
[Dbus] 사용하기  (0) 2018.12.28
[GENIVI] 개발환경설정  (0) 2018.12.20

https://elinux.org/R-Car/Boards/M3SK#Flashing_firmware


Writing data (Yocto v2.23 or later)
FilenameProgram Top AddressFlash Save AddressDescription
bootparam_sa0.srec0xE63200000x000000Loader(Boot parameter)
bl2-m3ulcb.srec0xE63040000x040000Loader
cert_header_sa6.srec0xE63200000x180000Loader(Certification)
bl31-m3ulcb.srec0x440000000x1C0000ARM Trusted Firmware
tee-m3ulcb.srec0x441000000x200000OP-Tee
u-boot-elf.srec0x500000000x640000U-Boot


'Embedded > Board' 카테고리의 다른 글

[GDP]RCar opencv 설치 및 빌드 SDK 생성  (0) 2019.01.16
[GDP] Rcar-M3 어플리케이션제어  (2) 2019.01.11
휴대폰 정보  (0) 2019.01.02
[GDP] Build Error  (0) 2018.12.28
[GDP] qemu x86_64  (0) 2018.12.28

+ Recent posts