carlife

makefile
需要用到的库交叉编译即可
如这些库:protobuf

#Author:
#	Liu CaiQuan
#Date:
#	7th Semptember 2015
#CarLife Protocol version:
#	V0.15
#
#rule for Linux
#
#                   Copyright (C) Under BaiDu, Inc.

#TOPDIR:=~/EddyWorkSpace/CarLifeLibSourceCode/trunk



TOPDIR:=$(shell pwd)
export TOPDIR

#CROSS_COMPILE=
CROSS_COMPILE ?=arm-linux-gnueabihf-
LD=$(CROSS_COMPILE)ld
CC=$(CROSS_COMPILE)g++

CP=cp

export LD CC 

#COM_FLAGS = -Wall -O2 -fPIC -mcpu=cortex-a9 -mfpu=neon-fp16 -mfloat-abi=hard -mthumb-interwork -marm
#CFLAGS	   = $(COM_FLAGS) -std=c++14

#CFLAGS = -g
CFLAGS:=-g -Wall -O2 -fPIC -mcpu=cortex-a9 -mfpu=neon-fp16 -mfloat-abi=hard -mthumb-interwork -marm -std=c++11 
CFLAGS+=-I protobuf/cc/include
CFLAGS+=-I $(TOPDIR)/include
CFLAGS+=-I $(TOPDIR)/protobuf/cc/include
#CFLAGS+=-I /usr/local/include

#CFLAGS+=-I /usr/protobuf/include

CFLAGS+=-I $(TOPDIR)/protobuf/include
CFLAGS+=-I $(TOPDIR)/H264Player/include
CFLAGS+=-I $(TOPDIR)/H264Player/ffmpeg-4.1.3/include
CFLAGS+=-I $(TOPDIR)/H264Player/sstar/include
CFLAGS+=-I $(TOPDIR)/protobuf/include/google/protobuf
CFLAGS+=-I $(TOPDIR)/protobuf/include/google/protobuf/io
CFLAGS+=-I $(TOPDIR)/protobuf/include/google/protobuf/stubs

#CFLAGS+=-I /usr/protobuf/include/google/protobuf
#CFLAGS+=-I /usr/protobuf/include/google/protobuf/io
#CFLAGS+=-I /usr/protobuf/include/google/protobuf/stubs

#CFLAGS+=-I /usr/include

#CFLAGS+=-I /usr/include/libxml2




#LFLAGS:=-fPIC -shared
#LFLAGS+=-L/usr/local/lib -lprotobuf
LFLAGS+=-L$(TOPDIR)/H264Player/ffmpeg-4.1.3/lib -L$(TOPDIR)/H264Player/sstar/lib  
LFLAGS+=-L$(TOPDIR)/protobuf/lib 

#LFLAGS+=-L/usr/protobuf/lib -L/usr/protobuf/lib/libprotobuf.a

ENABLE_HDMI = 0
USE_FFMPEG  = 1

ifeq ($(USE_FFMPEG), 1)
LIB_NAME  += -lavformat -lavcodec -lavutil
endif

ifeq ($(ENABLE_HDMI), 1)
LIB_PATH += -lmi_hdmi
else
LIB_NAME += -lmi_panel
endif

LIB_NAME += -lprotobuf -lm -lmi_vdec -lmi_sys -lmi_gfx -lmi_disp -lmi_ao -lmi_common -ldl -lcarlifevehicle -lpthread 



export CFLAGS LFLAGS

OBJDIR=obj

#obj-y+=CarLifeLibTest.o
obj-y+=H264Player/
obj-y+=core/
obj-y+=libwrapper/
obj-y+=modules/
obj-y+=protobuf/
obj-y+=utility/


TARGET-LIB=libcarlifevehicle.so
TARGET-APP=libtest 

all: carlifelib libtest

carlifelib: 
	make -C ./ -f $(TOPDIR)/Makefile.build
	$(CC) -shared -o $(TARGET-LIB) built-in.o
	$(CP) $(TARGET-LIB) $(OBJDIR)	

