电子产业一站式赋能平台

PCB联盟网

搜索
查看: 801|回复: 0
收起左侧

【HarmonyOS HiSpark IPC试用】开发Hi3518第一个示例程序Say Hello to HarmonyOS

[复制链接]

2607

主题

2607

帖子

7472

积分

高级会员

Rank: 5Rank: 5

积分
7472
发表于 2021-2-1 09:56:29 | 显示全部楼层 |阅读模式
【HarmonyOS HiSpark IPC试用】开发Hi3518第一个示例程序Say Hello to HarmonyOS, <span]

<span]

<span]开发者需要在Linux服务器上下载并解压一套源代码,获取Hi3518源码(下载链接https://gitee.com/openharmony/docs/blob/master/get-code/%E6%BA%90%E7%A0%81%E8%8E%B7%E5%8F%96.md)。更多源码获取方式,请见源码获取。 <span]下载是用windows10, 放在e盘 <span]cd ~ <span]解压源码 <span]

<span]

<span]

<span]vscode 安装wsl:ubuntu插件可以打开 wsl:ubuntu文件, 这点用win10非常方便 <span]#include “los_sample.h“ <span]int main(int argc, char **argv) <span]    printf(“\n************************************************\n“);     printf(“Hi I\“m Lojam, Hello OHOS!\n\r“);     printf(“Copyright @sunshine Silicon \n\r “);     printf(“\n************************************************\n\n“);     LOS_Sample(g_num);        // 鸿蒙系统特有的我也不知道是什么意思, 同一个示例目录里 调用los_samle.c里的LOS_Sample函数     return 0; }

los_samle.c内容

#include <stdio.h>

int g_num = 81; void LOS_Sample(int param) {     printf(“This is a sample: Param = %d\n“, param); }

看看这个目录的Makefile内容 STAtiC_COMPILE = n

BIN = helloworld BIN_ASM = $(BIN).asm OBJEXT = .o

CC = ${LITEOS_COMPILER_PATH}/bin/$(CROSS_COMPILE)gcc        //这里用的是交叉编译工具gcc,而非是官方python脚本用的是clang, 直接make出错 CPP = ${LITEOS_COMPILER_PATH}/bin/$(CROSS_COMPILE)g++ LD = ${LITEOS_COMPILER_PATH}/bin/$(CROSS_COMPILE)ld OBJDUMP = ${LITEOS_COMPILER_PATH}/bin/$(CROSS_COMPILE)objdump

COMMON_INCLUDE = -I $(APP_DIR)/include/ COMMON_FLAGS = -fPIE -D_XOPEN_SOURCE=700

CFLAGS += -fno-omit-frame-pointer -std=c99 $(COMMON_INCLUDE) $(COMMON_FLAGS) CXXFLAGS += $(COMMON_INCLUDE) $(COMMON_FLAGS)

ifeq ($(STATIC_COMPILE), y)         LDFLAGS = --static else         LDFLAGS = -pie endif

CCSRCS := $(wildcard *.c) CCOBJS = $(CCSRCS:.c=$(OBJEXT)) CXXSRCS := $(wildcard *.cpp) CXXOBJS = $(CXXSRCS:.cpp=$(OBJEXT))

MUSL = musl/lib/libc.so

all: $(MUSL) $(BIN) $(BIN_ASM)

$(CCOBJS): %$(OBJEXT): %.c         @echo “CC: $<“         $(Q) $(CC) -c $(CFLAGS) $< -o $@

$(CXXOBJS): %$(OBJEXT): %.cpp         @echo “CPP: $<“         $(Q) $(CPP) -c $(CXXFLAGS) $< -o $@

$(BIN_ASM): $(BIN)         $(Q) rm -RF $(CCOBJS) $(CXXOBJS)         $(Q) $(OBJDUMP) -d $(BIN) > $(BIN_ASM)

$(MUSL):         $(Q) rm -rf musl/         $(Q) ./build_musl.sh &> build_musl.log

