v851s 在 eyesee-mpp 中添加一个hello_world sample 的流程

1. 为什么要在eyesee-mpp 中添加sample?
1)保持整个openwrt 应用程序编写的完成性;
2)eyesee-mpp 中包含了几乎所有全志视频音频模块的sample 以及 头文件,参考以及头文件调用起来非常方便,而且可以学习各种模块的使用流程;
3)可以直接在make menuconfig 中管理应用程序,是否编译;
4)不需要将交叉编译工具链放到外面,只要按照步骤添加好sample ,就可以直接mm -B 进行编译;

2. 以hello_world为例创建sample

路径:tina-v853-docker/platform/allwinner/eyesee-mpp/middleware/sun8iw21/sample

在该路径下创建文件夹: sample_hello_world

在该文件夹下创建三个文件:
sample_hello_world.c

#include 

void main(void){
    printf("hello world!\n");
}

sample_hello_world.h

#ifndef __SAMPLE_HELLO_WORLD_H__
#define __SAMPLE_HELLO_WORLD_H__ 

#ifdef __cplusplus
extern "C"{
#endif /* __cplusplus */

//
#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif

readme.txt

Author:navy
Time: 2023-04-10
Version:10.0.0.1

sample_g2d 用来演示在 eyesee-mpp 中添加sample 的步骤

注意养成良好的习惯:
1)sample 名称和别的sample 保持一直:拥有sample_前缀;
2).h 文件添加 #ifdef __cplusplus 可以兼容让c++ 调用;
3)sample含有 readme.txt ,便于介绍sample用途以及更新情况;

3. 在路径:tina-v853-docker/platform/allwinner/eyesee-mpp/middleware/sun8iw21/sample/ 下的 tina.mk 中添加 sample_hello_world 的链接编译规则

ifeq ($(TARGET), sample_hello_world)
SRCCS := sample_hello_world/sample_hello_world.c
LOCAL_TARGET_BIN := sample_hello_world/sample_hello_world
endif

4. 在路径:tina-v853-docker/platform/allwinner/eyesee-mpp/middleware/sun8iw21/ 下的 tina.mk 中添加sample_hello_world make 规则

ifeq ($(MPPCFG_SAMPLE_HELLO_WORLD),Y)
	make -C sample -f tina.mk TARGET=sample_hello_world  all
endif

5. 在路径:tina-v853-docker/openwrt/package/allwinner/eyesee-mpp/middleware 下的Makefile 和 config.in 中添加配置文件(添加后就可以在make menuconfig 中看到选项sample_hello_world )

config.in

config mpp_sample_hello_world
	bool "mpp sample hello_world"
	depends on mpp_sample
	help
	  mpp sample hello_world.

Makefile

ifeq ($(CONFIG_mpp_sample_hello_world),y)
    MPPCFG_SAMPLE_HELLO_WORLD := Y
else
    MPPCFG_SAMPLE_HELLO_WORLD := N
endif
export MPPCFG_SAMPLE_HELLO_WORLD

6. 编译
1)主目录下:

make menuconfig

Allwinner > eyesee-mpp > select mpp sample
按空格选中【*】 mpp sample hello_world

v851s 在 eyesee-mpp 中添加一个hello_world sample 的流程_第1张图片

2)两种编译方式:
1)) 直接在主目录下make -j1 V=s (全部编译)
2))到配置目录:tina-v853-docker/openwrt/package/allwinner/eyesee-mpp/middleware 下直接mm -B (只编译eyesee-mpp 下的sample)

3)将会在路径:tina-v853-docker/platform/allwinner/eyesee-mpp/middleware/sun8iw21/sample/bin/ 下产生sample_hello_world 可执行文件,将其adb push 到开发板./sample_hello_world 执行即可

你可能感兴趣的:(v851s,hello,world,sample,tina.mk)