1 Star 0 Fork 3

冰雅轩/erpcdemo

forked from 10km/erpcdemo 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-2-Clause

erpcdemo

基于串口通信的RPC调用实现(demo)

环境要求

ubuntu 16.04
gcc > 5.2.0

代码下载

git clone --recursive  https://gitee.com/l0km/erpcdemo.git

NOTE: 加了 --recursive 选项才会下载关联的子项目eprc

编译准备

安装依赖库

# 安装跨平台编译工具 cmake
sudo apt-get install cmake
# install flex & bison
sudo apt-get install flex bison
# install boost
sudo apt-get install libboost-dev libboost-system-dev libboost-filesystem-dev

erpcgen:IDL编译器

erpcgen是IDL编译器,用于将.erpc后缀的接口定义(IDL)文件生成对应的client/server代码。

进入erpc子项目编译erpc编译器并安装到/usr/local/bin下:

cd erpc/erpcgen
make -j8
sudo make install 

NOTE: -j8 为并行编译选项,指定使用8个线程同时编译,以加快编译速度

eprc

执行 'install_erpc.sh'编译erpc核心库并安装到release文件夹下

创建eclipse工程(linux)

执行make_unix_makefile.sh脚本,会在当前项目文件夹所在文件夹下生成同级的eclipse项目文件(erpc.gcc)

命令行编译

编译上一步生成的Makefile,安装到 release 文件夹下,也可以直接执行build.sh

cmake --build ../erpcdemo.gcc --target install

IDL定义[TODO]

erpcdemo.erpc为人脸锁的RPC调用接口定义文件(interface description language),根据项目需要添加相关的定义.

IDL语法参见erpc官方文档:

《IDL Reference(https://github.com/EmbeddedRPC/erpc/wiki/IDL-Reference)》

生成代码

根据接口定义文件erpcdemo.erpc生成对应的client/server代码

erpcgen erpcdemo.erpc

NOTE: 事前必须先执行erpcgen编译安装。

生成文件列表:

erpcdemo.h
erpcdemo_client.cpp
erpcdemo_server.cpp
erpcdemo_server.h
Copyright (c) 2017, 10km All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

erpc入门演示 展开 收起
BSD-2-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ice_elegant/erpcdemo.git
git@gitee.com:ice_elegant/erpcdemo.git
ice_elegant
erpcdemo
erpcdemo
master

搜索帮助

246c6175 1850385 950819b3 1850385