$(BIN): $(MUSL) $(CCOBJS) $(CXXOBJS) ifeq ($(STATIC_COMPILE), y)         @echo “LD: $^“         $(Q) $(CC) $(LDFLAGS) -o $@ $^ else         @echo “LD: $^“         $(Q)mkdir -p $(APP_DIR)/lib/         $(Q)cp -f $(APP_DIR)/src/musl/lib/libc.so $(APP_DIR)/lib/libc.so         $(Q)$(CC) $(LDFLAGS) -o $@ $(CCOBJS) $(CXXOBJS) endif

clean:         $(Q) rm -rf $(CCOBJS) $(CXXOBJS) $(BIN) $(BIN_ASM)         $(Q) rm -rf musl/         $(Q) rm -rf build_musl.log

install:         $(Q) mkdir -p $(FSIMG_DIR)         $(Q) install $(BIN) $(FSIMG_DIR)/$(BIN)

编译 之前Linux开发uboot、内核、文件系统、应用是分开编译的,一般只编译一次烧录,应用直接make编译出来copy到硬件环境里就可以了 这里是所有的uboot、内核、文件系统、应用一起编译初次使用还有,后面老全部编译就很麻烦了,编译时间长,希望可以应用直接编译,然后copy到板子里,后面写应用或驱动就方便多了 python build.py ipcamera_hi3518ev300 -b debug

编译出错了,把编译日志放出来,希望能有大神帮助解决, 我找问题解决了再更新了…………OMG………………

……没有找到./adapt_liteos_config.sh:………… /home/fan/HarmonyOS_Code/vendor/hisi/hi35xx/middleware/source/third_party/ffmpeg

./adapt_liteos_config.sh: 4: function: not found

sed: -e expression #1, char 0: no previous regular expression

./adapt_liteos_config.sh: 11: function: not found





./adapt_liteos_config.sh: 19: function: not found

adapt ffmpeg for liteos

./adapt_liteos_config.sh: 29: effect_opt: not found

./adapt_liteos_config.sh: 30: effect_opt: not found

./adapt_liteos_config.sh: 31: effect_opt: not found

./adapt_liteos_config.sh: 32: effect_opt: not found

./adapt_liteos_config.sh: 33: effect_opt: not found

./adapt_liteos_config.sh: 34: effect_opt: not found

./adapt_liteos_config.sh: 35: effect_opt: not found

./adapt_liteos_config.sh: 36: effect_opt: not found

./adapt_liteos_config.sh: 37: effect_opt: not found

./adapt_liteos_config.sh: 38: effect_opt: not found

./adapt_liteos_config.sh: 39: effect_opt: not found

./adapt_liteos_config.sh: 40: effect_opt: not found

./adapt_liteos_config.sh: 41: effect_opt: not found

./adapt_liteos_config.sh: 42: effect_opt: not found

./adapt_liteos_config.sh: 43: effect_opt: not found

./adapt_liteos_config.sh: 44: effect_opt: not found

./adapt_liteos_config.sh: 45: effect_opt: not found

./adapt_liteos_config.sh: 46: effect_opt: not found

./adapt_liteos_config.sh: 48: cancel_opt: not found

./adapt_liteos_config.sh: 49: cancel_opt: not found

./adapt_liteos_config.sh: 50: cancel_opt: not found

./adapt_liteos_config.sh: 51: cancel_opt: not found

./adapt_liteos_config.sh: 52: cancel_opt: not found

./adapt_liteos_config.sh: 53: cancel_opt: not found

./adapt_liteos_config.sh: 54: cancel_opt: not found

./adapt_liteos_config.sh: 55: cancel_opt: not found



./adapt_liteos_config.sh: 56: cancel_opt: not found



……  1大票头文件没有, gitee下载的源码有问题……OMG…………

libavdevice/alsa.c:31:10: fatal error: \“alsa/asoundlib.h\“ file not found

#include <alsa/asoundlib.h>

          ^~~~~~~~~~~~~~~~~~

libavdevice/alsa_dec.c:48:10: fatal error: \“alsa/asoundlib.h\“ file not found

