愚昧之重大发现-嵌入式Eclipse C++项目-命令行整体编译

先说我遇到的问题,由于习惯了IDE编程,所以介入嵌入式编程以来,一直是使用eclipse c++,以前使用vc6编程时,整个项目很大,有几十个工程文件,vc6也支持批处理,常见的打包程序,都支持批处理动作,可以很好的输入一个命令就去上厕所或者休息了,等回来,就可以直接测试打包好的最终程序了,而且我这边当时做的是直接产生光盘目录 到了eclipse这里,以及QT这里遇到麻烦了,网上搜索了快一年了,都没有找到解决方法,说的不明不白。 其实我要干的事情,就是代码修改完成,简单测试某个库后,一个动作命令,产生最后的U盘升级包,或者flash镜像文件,由于系统牵扯好几个海思芯片,例如3520D,3535,3536,3536c,3798M,编译器不同,为此,如果自己折腾makefile,自己没掌握,牵扯的东西太多,项目也很庞大,也没时间学习具体细节了,再来折腾了 为此每次都需要将近期修改了代码的某个.so工程,或者执行程序工程,在eclipse里面,点击项目编译,然后由于有编译后批处理install.sh协助,会自动编译出so文件,并且拷贝到相应目录,如果界面有修改,就到QTCreator当中去编译界面的工程,这些动作做完了,我写过一个打包各个板卡芯片的批处理,最后可以自动产生升级程序。但毕竟中间还需要跑到eclipse中编译项目,而且麻烦的是由于芯片很多,有时候为了防止漏编译,每个芯片都要进行一次,避免某个芯片没有编译,程序不匹配,导致最后板卡烧写测试才能发现问题。每次到了项目打包,都要折腾半个小时左右才能把所有芯片的程序打包,而且由于程序库的相关性,有些库有先后顺序,所以还不能搞错,当时就觉得这时IDE界面编程带来的不便,比起界面编程,可以在十几二十几个工程里面拷贝复制,游刃有余带来的遍历,这半个小时也就一直忍受着。 今天突然发现eclipse里面编译时,就是个make -j4 clean 以及make -j4 all,我就到Release目录下试了一下,先clean再make all,还真有动作,现在想想,eclipse其实产生的这个makefile就是标准的,可以直接用的,害得我,这么久都是手动动作。

////////////////

批处理内容简单如下

// #!/bin/sh

export PATH=PATH:/opt/hisi-linux/x86-arm/arm-hisiv200-linux/target/bin:/opt/hisi-linux/x86-arm/arm-hisiv300-linux/target/bin:/opt/hisi-linux-nptl/arm-hisiv100-linux/target/bin:/opt/hisi-linux/x86-arm/arm-hisiv300-linux/lib:/opt/hisi-linux/x86-arm/arm-hisiv100-linux/target/bin:/opt/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/hisi-linux-nptl/arm-hisiv100-linux/bin:/opt/hisi-linux-nptl/arm-hisiv300-linux/bin:/opt/hisi-linux-nptl/arm-hisiv400-linux/bin:/opt/hisi-linux/x86-arm/arm-hisiv400-linux/target/bin:/usr/lib/x86_64-linux-gnu:/opt/hisi-linux/x86-arm/arm-hisiv300-linux/arm-hisiv300-linux-uclibcgnueabi/lib:/opt/hisi-linux/x86-arm/arm-hisiv300-linux/arm-hisiv300-linux-uclibcgnueabi/lib/a9_soft:/opt/hisi-linux/x86-arm/arm-hisiv300-linux/lib:/opt/hisi-linux/x86-arm/arm-hisiv300-linux/target/lib:/opt/hisi-linux/x86-arm/arm-hisiv300-linux/lib:/opt/hisi-linux/x86-arm/arm-hisiv400-linux/target/bin:/opt/hisi-linux/x86-arm/arm-hisiv400-linux/lib:/opt/hisi-linux/x86-arm/arm-hisiv300-linux/arm-hisiv300-linux-uclibcgnueabi/lib:/opt/hisi-linux/x86-arm/arm-hisiv300-linux/arm-hisiv300-linux-uclibcgnueabi/bin:/opt/hisi-linux/x86-arm/arm-hisiv300-linux/arm-hisiv300-linux-uclibcgnueabi/lib:/opt/hisi-linux/x86-arm/arm-hisiv500-linux/arm-hisiv500-linux-uclibcgnueabi/bin:/opt/hisi-linux/x86-arm/arm-hisiv500-linux/arm-hisiv500-linux-uclibcgnueabi/lib:/opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/bin

cd /home/ngs

sudo chmod -R 777 /home/ngs/workspace

#####################################HIRtc

注意这里,虽然是一个工程HIRtc,但有好几个配置,每种配置都会有一个目录,如果你也是用的eclipse,打开目录一看就清楚了,只要eclipse里面编译各个项目正常,这里就是正常的

cd /home/ngs/workspace/HIRtc/Release

make -j4 clean

make -j4 all

cd /home/ngs/workspace/HIRtc/release_3516A

make -j4 clean

make -j4 all

cd /home/ngs/workspace/HIRtc/release_3535

make -j4 clean

make -j4 all

cd /home/ngs/workspace/HIRtc/release_3536C

make -j4 clean

make -j4 all

cd /home/ngs/workspace/HIRtc/releaseV200

make -j4 clean

make -j4 all

cd /home/ngs/workspace/HIRtc/releaseV300

make -j4 clean

make -j4 all

#############################################IVHISetIP

cd /home/ngs/workspace/IVHISetIP/Release

make -j4 clean

make -j4 all

