汽车SOA

Pobear SOFT

1 Power Point
EV Stop: Ctrl + Fn + F2
Mind Map: Tecent docs for Windows
pdf-xchangeeditor
ppt:
Insert - Shapes
Insert - Symbol - More Symbols - Wingdings 2
Windows 10: Desktop Window Manager
Win + x

2 第三方协议栈
2.1 开源
1) uC/IP
2) LwIP

2.2 商业协议栈
1) Treck's TCP/IP
- HP打印机
- INTEGRITY RTOS
2) Zuken Elmic Inc.
Treck's TCP/IP被重命名成KASAGO TCP/IP。

2.3 SOMEIP Vendor
Excelforce and Vector.

3 WIZnet W5500
TCP连接加入心跳包能够实现断线后。N个周期(基于RTR - Retry Time-Value Register和RCR - Retry Count Register)后,若仍没有收到对方的ACK信号,则会触发超时中断。并同一时候将Socket状态变为Closed。

程序里仅仅要加上监听Socket状态变为Closed之后就又一次开始Socket监听/连接就可以实现断线重连。
MISO: mi s əu
MOSI: m əu si

4 Linux vSomeIP
4.1 vSomeIP
4.1.1 vSomeIP
1) SOME/IP is designed by BMW Lars Völker in 2011, joined in Technica Engineering GmbH on 1st-Oct 2019. BMW uses /var/run/someip/vsomeip-0 for routing_manager.
2) routing_manager
/tmp/vsomeip-0
/tmp/vsomeip-$CLIENTID: CLIENTID comes from json applications[n].id
vsomeip default config file (VSOMEIP_CONFIGURATION): /path/to/install/etc/vsomeip/vsomeip.json
3) G is for getter method, S is for setter method and N is for notification.

4.1.2 Serialization
I. Payload is Big-Endian byte ordering, refer to functions int serialize() and int deserialize()
II. array: 4-byte length + array
III. structure: 4-byte length + structure, refer to deserialize_EMMCInfoQuery_OutParams()
IV. string: 4-byte length (including BOM) + 3-byte BOM (EF BB BF) + string
V. Pay attention to the nested array, structure and string
for example:
struct A {
    int i;
    int j;
};
struct B {
    int k;
    struct A a;
};
struct B array[2];
4-byte length (sizeof(array)) +
4-byte length (sizeof(struct B)) + k + 4-byte length (sizeof(struct A)) + i + j +
4-byte length (sizeof(struct B)) + k + 4-byte length (sizeof(struct A)) + i + j +

4.2 Endpoint
Endpoint is based on boost.asio async_write() and async_receive().
SOME/IP Transport Protocol for UDP segment, TP-Flag = Message Type.bit2
For all TCP/UDP endpoints.
applications - /tmp/vsomeip-0 - TCP/UDP - another device.

4.3 build vSomeIP
vsomeip libraries will be installed into directory /path/to/install, after that hello_world can link to /path/to/install/lib dynamically in runtime.

git clone https://github.com/COVESA/vsomeip.git
cd vsomeip
mkdir -p /path/to/install
export MY_INSTALL=/path/to/install

# You don't need mkdir build under vsomeip,
# instead cmake and make in root directory of
# vsomeip, above for fixing could not load cache.
# If you mkdir build under vsomeip, after cd build,
# .. for cmake finds CMakeLists.txt

cmake \
-DENABLE_SIGNAL_HANDLING=1 \
-DCMAKE_INSTALL_PREFIX:PATH=$MY_INSTALL
make
make install

4.4 build hello_world
cmake --build . --target hello_world
cd ./examples/hello_world/
make

4.5 run hello_world
There are three endpoints in hello_world demo, routing manager is /tmp/vsomeip-0, service sends data to client via /tmp/vsomeip-5555 (SOME/IP header low 16bit Client ID), client sends data to service via /tmp/vsomeip-4444 (SOME/IP header low 16bit Client ID).

export MY_INSTALL=/path/to/install
export LD_LIBRARY_PATH=$MY_INSTALL/lib

HOST1:
VSOMEIP_CONFIGURATION=\
./helloworld-local.json \
VSOMEIP_APPLICATION_NAME=\
hello_world_service \
./hello_world_service

HOST1:
VSOMEIP_CONFIGURATION=\
./helloworld-local.json \
VSOMEIP_APPLICATION_NAME=\
hello_world_client \
./hello_world_client

5 Linux eProsima Fast-DDS
5.1 eProsima Fast-DDS
colcon (collective construction) is based on CMake.
CDR: Common Data Representation
DDS: Data Distribution Service, DDS was released by Object Management Group (OMG)
RTPS: Real-Time Publish Subscribe
DDS-XTypes: OMG Extensible and Dynamic Topic types
PDP: Participant Discovery Phase, two endpoints
EDP: Endpoint Discovery Phase, four endpoints
WLP: Writer Liveliness Protocol, two endpoints

5.2 asio and tinyxml2
TinyXML2 is a C++ XML parser, for 5.5 build Fast-DDS.
apt install libasio-dev libtinyxml2-dev

5.3 build foonathan_memory
5.3 foonathan_memory, 5.4 Fast-CDR and 5.5 Fast-DDS libraries are all installed into the same directory /path/to/install, after that 5.7 HelloWorldExample can easily link to /path/to/install/lib in runtime.
mkdir -p /path/to/install
export MY_INSTALL=/path/to/install

