Coder Social home page Coder Social logo

deavey / some-ip Goto Github PK

View Code? Open in Web Editor NEW

This project forked from microchiptech/some-ip

0.0 0.0 0.0 41.34 MB

Example for device-to-device communication over automotive bus systems using SOME/IP.

License: BSD 3-Clause "New" or "Revised" License

Shell 3.63% C++ 90.29% CMake 6.08%

some-ip's Introduction

SOMEIP

The below steps show how to compile the dependencies so as to build and execute SOME/IP applications across different nodes. We use CodeGenerator for Generating Interface code specific to our application, as well as Glue code for binding to either DBus or SOME/IP for communication

NOTE: I'm adding the source for 3 libraries which are essential for creating SOME/IP based applications. These 3 libraries are compatible with each other (Some versions might not be compatible) - Hence adding the code.

Primary Requirements

It is assumed that, you have 2 machines, preferably Raspberry PI's for testing the build. We would be running the server and client on 2 different nodes. This repository should be present on both the machines.

sudo apt-get update
sudo apt-get install doxygen asciidoc graphviz source-highlight libboost-system-dev libboost-thread-dev libboost-log-dev

Any boost version above 1_55 would be good, you can check the version with this command:

cat /usr/include/boost/version.hpp | grep "BOOST_LIB_VERSION"

Build Instructions

If you plan to build the dependencies from svn repository follow the instructions below.

Please note that build instruction would help you kick start with SOME-IP.

If you are planning to develop new features, please do refer the "How to extend" section First

Start compiling:

cd ~/SOME-IP/trunk/capicxx-core-runtime/
mkdir build && cd build
cmake .. && make

You should now find the libraries in the capicxx-core-runtime/build folder.

cd ../..
cd vsomeip
mkdir build && cd build
cmake .. && make

You should now find the libraries in the vsomeip/build folder.

cd ../..
cd capicxx-someip-runtime
mkdir build && cd build
cmake -DUSE_INSTALLED_COMMONAPI=OFF .. ; make

You should now find the libraries in the capicxx-someip-runtime/build folder. Once all the libraries are build, you can directly build the applications. These 3 libraries are a MUST for developing SomeIP applications using the code generator. Later on we might refer the above libraries as "SomeIP libraries" for ease.

Now lets build the project developed using the above library

cd ../..
cd project
mkdir build && cd build
cmake .. && make

SomeIP has a lot of user defined configurations. It is almost impossible to list them as command line parameters. We use a json file for doing the same. Edit the json files present in the config folder to reflect the correct network parameter of the machines like ip-address and subnet-mask.

eg:

client node with ip 10.40.32.110
{
	"unicast" : "10.40.32.110",
		"netmask" : "255.255.255.0",
		"logging" :
		{
service node with ip 10.40.32.89
{
	"unicast" : "10.40.32.89",
		"logging" :
		{

Also in the service json file, make sure you give the correct service ID and Instance ID

	"services" :
		[
		{
			"service" : "0x10",
			"instance" : "22136",
			"reliable" : { "port" : "30509", "enable-magic-cookies" : "false" },
			"unreliable": "31000"
		}
		],

This data can be found from the corresponding fdepl files

define org.genivi.commonapi.someip.deployment for interface com.microchip.IDemo {

	SomeIpServiceID = 16

This is the service ID in decimal

define org.genivi.commonapi.someip.deployment for provider Service {
	instance com.microchip.IDemo {
		 InstanceId = "com.microchip.demo"
		SomeIpInstanceID = 22136
	}
}

This is the Instance ID in decimal. This step would only be relevant if you plan on adding new interfaces in the fidl folder. For the Demo interface, the author has already set the instance and service ID's properly.

please use the the service.sh files present in the

> cd project/scripts
> ./service.sh

to execute the service. Likewise, you can find the client .sh in

> cd project/config
> ./client.sh

folder. The client.sh and service.sh would set the proper environment variables and execute the service and client by passing the proper json files as parameters.

How to extend

Edit the fidl files and corresponding fdepl files to add new interfaces/methods/attributes. You can find the fidl files and fdepl files in

cd project/fidl

A detailed description on how to edit the fidl files is present in

SOME-IP/trunk/CommonAPICppUserGuide.pdf

Once you have added your interface and methods, Its time to generate the corresponding source files. For this we need a Linux-x86 machine. I used a Ubuntu 16.04 running on x86_64. We are using pre-build executables to generate code from fidl/fdepl. There is no executable for a Linux-arm machine. Checkout the

SOME-IP/trunk/project

onto your Ubuntu machine. Do the following

cd SOME-IP/trunk/project/cgen
unzip commonapi_someip_generator.zip -d commonapi_someip_generator
unzip commonapi-generator.zip -d commonapi-generator
cd ..
rm -rf src_gen

Edit gen_src.sh file to point to the right fidl and fdepl files. For eg: If we have added 2 new files New.fidl and New.fdepl, edit the file to

./cgen/commonapi-generator/commonapi-generator-linux-x86_64 -sk ./fidl/New.fidl
./cgen/commonapi_someip_generator/commonapi-someip-generator-linux-x86_64 ./fidl/New.fdepl

Save the file. Run the script by

./gen_src.sh

This would create a src_gen folder which would contain all the generated source files. Now you can develop your application by implementing the interfaces that you have defined in the fidl/fdepl. A detailed description of writing application with the generated source files are given in

SOME-IP/trunk/CommonAPICppUserGuide.pdf

Once the applications are ready, Proceed as per the Build section

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.