#include <alsa/asoundlib.h>

          ^~~~~~~~~~~~~~~~~~

1 error generated.

In file included from libavdevice/alldevices.c:23:

In file included from ./libavformat/internal.h:27:

In file included from ./libavformat/avformat.h:317:

In file included from ./libavCodec/avcodec.h:31:

In file included from ./libavutil/samplefmt.h:24:

In file included from ./libavutil/avutil.h:296:

In file included from ./libavutil/common.h:491:

In file included from ./libavutil/internal.h:42:

./libavutil/timer.h:37:11: fatal error: \“asm/unistd.h\“ file not found

# include <asm/unistd.h>

           ^~~~~~~~~~~~~~

libavdevice/android_camera.c:29:10: fatal error: \“camera/NdkCameraDevice.h\“ file not found

#include <camera/NdkCameraDevice.h>

          ^~~~~~~~~~~~~~~~~~~~~~~~~~

1 error generated.

make[1]: *** [ffbuild/common.mak:60: libavdevice/alsa.o] Error 1

make[1]: *** Waiting for unfinished jobs....

In file included from libavdevice/bktr.c:27:

In file included from ./libavformat/internal.h:27:

In file included from ./libavformat/avformat.h:317:

In file included from ./libavcodec/avcodec.h:31:

In file included from ./libavutil/samplefmt.h:24:

In file included from ./libavutil/avutil.h:296:

In file included from ./libavutil/common.h:491:

In file included from ./libavutil/internal.h:42:

./libavutil/timer.h:37:11: fatal error: \“asm/unistd.h\“ file not found

# include <asm/unistd.h>

           ^~~~~~~~~~~~~~

1 error generated.

make[1]: *** [ffbuild/common.mak:60: libavdevice/alldevices.o] Error 1

make[1]: *** [ffbuild/common.mak:60: libavdevice/alsa_dec.o] Error 1

libavdevice/alsa_enc.c:40:10: fatal error: \“alsa/asoundlib.h\“ file not found

#include <alsa/asoundlib.h>

          ^~~~~~~~~~~~~~~~~~

In file included from libavdevice/decklink_dec_c.c:23:

In file included from ./libavformat/avformat.h:317:

In file included from ./libavcodec/avcodec.h:31:

In file included from ./libavutil/samplefmt.h:24:

In file included from ./libavutil/avutil.h:296:

In file included from ./libavutil/common.h:491:

In file included from ./libavutil/internal.h:42:

./libavutil/timer.h:37:11: fatal error: \“asm/unistd.h\“ file not found

# include <asm/unistd.h>

           ^~~~~~~~~~~~~~

1 error generated.

libavdevice/avfoundation.m:28:9: fatal error: \“AVFoundation/AVFoundation.h\“ file not found

#import <AVFoundation/AVFoundation.h>

         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

make[1]: *** [ffbuild/common.mak:60: libavdevice/bktr.o] Error 1

1 error generated.

In file included from libavdevice/avdevice.c:19:

In file included from ./libavutil/avassert.h:31:

In file included from ./libavutil/avutil.h:296:

In file included from ./libavutil/common.h:491:

In file included from ./libavutil/internal.h:42:

./libavutil/timer.h:37:11: fatal error: \“asm/unistd.h\“ file not found

# include <asm/unistd.h>

           ^~~~~~~~~~~~~~

In file included from libavdevice/decklink_enc_c.c:22:

In file included from ./libavformat/avformat.h:317:

In file included from ./libavcodec/avcodec.h:31:

In file included from ./libavutil/samplefmt.h:24:

In file included from ./libavutil/avutil.h:296:

In file included from ./libavutil/common.h:491:

In file included from ./libavutil/internal.h:42:

./libavutil/timer.h:37:11: fatal error: \“asm/unistd.h\“ file not found

# include <asm/unistd.h>

           ^~~~~~~~~~~~~~

make[1]: *** [ffbuild/common.mak:60: libavdevice/android_camera.o] Error 1

1 error generated.