libtest:CarLifeLibTest.cpp
	$(CC) -o $(TARGET-APP) $< $(CFLAGS) -L./ $(LFLAGS) $(LIB_NAME) 
	$(CP) $(TARGET-APP) $(OBJDIR)
	$(CP) $(TOPDIR)/libtest $(TOPDIR)/out/bin/
	$(CP) $(TOPDIR)/libcarlifevehicle.so $(TOPDIR)/out/lib/
	$(CP) $(TOPDIR)/protobuf/lib/libprotobuf.so.8 $(TOPDIR)/out/lib/
	$(CP) $(TOPDIR)/H264Player/ffmpeg-4.1.3/lib/libavcodec.so.58 $(TOPDIR)/out/lib/
	$(CP) $(TOPDIR)/H264Player/ffmpeg-4.1.3/lib/libavformat.so.58 $(TOPDIR)/out/lib/
	$(CP) $(TOPDIR)/H264Player/ffmpeg-4.1.3/lib/libavutil.so.56 $(TOPDIR)/out/lib/

protoBuf:
	rm -f ./protobuf/pbGen/*
	protoc --proto_path=./protobuf/proto/ --cpp_out=./protobuf/pbGen ./protobuf/proto/*.proto
	rm -f ./protobuf/cc/src/*.cc
	rm -f ./protobuf/cc/include/*.h
	mv ./protobuf/pbGen/*.cc ./protobuf/cc/src/
	mv ./protobuf/pbGen/*.h ./protobuf/cc/include/

clean:
	rm -f $(shell find -name "*.o")
	rm -f $(TARGET-LIB)
	rm -f $(TARGET-APP)
	rm -f $(OBJDIR)/*
	rm -f $(TOPDIR)/out/bin/*
	rm -f $(TOPDIR)/out/lib/*

distclean:
	rm -f $(shell find -name "*.o")
	rm -f $(shell find -name "*.d")
	rm -f $(TARGET-LIB)
	rm -f $(TARGET-APP)
	rm -f $(OBJDIR)/*
	rm -f $(TOPDIR)/out/bin/*
	rm -f $(TOPDIR)/out/lib/*
在树莓派上使用百度CarLife涉及多个步骤,包括硬件准备、系统环境配置以及安装和调试相关的软件包。以下是一个详细的指南: ### 硬件要求 - 树莓派设备(推荐使用 Raspberry Pi 3 或更高版本)。 - 微SD卡(至少8GB,建议16GB或更大)。 - 电源适配器。 - USB数据线(用于连接手机)。 - HDMI显示器或远程SSH访问方式。 ### 系统准备 首先需要为树莓派安装操作系统,推荐使用 **Raspberry Pi OS**(基于Debian的官方系统): ```bash # 下载并烧录镜像到微SD卡 # 使用工具如 Raspberry Pi Imager 或 Etcher 进行操作 ``` 完成基本的系统设置后,确保系统更新到最新状态: ```bash sudo apt update && sudo apt upgrade -y ``` ### 安装依赖库 百度CarLife通常依赖于USB调试协议和ADB(Android Debug Bridge)进行通信,因此需要安装相关工具: ```bash sudo apt install android-tools-adb android-tools-fastboot ``` 此外,可能还需要一些开发工具来编译额外的驱动程序或模块: ```bash sudo apt install build-essential git libusb-1.0-0-dev ``` ### 获取CarLife支持 由于百度CarLife本身并不直接提供针对树莓派的官方版本,因此需要通过开源项目或社区资源尝试实现兼容性。可以参考GitHub上的相关项目,例如: - 查找是否有适配Linux系统的CarLife客户端。 - 尝试运行模拟器或虚拟机以支持原生CarLife应用。 一个可行的方法是利用**VNC Server**将树莓派桌面共享给已安装CarLife的设备,或者寻找第三方移植的CarLife服务端组件。 ### 配置网络与USB连接 为了使手机能够通过USB连接至树莓派并与CarLife交互,需配置USB网络共享模式,并确保adb调试功能启用: ```bash # 启用ADB调试 sudo systemctl enable adb sudo systemctl start adb # 检查设备是否被正确识别 adb devices ``` 如果一切正常,手机应显示USB调试授权提示,请确认允许连接。 ### 测试CarLife功能 此时可以通过特定的启动脚本或命令行指令尝试激活CarLife服务。具体命令取决于所采用的实现方案,可能包含如下示例: ```bash ./start_carlife.sh ``` 请注意,由于缺乏官方支持,实际部署过程中可能会遇到兼容性问题或性能瓶颈,建议密切关注相关论坛和技术博客获取最新进展。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值