git clone https://github.com/eProsima/foonathan_memory_vendor.git
cd foonathan_memory_vendor
mkdir build
cd build
# .. for cmake finds CMakeLists.txt
cmake .. \
-DCMAKE_INSTALL_PREFIX=$MY_INSTALL \
-DBUILD_SHARED_LIBS=ON
cmake --build . --target install

5.4 build Fast-CDR
Fast Buffers has not had a commit since 2014.
git clone https://github.com/eProsima/Fast-CDR.git
cd Fast-CDR
mkdir build
cd build
cmake .. \
-DCMAKE_INSTALL_PREFIX=$MY_INSTALL
cmake --build . --target install

5.5 build Fast-DDS
git clone https://github.com/eProsima/Fast-DDS.git
cd Fast-DDS
mkdir build
cd build
cmake .. \
-DCMAKE_INSTALL_PREFIX=$MY_INSTALL \
-DCMAKE_PREFIX_PATH=$MY_INSTALL
cmake --build . --target install

5.6 build Fast-DDS-Gen
git clone --recursive https://github.com/eProsima/Fast-DDS-Gen.git
cd Fast-DDS-Gen
./gradlew assemble
export PATH=$PATH:/path/to/Fast-DDS-Gen/scripts

5.7 run HelloWorldExample
cd Fast-DDS/examples/C++/DDS/HelloWorldExample
mkdir build
cd build
cmake .. \
-DCMAKE_PREFIX_PATH=$MY_INSTALL
cmake --build .

export MY_INSTALL=/path/to/install
export LD_LIBRARY_PATH=$MY_INSTALL/lib
./DDSHelloWorldExample publisher
./DDSHelloWorldExample subscriber

5.8 Fast-DDS QoS
Fast-DDS提供22种QoS策略。DDS的标准规范里没有明确给出DDS QoS向IP QoS的映射方法(可以查一下RTPS的规范),大多数商业DDS版本的实现一般都是软QoS,只能约束发布/订阅端的行为,对于传输过程的控制能力不足,当然有一些厂商对传输优先级做了一些优化,比如使用diff-serv协议,通过标记DSCP来控制IP报文优先级,当然这需要你的底层网络本身支持。

RFC791: IP Type of Service (ToS.b2...b0)
RFC2474: IP Differentiated Services CodePoint (DSCP.b5...b0), DSCP.b2...b0 is called Class Selector (CS), and compatible with ToS.b2...b0, released in December 1998
https://datatracker.ietf.org/doc/html/rfc2474

6 Wireshark SOMEIP plugin
6.1 插件安装
https://github.com/jamores/eth-ws-someip
Wireshark插件目录:Help -> About Wireshark -> Folders/Plugins
解压后,将所有后缀是lua的文件拷贝到Wireshark安装目录plugins/2.4.10/下。

There may be an error coming from someip.lua with Wireshark v3.6, please change it as shown below.
p_someip = Proto("test","my_test")

Wireshark 3.2 has builtin SOME/IP feature.
Analyze - Enabled Protocols... - Search some - Enable SOME/IP and SOME/IP-SD.

6.2 时间戳调整为UTC显示格式
View -> Time Display Format -> Date and Time of Day

6.3 常用过滤关键字
Wireshark解析MAC地址时会把前三个字节解析为一个公司的名字。
1)someip
2)ip.src == 192.168.1.1 - 改到对应的ip地址
3)ip.src == 192.168.1.1 and ip.dst == 192.168.1.2 - 改到对应的ip地址
4)someip.messageid == 0xffff8100 and ip.src == 192.168.1.2 - 改到对应的ip地址
5)dns - 调试域名解析
6)tcp.port == 8000
7)!(tcp.analysis.retransmission)
8)tcp.flags.syn==1 or tcp.flags.ack==0
9)tcp.flags.fin == 1
10)usb.src == "1.6.1" and usb.dst == "host" - 改到对应的USB bus_no.addr.ep_no
11)OFFER_SERVICE
12)FIND_SERVICE
13)SUBSCRIBE

6.4 SOMEIP TCP连接心跳包
SOMEIP TCP连接心跳包(4个字节):0x dead beef

6.5 tcpdump抓到的log循环写
tcpdump -X -i eth0 -s 0 -C 20 -W 3 -w /data/eth_sniff.pcap -Z root
-i:设备名
-s:过滤包大小限制
-C:定义生成文件大小,兆(Mega Bytes)为单位,取整数
-W:可生成多少个文件
-w:指定生成文件的路径
-Z:用户组,user或者root;Linux如果想循环写文件,此选项必须有,Android不需要

6.6 Wireshark安装目录下的2个工具
1) editcap
2) mergecap

7 Abbreviations
cmake: cross-platform make
DDSI-RTPS: Data Distribution Service Interoperability Wire Protocol
DDS PIM: Platform Independent Model
DDS PSM: Platform Specific Model
mbuf: Unix TCP/IP message buffer
Modicon: MOdular DIgital CONtroller
MQTT: Message Queuing Telemetry Transport,消息队列遥测传输协议
NE2000: Novell Ethernet 2000
Network TAP: Test Access Point
pbuf: lwip packet buffer
Peer-reviewed: 同行评审
RTI: Real-Time Innovations, 80% DDS market share
RTU: Remote Terminal Unit
SPAN: Switch Port Analyzer,也叫Port Mirror
WizNet: Wizard of Internet

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值