cd /home/ngs/workspace/IVHISetIP/release_3516A

make -j4 clean

make -j4 all

cd /home/ngs/workspace/IVHISetIP/release_3535

make -j4 clean

make -j4 all

cd /home/ngs/workspace/IVHISetIP/release_3536

make -j4 clean

make -j4 all

cd /home/ngs/workspace/IVHISetIP/release_3536C

make -j4 clean

make -j4 all

cd /home/ngs/workspace/IVHISetIP/releaseV200

make -j4 clean

make -j4 all

####################################IVComInfSDK

cd /home/ngs/workspace/IVComInfSDK/Release

make -j4 clean

make -j4 all

cd /home/ngs/workspace/IVComInfSDK/release_3516A

make -j4 clean

make -j4 all

cd /home/ngs/workspace/IVComInfSDK/release_3535

make -j4 clean

make -j4 all

cd /home/ngs/workspace/IVComInfSDK/release_3536

make -j4 clean

make -j4 all

cd /home/ngs/workspace/IVComInfSDK/release_3536C

make -j4 clean

make -j4 all

cd /home/ngs/workspace/IVComInfSDK/release_3798M

make -j4 clean

make -j4 all

#############################################IVHIComDataSDK

cd /home/ngs/workspace/IVHIComDataSDK/Release

make -j4 clean

make -j4 all

cd /home/ngs/workspace/IVHIComDataSDK/release_3535

make -j4 clean

make -j4 all

cd /home/ngs/workspace/IVHIComDataSDK/release_3536

make -j4 clean

make -j4 all

cd /home/ngs/workspace/IVHIComDataSDK/release_3536C

make -j4 clean

make -j4 all

cd /home/ngs/workspace/IVHIComDataSDK/release_3798M

make -j4 clean

make -j4 all

cd /home/ngs/workspace/IVHIComDataSDK/release_3516A

make -j4 clean

make -j4 all

#############################################HSMPISDK_3516D

cd /home/ngs/workspace/HSMPISDK_3516D/Release

make -j4 clean

make -j4 all

#############################################HSMPISDK_3520D

cd /home/ngs/workspace/HSMPISDK_3520D/Release

make -j4 clean

make -j4 all

cd /home/ngs/workspace/HSMPISDK_3520D/release_MINI

make -j4 clean

make -j4 all

#############################################HSMPISDK_3535

cd /home/ngs/workspace/HSMPISDK_3535/Release

make -j4 clean

make -j4 all

#############################################HSMPISDK_3536

cd /home/ngs/workspace/HSMPISDK_3536/Release

make -j4 clean

make -j4 all

#############################################HSMPISDK_3536C

cd /home/ngs/workspace/HSMPISDK_3536C/Release

make -j4 clean

make -j4 all

#############################################HSMPISDKEx_3798M

cd /home/ngs/workspace/HSMPISDKEx_3798M/Release

make -j4 clean

make -j4 all

/////////////////////////////////////////////////////////////////////////

后面很多,省略

qt的工程也是一样:

###################################IVHITvWallCtrl

cd /home/ngs/workspace/IVHITvWallCtrl

make -j4 clean

sudo /home/ngs/QT/QT4.86_3798M/bin/qmake /home/ngs/workspace/IVHITvWallCtrl/IVHITvWallCtrl.pro -r -spec qws/linux-hisi3798M-g++ CONFIG+=3798M

make -j4

sudo chmod -R 777 /home/ngs/workspace/IVHITvWallCtrl/IVHITvWallCtrl

echo “ngs” |sudo -S cp -p -r IVHITvWallCtrl /nfsroot/HI3798M

echo “ngs” |sudo -S rm IVHITvWallCtrl

cd /home/ngs/workspace/IVHITvWallCtrl

make -j4 clean

sudo /home/ngs/QT/Qt4.8.6/bin/qmake /home/ngs/workspace/IVHITvWallCtrl/IVHITvWallCtrl.pro -r -spec qws/linux-3520d-g++ CONFIG+=HI3520D

make -j4

sudo chmod -R 777 /home/ngs/workspace/IVHITvWallCtrl/IVHITvWallCtrl

echo “ngs” |sudo -S cp -p -r IVHITvWallCtrl /nfsroot/HI3536C

echo “ngs” |sudo -S cp -p -r IVHITvWallCtrl /nfsroot/HI3536

echo “ngs” |sudo -S cp -p -r IVHITvWallCtrl /nfsroot/HI3520D

echo “ngs” |sudo -S cp -p -r IVHITvWallCtrl /nfsroot/HI3535

echo “ngs” |sudo -S rm IVHITvWallCtrl

/////////////////////////

然后再把我以前写的整体打包sh放到后面,这样就一个命令,直接产生升级包,就和大家平时用的一样了,唉,这么简单,怎么网上没有相关介绍呢,要么没搜到,要么就是太简单,所以称之为愚昧之重大发现,写出来,避免其他人遇到同样弱智的问题,折腾许久。 OK,输入sudo ./mkall.sh,升级包就自动放到网站或者发给客户了,每次改完程序,测试模块后,就是这个动作,就可以休息了

免责声明:文章内容来自互联网,本站不对其真实性负责,也不承担任何法律责任,如有侵权等情况,请与本站联系删除。
转载请注明出处:愚昧之重大发现-嵌入式Eclipse C++项目-命令行整体编译 https://www.yhzz.com.cn/a/22038.html

上一篇 2023-08-20 13:12:13
下一篇 2023-08-20 15:21:18

相关推荐

联系云恒

在线留言: 我要留言
客服热线:400-600-0310
工作时间:周一至周六,08:30-17:30,节假日休息。