libavdevice/caca.c:21:10: fatal error: \“caca.h\“ file not found

#include <caca.h>

          ^~~~~~~~

1 error generated.

1 error generated.

1 error generated.

1 error generated.

make[1]: *** [ffbuild/common.mak:60: libavdevice/decklink_dec_c.o] Error 1

make[1]: *** [ffbuild/common.mak:60: libavdevice/alsa_enc.o] Error 1

make[1]: *** [ffbuild/common.mak:60: libavdevice/avdevice.o] Error 1

make[1]: *** [ffbuild/common.mak:66: libavdevice/avfoundation.o] Error 1

make[1]: *** [ffbuild/common.mak:60: libavdevice/decklink_enc_c.o] Error 1

1 error generated.

make[1]: *** [ffbuild/common.mak:60: libavdevice/caca.o] Error 1

In file included from libavdevice/dshow_common.c:22:

In file included from libavdevice/dshow_capture.h:27:

In file included from libavdevice/avdevice.h:48:

In file included from ./libavutil/log.h:25:

In file included from ./libavutil/avutil.h:296:

In file included from ./libavutil/common.h:491:

In file included from ./libavutil/internal.h:42:

./libavutil/timer.h:37:11: fatal error: \“asm/unistd.h\“ file not found

# include <asm/unistd.h>

           ^~~~~~~~~~~~~~

In file included from libavdevice/dshow.c:22:

In file included from libavdevice/dshow_capture.h:27:

In file included from libavdevice/avdevice.h:48:

In file included from ./libavutil/log.h:25:

In file included from ./libavutil/avutil.h:296:

In file included from ./libavutil/common.h:491:

In file included from ./libavutil/internal.h:42:

./libavutil/timer.h:37:11: fatal error: \“asm/unistd.h\“ file not found

# include <asm/unistd.h>

           ^~~~~~~~~~~~~~

1 error generated.

make[1]: *** [ffbuild/common.mak:60: libavdevice/dshow_common.o] Error 1

1 error generated.

make[1]: *** [ffbuild/common.mak:60: libavdevice/dshow.o] Error 1

libavdevice/decklink_enc.cpp:31libavdevice/decklink_common.cpp:10::28 :fatal error10: :\“DeckLinkAPI.h\“ file not found

fatal error: \“DeckLinkAPI.h\“ file not found

#include <DeckLinkAPI.h>

#include <DeckLinkAPI.h>         ^~~~~~~~~~~~~~~





          ^~~~~~~~~~~~~~~

libavdevice/decklink_dec.cpp:33:10: fatal error: \“DeckLinkAPI.h\“ file not found

#include <DeckLinkAPI.h>

          ^~~~~~~~~~~~~~~

1 error generated.

1 error generated.

make[1]: *** [ffbuild/common.mak:63: libavdevice/decklink_enc.o] Error 1

make[1]: *** [ffbuild/common.mak:63: libavdevice/decklink_common.o] Error 1

1 error generated.

make[1]: *** [ffbuild/common.mak:63: libavdevice/decklink_dec.o] Error 1

make[1]: Leaving directory \“/home/fan/HarmonyOS_Code/vendor/hisi/hi35xx/middleware/source/third_party/ffmpeg/ffmpeg-y\“

make: *** [Makefile:41: ffmpeg-y] Error 2

Traceback (most recent call last):

   File “../../build/lite/build_ext_components.py“, line 64, in <module>

     sys.exit(main())

   File “../../build/lite/build_ext_components.py“, line 58, in main

     cmd_exec(args.command)

   File “../../build/lite/build_ext_components.py“, line 32, in cmd_exec

     raise Exception(“{} faiLED, return code is {}“.format(cmd, ret_code))



Exception: [\“./build.sh\“, \“/home/fan/HarmonyOS_Code/out/ipcamera_hi3518ev300\“, \“hi3518ev300\“, \“liteos_a\“, \“clang\“, \“/home/fan/llvm/bin/..\“] failed, return code is 2
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则


联系客服 关注微信 下载APP 返回顶部 返回列表