ARM DS-5简直强大,可以像开发Android一样方便的开发arm-Linux的程序,再也不用劳神的找各种编辑器,或者裸编程序了。
真搞不懂为啥这个东西我现在才知道先见恨晚,所以写了这篇文章给大家一起分享下,其中的奥秘花费了我两天的时间来探索。
要建立标题中的工程步骤如下。
1.首先,要有一个FFMPEG已编译好的库。
这个我是在LINUX 下用arm-none-linux-gnueabi-gcc编译好的库文件
https://download.csdn.net/download/ye_c1988/10254477 (注意:如果你是要编译出来静态库可执行文件的-static,就要把lib文件下的文件只保留*.a的文件不要有.SO的文件,我是要把它编译成静态库可执行文件)。
2.要安装好的ARM DS-5.26.0的Windows下的文件,我的版本5.26,至于要和谐还是自购,自己搞定。
3.安装windows下的arm-none-linux-gnueabi-gcc 编译器,我选择的是arm-2014.05-29-arm-none-linux-gnueabi.EXE
还有就是在这个兄弟的链接下下载其他版本的也可以。(注意是Windows下的交叉编译工具链)
https://blog.csdn.net/alan00000/article/details/51724252
4.将这个工具链加载到ARM DS-5 里面()
然后,建立C/C++工程目录树如下:
最后设置编译编译器:(注意:下的顺序不可变)
在Miscellaneous的填入-static这样编译出来的可执行文件就可以在Linux平台上和安卓的LINUX-C模式下运行了。
好了,
加入一个main.cpp文件测试代码如下:
/*
* main.cpp
*
* Created on: 2018年6月15日
* Author: yecx-pc
*/
#define __STDC_CONSTANT_MACROS
#ifndef __cplusplus
#define __cplusplus
#endif
#ifdef __cplusplus
extern "C"{
#endif
#include <stdio.h>
#include <unistd.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <time.h>
#include <pthread.h>
#include <fcntl.h>
#include <sys/msg.h>
#include <sys/ipc.h>
#include <sys/types.h>
#include <sys/shm.h>
#include <sys/mman.h>
#include <mqueue.h>
#include <semaphore.h>
#include "libavutil/avutil.h"
#include "libavformat/avformat.h"
#include "libswscale/swscale.h"
#include "libavcodec/avcodec.h"
#include "libavdevice/avdevice.h"
#include "x264.h"
#include "x264_config.h"
#ifdef __cplusplus
}
#endif
int main(int argc, char **argv){
int i;
av_register_all();
avformat_network_init();
while(1){
printf("Welcome to DS-5...%d\n",i++);
sleep(1);
}
return 0;
}
编译DEBUG 下内容:
虽然有几个警告,但是可执行文件已经编译出来了。这些警告没仔细看,如果有知道原因的兄弟可以在留言中告诉我,在此多谢。
5.最后进行RTSM仿真:
如何仿真可以查看ARM DS-5的使用手册,如果有不懂的可以自行度娘,或者其他。。。
虚拟机上的运行结果:
仅以此与大家分享,也作为自己的笔记。
谢谢~