From a1c46bbda4ad4c6b54dd00c0fa08fc9bc985025e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=88=91=E5=BE=88=E5=BF=99?= Date: Thu, 27 Nov 2025 03:52:52 +0000 Subject: [PATCH 1/3] test --- vendor/build_gate.sh | 114 ++++++ vendor/build_sample.py | 349 ++++++++++++++++++ vendor/hisilicon/build_config.json | 18 + vendor/hisilicon/demo/.vscode/settings.json | 69 ++++ vendor/hisilicon/demo/Makefile | 28 ++ vendor/hisilicon/demo/Makefile.param | 253 +++++++++++++ vendor/hisilicon/demo/helloworld/Makefile | 11 + vendor/hisilicon/demo/helloworld/helloworld.c | 280 ++++++++++++++ .../hisilicon/demo/smp_linux_user_space.mak | 49 +++ vendor/hisilicon/patch_build.sh | 20 + 10 files changed, 1191 insertions(+) create mode 100755 vendor/build_gate.sh create mode 100644 vendor/build_sample.py create mode 100644 vendor/hisilicon/build_config.json create mode 100644 vendor/hisilicon/demo/.vscode/settings.json create mode 100644 vendor/hisilicon/demo/Makefile create mode 100644 vendor/hisilicon/demo/Makefile.param create mode 100644 vendor/hisilicon/demo/helloworld/Makefile create mode 100644 vendor/hisilicon/demo/helloworld/helloworld.c create mode 100644 vendor/hisilicon/demo/smp_linux_user_space.mak create mode 100755 vendor/hisilicon/patch_build.sh diff --git a/vendor/build_gate.sh b/vendor/build_gate.sh new file mode 100755 index 0000000..9a60b9b --- /dev/null +++ b/vendor/build_gate.sh @@ -0,0 +1,114 @@ +#!/bin/bash + +TARGET=$1 +DIR=$2 +SOC=$3 +DEF=$4 + +#获取软件包&&打patch +function set_env() +{ + if [ ! -f /home/build/executed/set_env_executed ]; then + echo "not set_env, start set_env!" + cd /home/build/pegasus + git submodule init + git submodule update platform/ss928v100_clang platform/ss928v100_gcc + + cp /home/build/package/linux-6.6.86.tar.gz /home/build/pegasus/platform/ss928v100_clang/open_source/linux + cp /home/build/package/mbedtls-2.16.10.tar.gz /home/build/pegasus/platform/ss928v100_clang/open_source/mbedtls + cp /home/build/package/arm-trusted-firmware-2.2.tar.gz /home/build/pegasus/platform/ss928v100_clang/open_source/trusted-firmware-a + cp /home/build/package/u-boot-2020.01.tar.bz2 /home/build/pegasus/platform/ss928v100_clang/open_source/u-boot + + cp /home/build/package/linux-6.6.86.tar.gz /home/build/pegasus/platform/ss928v100_gcc/open_source/linux + cp /home/build/package/mbedtls-2.16.10.tar.gz /home/build/pegasus/platform/ss928v100_gcc/open_source/mbedtls + cp /home/build/package/arm-trusted-firmware-2.2.tar.gz /home/build/pegasus/platform/ss928v100_gcc/open_source/trusted-firmware-a + cp /home/build/package/u-boot-2020.01.tar.bz2 /home/build/pegasus/platform/ss928v100_gcc/open_source/u-boot + + if [[ "$DIR" =~ (/home/build/pegasus/vendor/[^/]*) ]]; then + TARGET_DIR="${BASH_REMATCH[1]}" + fi + if [ -f ${TARGET_DIR}/patch_build.sh ]; then + echo "patch_build.sh exists, start patch!" + cd ${TARGET_DIR} + chmod +x patch_build.sh + ./patch_build.sh + else + echo "patch_build.sh not exists, skip patch!" + fi + + touch /home/build/executed/set_env_executed + else + echo "set_env has been executed, skip!" + fi +} + +#编译Hi3403V100 clang案例 +function build_clang_demo() +{ + set_env + export PATH=/home/build/llvm/bin:$PATH + export SYSROOT_PATH=/home/build/sysroot + export PATH="/home/build/openeuler_gcc_arm64le/bin:$PATH" + + cd ${DIR} + make LLVM=1 +} + +#编译Hi3403V100 gcc案例 +function build_gcc_demo() +{ + set_env + export PATH="/home/build/openeuler_gcc_arm64le/bin:$PATH" + + cd ${DIR} + make LLVM=0 +} + +#帮助信息 +function generate_usage() +{ + echo "Usage: $0 [-option]" + echo "options:" + echo "./build_gate.sh SOC DEF DIR TARGET" +} + +#解析参数 +function parse_arg() +{ + + case $SOC in + "Hi3403V100") + case $DEF in + "CLANG") + build_clang_demo; + ;; + "GCC") + build_gcc_demo; + ;; + esac + exit_status=$? + ;; + *) + generate_usage; + ;; + esac +} + +#开始时间 +start_time=$(date +%s.%N) + +#主函数入口 +parse_arg + +#结束时间 +end_time=$(date +%s.%N) +cost_time=$(echo "$end_time $start_time" | awk '{printf "%.6f", $1 - $2}') +echo "$TARGET takes $cost_time s" + +if [ $exit_status -eq 0 ]; then + echo "######### Build target:$TARGET success #########" + echo "Finished: SUCCESS" +else + echo "######### Build target:$TARGET failure ########" + echo "Finished: FAILURE" +fi diff --git a/vendor/build_sample.py b/vendor/build_sample.py new file mode 100644 index 0000000..02c68a2 --- /dev/null +++ b/vendor/build_sample.py @@ -0,0 +1,349 @@ +import subprocess +import json +import os +import sys +import time +import stat +import shutil +import hashlib +import tarfile +from typing import List, Dict, Union, Set, Optional + +# 编译配置 +BUILD_INFO_FILENAME = 'build_config.json' +DEFAULT_BUILD_TIMEOUT = 60 * 5 + +def get_local_branches() -> List[str]: + """获取所有本地分支列表""" + result = subprocess.run( + ["git", "branch", "--format=%(refname:short)"], + capture_output=True, + text=True + ) + return result.stdout.strip().split("\n") if result.stdout else [] + +def check_changes_and_get_folders(changed_files: List[str]) -> Optional[Set[str]]: + # 定义要剔除的文件和目录 + files_to_remove = ['samples/build_sample.py','samples/build_gate.sh'] + directories_to_remove = ['common','vendor/opensource'] + # 剔除匹配的文件和目录 + changed_files = [f for f in changed_files if not (f in files_to_remove or any(f.startswith(d) for d in directories_to_remove))] + + """ + 检查变更文件并返回受影响的文件夹集合 + 返回None表示不需要构建或存在非法修改 + """ + # 检查是否有代码文件修改 + has_c_or_h_files = any(f.endswith(('.c', '.h', '.cpp')) for f in changed_files) + + if not has_c_or_h_files: + print("Not need build, only non-source files modified") + sys.exit(0) + + # 检查是否修改了platform目录或构建脚本 + for file_path in changed_files: + if '/' in file_path: + src_folder_name = file_path.split('/')[0] + if '"platform' in src_folder_name or 'platform' in src_folder_name: + print(f"invalid modify, not allow modify platform dir and build script") + print(f"build exit cause") + sys.exit(0) + # Check if it's modifying 'build_sample.py' file + # if 'build_sample.py' in file_path: + # print(f"invalid modify, not allow modify build_sample.py") + # sys.exit(0) + # 提取三级文件夹结构 + changed_folders = set() + for file_path in changed_files: + if file_path.endswith(('.c', '.h', '.cpp')): + parts = file_path.split('/') + if len(parts) >= 4: # 确保路径深度足够 + folder_name = '+'.join(parts[1:-1]) # 取第2至最后一级目录 + changed_folders.add(folder_name) + + print(f"[Changed folders]: {changed_folders}") + return changed_folders + +def compare_with_remote_master() -> Dict[str, Union[List[str], str, Set[str]]]: + """ + 比较所有本地分支与远程master分支的差异 + 返回字典格式: { + 分支名: { + 'files': 差异文件列表, + 'folders': 受影响的文件夹集合(仅C/H文件), + 'error': 错误信息(如果有) + } + } + """ + local_branches = get_local_branches() + remote_master = "origin/master" + branch_diff = {} + + print(f"Comparing {len(local_branches)} local branches with {remote_master}\n") + + for branch in local_branches: + print(f"🔍 Branch [{branch}] vs {remote_master}:") + branch_info = {} + + # 获取差异文件列表 + diff_result = subprocess.run( + ["git", "diff", "--name-only", remote_master, branch], + capture_output=True, + text=True + ) + + if diff_result.returncode != 0: + error_msg = f"Error: {diff_result.stderr.strip()}" + print(f"{error_msg}") + branch_info['error'] = error_msg + branch_diff[branch] = branch_info + continue + + changed_files = diff_result.stdout.strip().split("\n") if diff_result.stdout else [] + branch_info['files'] = changed_files + + if not changed_files: + print(" Identical to remote master") + else: + print(f"{len(changed_files)} changed files:") + for file in changed_files: + print(f"- {file}") + + # 检查变更并获取文件夹信息 + changed_folders = check_changes_and_get_folders(changed_files) + return changed_folders + + +# 获取代码仓所有build_info.json文件内容,并拼接在一起 +def process_build_info_files(): + print(f"start process_build_info_files") + result_list = [] + # 遍历指定目录及其子目录下的所有文件和文件夹 + for root, dirs, files in os.walk("./"): + for file in files: + if file == BUILD_INFO_FILENAME: + file_path = os.path.join(root, file) + print(file_path) + # 读取JSON文件内容 + with open(file_path, 'r') as f: + try: + data = json.load(f) + for item in data: + # 提取需要的字段值 + build_target = item.get('buildTarget', '') + relative_path = item.get('relativePath', '') + chip_name = item.get('chip', '') + build_def = item.get('buildDef', '') + # 组合成一个字符串并添加到结果列表 + if build_def: + combined_value = f"{file_path}+{build_target}+{relative_path}+{chip_name}+{build_def}" + else: + combined_value = f"{file_path}+{build_target}+{relative_path}+{chip_name}" + result_list.append(combined_value) + except json.JSONDecodeError: + print(f"Error decoding JSON in file: {file_path}") + print(f"build exit cause") + sys.exit(-1) + return result_list + +# 对比git和json内容,一致则代表提交,不一样代表之前提交 +def extract_exact_match(input_list, match_list): + print(f"start extract_exact_match") + print(f"[extract_exact_match] input_list: {input_list}") + print(f"[extract_exact_match] match_list: {match_list}") + exact_matches = [] + try: + for string in input_list: + # 使用 split 方法获取第二个 + 和第三个 + 之间的内容 + parts = string.split('+') + if len(parts) >= 4: + sample_company_name = parts[0].split('/')[2] + sample_name_field = parts[2].replace('/','+') + combined_string = sample_company_name + "+" + sample_name_field + if combined_string in match_list: + exact_matches.append(string) + print(f"[extract_exact_match] exact_matches: {exact_matches}") + if not exact_matches: + print(f"build-config has not been synchronously updated") + exit(0) # 退出并返回非零状 + else: + print("exact_matche 列表不为空") + return exact_matches + except TypeError as e: + print(f"Error: {e}") + exit(0) + +def insert_content_before_line(file_path, target_line, content_to_insert): + print(f"start insert_content_before_line") + found_target_line = False + try: + # 以读写模式打开文件 + with open(file_path, 'r') as file: + lines = file.readlines() + # 查找目标字符串并在其上一行添加列表中第一个内容 + for i in range(len(lines)): + if target_line in lines[i]: + lines.insert(i, content_to_insert) + found_target_line = True + print(f"成功在文件 {file_path} 中的目标行 {target_line} 的上一行插入内容{content_to_insert}。") + break # 找到目标字符串后添加内容并退出循环 + + # 如果没找到目标字符串则直接在该文件最后一行加入内容 + if not found_target_line: + lines.append(content_to_insert) + print(f"成功在文件 {file_path} 中的最后一行插入内容{content_to_insert}。") + + with open(file_path, 'w') as file: + file.writelines(lines) + except FileNotFoundError: + print(f"文件 {file_path} 未找到。") + print(f"build exit cause") + sys.exit(-1) + +def build_sample(build_target, source_directory, chip_name, builddef_engine, log_basic_name): + root_dir = '/home/build/pegasus' + build_directory_path = 'vendor' + + # 检查代码仓目录是否存在 + if not os.path.exists(root_dir): + print(f"Error: {root_dir} does not exist") + print(f"build exit cause") + sys.exit(-1) + + # 创建目录archives + if not os.path.exists("./archives"): + os.mkdir("./archives") + os.chdir(root_dir) + log_path = os.path.join('.', 'archives', f'build-{log_basic_name}_{chip_name}_{builddef_engine}.log') + writer = os.fdopen(os.open( + log_path, + os.O_WRONLY | os.O_CREAT | os.O_TRUNC, + stat.S_IWUSR | stat.S_IRUSR, + ), 'wb') + reader = os.fdopen(os.open( + log_path, + os.O_RDONLY, + stat.S_IWUSR | stat.S_IRUSR, + ), 'rb') + os.chmod(log_path, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH) + # 切换到目标目录 + os.chdir(build_directory_path) + build_dir = root_dir + '/' + build_directory_path + '/' + source_directory + build_gate = root_dir + '/' + build_directory_path + '/build_gate.sh' + + try: + # 打开日志文件准备写入 + # 使用 subprocess.Popen() 执行命令,并将标准输出和标准错误重定向到日志文件 + print (f"build_gate: {build_gate}") + print (f"build_target: {build_target}") + print (f"build_dir: {build_dir}") + print (f"chip_name: {chip_name}") + print (f"builddef_engine: {builddef_engine}") + process = subprocess.Popen([build_gate, build_target, build_dir, chip_name, builddef_engine], text=False, stdout=writer, stderr=writer) + # 等待进程结束 + start = time.time() + while True: + timeout = (time.time() - start) > DEFAULT_BUILD_TIMEOUT + + line = reader.readline() + + if line == b'': + if process.poll() is not None: + break + + time.sleep(2) + if not timeout: + continue + else: + process.kill() + raise Exception(f"build exit cause: timeout") + + try: + outs = line.decode('utf-8', errors='strict').rstrip() + except UnicodeDecodeError: + outs = line.decode('gbk', errors='replace').rstrip() + print(f"build exit cause") + sys.exit(-1) + if not outs: + if not timeout: + continue + else: + process.kill() + raise Exception(f"build timeout") + print(outs) + #检查进程的返回码 + if process.returncode == 0: + # 执行复制操作 + # 源目录路径 + src_file = os.path.join(root_dir, f'{build_directory_path}/{source_directory}/out/main') + + # 检查可执行文件是否存在 + if not os.path.exists(src_file): + print(f"Error: {src_file} does not exist") + print(f"build exit cause") + sys.exit(-1) + + # 目标目录路径 + tar_path = os.path.join(root_dir, f'archives/{log_basic_name}_{chip_name}_{builddef_engine}.tar') + print(f"src_file: {src_file}") + print(f"tar_path: {tar_path}") + try: + # 修改点2:创建tar压缩包 + with tarfile.open(tar_path, 'w') as tar: + # 将可执行文件添加到压缩包,arcname参数控制压缩包内文件名 + tar.add(src_file, arcname=os.path.basename(src_file)) + print(f"文件已成功打包至 {tar_path}") + except Exception as e: + print(f"发生错误: {e}") + print(f"build exit cause") + sys.exit(-1) + print(f"{source_directory} {chip_name} sample compilation succeeded. Log saved to '{log_path}'.") + else: + print(f"{source_directory} {chip_name} sample compilation failed. Check '{log_path}' for details.") + # 输出标准错误信息到控制台 + print(process.stderr.read().decode('utf-8')) + except Exception as e: + print(f"An error occurred: {str(e)}") + print(f"build exit cause") + sys.exit(-1) + if writer: + writer.close() + if reader: + reader.close() + +# sample编译前需要添加到编译工具链 +def sample_build_prepare(input_list): + print(f"start sample_build_prepare") + print(f"[sample_build_prepare] input_list: {input_list}") + for string in input_list: + parts = string.split('+') + sample_file_path = parts[0].split('/')[2] + build_target = parts[1] + sample_name = parts[2] + chip_name = parts[3] + if len(parts) > 4: + builddef_engine = parts[4] + else: + print(f"Missing the 'buildDef' parameter") + print(f"build exit cause") + sys.exit(-1) + + target_string = sample_file_path.split('/build_config.json')[0] + '/' + source_directory = target_string + sample_name + sample_name = sample_name.replace('/','-') + print(source_directory) + print(f"[sample_build_prepare] source_directory: {source_directory}") + log_basic_name = f'{build_target}_{sample_name}' + build_sample(build_target, source_directory, chip_name, builddef_engine, log_basic_name) + +def main(): + print(f"start main") + check_list = compare_with_remote_master() + input_list = process_build_info_files() + sample_name = extract_exact_match(input_list, check_list) + sample_build_prepare(sample_name) + print(f"all build step execute end") + +if __name__ == '__main__': + sys.exit(main()) + \ No newline at end of file diff --git a/vendor/hisilicon/build_config.json b/vendor/hisilicon/build_config.json new file mode 100644 index 0000000..ddf8099 --- /dev/null +++ b/vendor/hisilicon/build_config.json @@ -0,0 +1,18 @@ +[ + { + "buildTarget": "Pegasus-app", + "relativePath": "demo/helloworld", + "chip": "Hi3403V100", + "buildDef": "CLANG", + "needSmoke": "false", + "description": "测试" + }, + { + "buildTarget": "Pegasus-app", + "relativePath": "demo/helloworld", + "chip": "Hi3403V100", + "buildDef": "GCC", + "needSmoke": "false", + "description": "测试" + } +] diff --git a/vendor/hisilicon/demo/.vscode/settings.json b/vendor/hisilicon/demo/.vscode/settings.json new file mode 100644 index 0000000..50690bd --- /dev/null +++ b/vendor/hisilicon/demo/.vscode/settings.json @@ -0,0 +1,69 @@ +{ + "files.associations": { + "ostream": "cpp", + "iostream": "cpp", + "types.h": "c", + "random": "cpp", + "array": "cpp", + "string_view": "cpp", + "deque": "cpp", + "string": "cpp", + "vector": "cpp", + "algorithm": "cpp", + "atomic": "cpp", + "bit": "cpp", + "cctype": "cpp", + "chrono": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "compare": "cpp", + "complex": "cpp", + "concepts": "cpp", + "condition_variable": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "list": "cpp", + "map": "cpp", + "set": "cpp", + "unordered_map": "cpp", + "unordered_set": "cpp", + "exception": "cpp", + "functional": "cpp", + "iterator": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "optional": "cpp", + "ratio": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "future": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "iosfwd": "cpp", + "istream": "cpp", + "limits": "cpp", + "mutex": "cpp", + "new": "cpp", + "numbers": "cpp", + "ranges": "cpp", + "semaphore": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "stop_token": "cpp", + "streambuf": "cpp", + "thread": "cpp", + "cinttypes": "cpp", + "typeindex": "cpp", + "typeinfo": "cpp" + } +} \ No newline at end of file diff --git a/vendor/hisilicon/demo/Makefile b/vendor/hisilicon/demo/Makefile new file mode 100644 index 0000000..56d52db --- /dev/null +++ b/vendor/hisilicon/demo/Makefile @@ -0,0 +1,28 @@ +LLVM ?= 0 + +ifeq ($(PARAM_FILE), ) + ifeq ($(LLVM), 1) + PARAM_FILE := ../../../platform/ss928v100_clang/smp/a55_linux/mpp/Makefile.param + include $(PARAM_FILE) + else + PARAM_FILE := ../../../platform/ss928v100_gcc/smp/a55_linux/mpp/Makefile.param + include $(PARAM_FILE) + endif +endif + +target=$(shell ls -d */ | sed "s;/;;g" | grep -v "thirdparty") + +target_clean=$(addsuffix _clean,$(target)) + +.PHONY:clean all $(target) $(target_clean) + +all:$(target) + @echo "~~~~~~~~~~~~~~Build All Sample SUCCESS~~~~~~~~~~~~~~" +clean:$(target_clean) + @echo "~~~~~~~~~~~~~~Clean All Sample SUCCESS~~~~~~~~~~~~~~" +$(target): + @echo "~~~~~~~~~~Start build $@~~~~~~~~~~" + @cd $@ && make +$(target_clean): + @echo "~~~~~~~~~~Start clean $(subst _clean,,$@)~~~~~~~~~~" + @cd $(subst _clean,,$@) && make clean diff --git a/vendor/hisilicon/demo/Makefile.param b/vendor/hisilicon/demo/Makefile.param new file mode 100644 index 0000000..50984d0 --- /dev/null +++ b/vendor/hisilicon/demo/Makefile.param @@ -0,0 +1,253 @@ +LLVM ?= 0 + +ifeq ($(PARAM_FILE), ) + ifeq ($(LLVM), 1) + PARAM_FILE := ../../../../platform/ss928v100_clang/smp/a55_linux/mpp/Makefile.param + include $(PARAM_FILE) + else + PARAM_FILE := ../../../../platform/ss928v100_gcc/smp/a55_linux/mpp/Makefile.param + include $(PARAM_FILE) + endif +endif + +ifeq ($(LLVM), 1) + export CXX := $(COMPILER_PATH)/clang++ --target=aarch64-linux-ohos -Wno-unused-command-line-argument --sysroot $(SYSROOT_PATH) +else + export CXX := $(CROSS)g++ +endif + +################# select sensor type for your sample ############################### +#### HY_S0603_MIPI_8M_30FPS_12BIT ################# +#### HY_S0603_MIPI_8M_30FPS_10BIT_WDR2TO1 ################# +#### OV_OS08A20_MIPI_8M_30FPS_12BIT ################# +#### OV_OS08A20_MIPI_8M_30FPS_12BIT_WDR2TO1 ################# +#### SONY_IMX347_SLAVE_MIPI_4M_30FPS_12BIT ################# +#### OV_OS04A10_MIPI_4M_30FPS_12BIT ################# +#### SC450AI_MIPI_4M_30FPS_10BIT ################# +#### SC450AI_MIPI_4M_30FPS_10BIT_WDR2TO1 ################# +#### SC450AI_2L_MIPI_4M_30FPS_10BIT ################# +#### SC450AI_2L_MIPI_2M_30FPS_10BIT ################# +#### SC450AI_2L_MIPI_1344x760_30FPS_10BIT ################# +## change sensor type here. default: hy_s0603 + +SENSOR0_TYPE ?= OV_OS04A10_MIPI_4M_30FPS_12BIT +SENSOR1_TYPE ?= OV_OS04A10_MIPI_4M_30FPS_12BIT +SENSOR2_TYPE ?= OV_OS04A10_MIPI_4M_30FPS_12BIT +SENSOR3_TYPE ?= OV_OS04A10_MIPI_4M_30FPS_12BIT + +MPI_LIBS := $(REL_LIB)/libss_mpi.a + +ifeq ($(CONFIG_OT_ISP_SUPPORT), y) +MPI_LIBS += $(REL_LIB)/libss_ae.a +MPI_LIBS += $(REL_LIB)/libss_isp.a +MPI_LIBS += $(REL_LIB)/libot_isp.a +MPI_LIBS += $(REL_LIB)/libss_awb.a +MPI_LIBS += $(REL_LIB)/libss_dehaze.a +MPI_LIBS += $(REL_LIB)/libss_extend_stats.a +MPI_LIBS += $(REL_LIB)/libss_drc.a +MPI_LIBS += $(REL_LIB)/libss_ldci.a +MPI_LIBS += $(REL_LIB)/libss_crb.a +MPI_LIBS += $(REL_LIB)/libss_bnr.a +MPI_LIBS += $(REL_LIB)/libss_calcflicker.a +MPI_LIBS += $(REL_LIB)/libss_ir_auto.a +MPI_LIBS += $(REL_LIB)/libss_acs.a +MPI_LIBS += $(REL_LIB)/libss_acs.a +MPI_LIBS += $(REL_LIB)/libsns_hy_s0603.a +MPI_LIBS += $(REL_LIB)/libsns_os08a20.a +MPI_LIBS += $(REL_LIB)/libsns_imx347_slave.a +MPI_LIBS += $(REL_LIB)/libsns_os04a10.a +MPI_LIBS += $(REL_LIB)/libsns_sc450ai.a +MPI_LIBS += $(REL_LIB)/libsns_sc450ai_2l.a +endif + + +ifeq ($(CONFIG_OT_AUDIO_SUPPORT), y) +AUDIO_LIBA := $(REL_LIB)/libss_voice_engine.a +AUDIO_LIBA += $(REL_LIB)/libss_upvqe.a +AUDIO_LIBA += $(REL_LIB)/libss_dnvqe.a +AUDIO_LIBA += $(REL_LIB)/libaac_comm.a +AUDIO_LIBA += $(REL_LIB)/libaac_enc.a +AUDIO_LIBA += $(REL_LIB)/libaac_dec.a +AUDIO_LIBA += $(REL_LIB)/libaac_sbr_enc.a +AUDIO_LIBA += $(REL_LIB)/libaac_sbr_dec.a +endif + +COMMON_DIR ?= $(SDK_PATH)/mpp/sample/common +ifeq ($(CONFIG_OT_AUDIO_SUPPORT), y) +AUDIO_ADP_DIR ?= $(SDK_PATH)/mpp/sample/audio/adp +endif + +INC_FLAGS := -I$(REL_INC) +INC_FLAGS += -I$(REL_INC) +INC_FLAGS += -I$(SDK_PATH)/$(EXTDRV)/es8388 +INC_FLAGS += -I$(SDK_PATH)/$(EXTDRV)/lt8618sx + +ISP_VERSION := ISP_V2 + +CFLAGS += -Wall -g $(INC_FLAGS) -D$(OT_ARCH) -D$(OT_FPGA) -lpthread -lm -ldl -D$(ISP_VERSION) +ifeq ($(CONFIG_LIBC_TYPE),glibc) +CFLAGS += -lstdc++ +else +CFLAGS += -lc++ -lc +endif + +CFLAGS += $(LIBS_CFLAGS) +CFLAGS += $(LIBS_EXEC_CFLAGS) +CFLAGS += $(MPP_CFLAGS) +CFLAGS += -DSENSOR0_TYPE=$(SENSOR0_TYPE) +CFLAGS += -DSENSOR1_TYPE=$(SENSOR1_TYPE) +CFLAGS += -DSENSOR2_TYPE=$(SENSOR2_TYPE) +CFLAGS += -DSENSOR3_TYPE=$(SENSOR3_TYPE) + +ifeq ($(MEM_SHARE), y) + CFLAGS += -DSAMPLE_MEM_SHARE_ENABLE +endif + +################ select audio codec type for your sample ################ +#external acodec +#ACODEC_TYPE ?= ACODEC_TYPE_ES8388 +ACODEC_TYPE ?= ACODEC_TYPE_INNER +INNER_HDMI ?= y + +ifeq ($(ACODEC_TYPE), ACODEC_TYPE_ES8388) + CFLAGS += -DOT_ACODEC_TYPE_ES8388 +endif + +ifeq ($(INNER_HDMI), y) + CFLAGS += -DOT_ACODEC_TYPE_HDMI +endif + +ifeq ($(ACODEC_TYPE), ACODEC_TYPE_INNER) + CFLAGS += -DOT_ACODEC_TYPE_INNER +endif + +ifeq ($(CONFIG_OT_AUDIO_SUPPORT), y) +################ select audio module library type for your sample ################ +AUDIO_MODULE_LIB_TYPE ?= AUDIO_LIB_TYPE_STATIC +#AUDIO_MODULE_LIB_TYPE ?= AUDIO_LIB_TYPE_SHARE +ifeq ($(AUDIO_MODULE_LIB_TYPE), AUDIO_LIB_TYPE_STATIC) +##### VQE ##### + CFLAGS += -DOT_VQE_USE_STATIC_MODULE_REGISTER + AUDIO_LIBA += $(REL_LIB)/libvqe_res.a + AUDIO_LIBA += $(REL_LIB)/libvqe_record.a + AUDIO_LIBA += $(REL_LIB)/libvqe_hpf.a + AUDIO_LIBA += $(REL_LIB)/libvqe_anr.a + AUDIO_LIBA += $(REL_LIB)/libvqe_aec.a + AUDIO_LIBA += $(REL_LIB)/libvqe_agc.a + AUDIO_LIBA += $(REL_LIB)/libvqe_eq.a + AUDIO_LIBA += $(REL_LIB)/libvqe_talkv2.a +##### AAC ##### + CFLAGS += -DOT_AAC_USE_STATIC_MODULE_REGISTER + AUDIO_LIBA += $(REL_LIB)/libaac_dec.a + AUDIO_LIBA += $(REL_LIB)/libaac_enc.a + AUDIO_LIBA += $(REL_LIB)/libaac_comm.a + CFLAGS += -DOT_AAC_HAVE_SBR_LIB + AUDIO_LIBA += $(REL_LIB)/libaac_sbr_dec.a + AUDIO_LIBA += $(REL_LIB)/libaac_sbr_enc.a +endif +endif + +################ config gyro dis for your sample ################ +GYRO_DIS ?= n + +ifeq ($(GYRO_DIS), y) + CFLAGS += -DOT_GYRODIS_SUPPORT + MPI_LIBS += $(REL_LIB)/libss_motionfusion.a +endif + +######################################################################### +#COMM_SRC := $(wildcard $(COMMON_DIR)/*.c) +COMM_SRC := $(wildcard $(COMMON_DIR)/sample_comm_sys.c) +COMM_SRC += $(wildcard $(COMMON_DIR)/sample_comm_isp.c) +COMM_SRC += $(wildcard $(COMMON_DIR)/sample_comm_vi.c) +COMM_SRC += $(wildcard $(COMMON_DIR)/sample_comm_vo.c) +COMM_SRC += $(wildcard $(COMMON_DIR)/sample_comm_mipi_tx.c) +COMM_SRC += $(wildcard $(COMMON_DIR)/sample_comm_vpss.c) +COMM_SRC += $(wildcard $(COMMON_DIR)/loadbmp.c) +COMM_SRC += $(wildcard $(COMMON_DIR)/sample_comm_vdec.c) +ifeq ($(CONFIG_OT_AUDIO_SUPPORT), y) +COMM_SRC += $(wildcard $(COMMON_DIR)/sample_comm_audio.c) +endif +COMM_SRC += $(wildcard $(COMMON_DIR)/sample_comm_venc.c) +COMM_SRC += $(wildcard $(COMMON_DIR)/sample_comm_region.c) +COMM_SRC += $(wildcard $(COMMON_DIR)/sample_ipc.c) +ifeq ($(CONFIG_DRIVER_SPACE_TYPE),user_space) +COMM_SRC += $(wildcard $(COMMON_DIR)/sdk_exit.c) +COMM_SRC += $(wildcard $(COMMON_DIR)/sdk_init.c) +endif +COMM_OBJ := $(COMM_SRC:%.c=%.o) +COMM_INC := -I$(COMMON_DIR) +ifeq ($(CONFIG_OT_AUDIO_SUPPORT), y) +COMM_INC += -I$(AUDIO_ADP_DIR) +endif + +MEDIA_MSG_CLIENT_SRC := $(wildcard $(COMMON_DIR)/media_msg/client/*.c) +MEDIA_MSG_CLIENT_OBJ := $(MEDIA_MSG_CLIENT_SRC:%.c=%.o) + +MEDIA_MSG_SERVER_SRC := $(wildcard $(COMMON_DIR)/media_msg/server/*.c) +MEDIA_MSG_SERVER_OBJ := $(MEDIA_MSG_SERVER_SRC:%.c=%.o) + +MEDIA_MSG_INC := -I$(COMMON_DIR)/media_msg/include +MEDIA_MSG_INC += -I$(SDK_PATH)/ot_syslink/ipcmsg/include +MEDIA_MSG_INC += -I$(SDK_PATH)/ot_syslink/datafifo/include + +ifeq ($(CONFIG_DRIVER_SPACE_TYPE),user_space) +MPI_LIBS += $(REL_LIB)/svp_npu/libsvp_acl.a +MPI_LIBS += -L$(REL_LIB)/svp_npu -lprotobuf-c +SDK_LIB_PATH := -L$(REL_LIB) -L$(REL_LIB)/extdrv +SDK_LIB := $(SDK_LIB_PATH) +SDK_LIB += -l$(KO_PREFIX)_osal +SDK_LIB += -l$(KO_PREFIX)_base +SDK_LIB += -l$(KO_PREFIX)_sys +#SDK_LIB += -l$(KO_PREFIX)_vb +SDK_LIB += -l$(KO_PREFIX)_chnl +SDK_LIB += -l$(KO_PREFIX)_rgn +SDK_LIB += -l$(KO_PREFIX)_vpp +SDK_LIB += -l$(KO_PREFIX)_vo +SDK_LIB += -l$(KO_PREFIX)_vgs +SDK_LIB += -l$(KO_PREFIX)_vpss +SDK_LIB += -l$(KO_PREFIX)_vdec +SDK_LIB += -l$(KO_PREFIX)_h265e +SDK_LIB += -l$(KO_PREFIX)_h264e +SDK_LIB += -l$(KO_PREFIX)_jpege +SDK_LIB += -l$(KO_PREFIX)_venc +#SDK_LIB += -l$(KO_PREFIX)_venc_svr +SDK_LIB += -l$(KO_PREFIX)_vedu +SDK_LIB += -l$(KO_PREFIX)_vi +SDK_LIB += -l$(KO_PREFIX)_mpi_isp +SDK_LIB += -l$(KO_PREFIX)_rc +SDK_LIB += -l$(KO_PREFIX)_jpegd +SDK_LIB += $(REL_LIB)/libss_hdmi.a +SDK_LIB += -l$(KO_PREFIX)_vfmw +SDK_LIB += -l$(KO_PREFIX)_gdc +SDK_LIB += -l$(KO_PREFIX)_dis +SDK_LIB += -l$(KO_PREFIX)_irq +SDK_LIB += $(REL_LIB)/libss_dpu_match.a +SDK_LIB += $(REL_LIB)/libss_dpu_rect.a +SDK_LIB += $(REL_LIB)/libss_mau.a +SDK_LIB += $(REL_LIB)/libss_ive.a +SDK_LIB += $(REL_LIB)/libss_pqp.a +#SDK_LIB += -l$(KO_PREFIX)_avs +# SDK_LIB += -l$(KO_PREFIX)_mcf +# SDK_LIB += -l$(KO_PREFIX)_mcf_vi +SDK_LIB += -l$(KO_PREFIX)_sensor_i2c +SDK_LIB += -l$(KO_PREFIX)_sensor_spi +#SDK_LIB += -ltde + +ifeq ($(CONFIG_OT_AUDIO_SUPPORT),y) +SDK_LIB += -l$(KO_PREFIX)_aio +SDK_LIB += -l$(KO_PREFIX)_ai +SDK_LIB += -l$(KO_PREFIX)_ao +SDK_LIB += -l$(KO_PREFIX)_aenc +SDK_LIB += -l$(KO_PREFIX)_adec +SDK_LIB += -l$(KO_PREFIX)_acodec + +MPI_LIBS += $(AUDIO_LIBA) +endif + +ifeq ($(CONFIG_OT_HEIF_SUPPORT),y) +SDK_LIB += -lheif +SDK_LIB += -lfileformat +endif + +endif diff --git a/vendor/hisilicon/demo/helloworld/Makefile b/vendor/hisilicon/demo/helloworld/Makefile new file mode 100644 index 0000000..8554887 --- /dev/null +++ b/vendor/hisilicon/demo/helloworld/Makefile @@ -0,0 +1,11 @@ +include ../Makefile.param + +########### SRCS & INC ############ +SMP_SRCS := $(wildcard $(PWD)/*.c) + +TARGET := main + +TARGET_PATH := $(PWD)/out + +# compile linux or LITEOS +include ../smp_linux_user_space.mak \ No newline at end of file diff --git a/vendor/hisilicon/demo/helloworld/helloworld.c b/vendor/hisilicon/demo/helloworld/helloworld.c new file mode 100644 index 0000000..3d10c83 --- /dev/null +++ b/vendor/hisilicon/demo/helloworld/helloworld.c @@ -0,0 +1,280 @@ +/* + * Copyright (c) 2025 HiSilicon (Shanghai) Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "sample_comm.h" +#include "sdk_module_init.h" +#include "securec.h" + +static volatile sig_atomic_t g_sig_flag = 0; + +#define VB_RAW_CNT_NONE 0 +#define VB_YUV_ROUTE_CNT 10 + +static sample_vo_cfg g_vo_cfg = { + .vo_dev = SAMPLE_VO_DEV_UHD, + .vo_intf_type = OT_VO_INTF_HDMI, + .intf_sync = OT_VO_OUT_1080P60, + .bg_color = COLOR_RGB_BLACK, + .pix_format = OT_PIXEL_FORMAT_YVU_SEMIPLANAR_420, + .disp_rect = {0, 0, 1920, 1080}, + .image_size = {1920, 1080}, + .vo_part_mode = OT_VO_PARTITION_MODE_SINGLE, + .dis_buf_len = 3, /* 3: def buf len for single */ + .dst_dynamic_range = OT_DYNAMIC_RANGE_SDR8, + .vo_mode = VO_MODE_1MUX, + .compress_mode = OT_COMPRESS_MODE_NONE, +}; + +static td_void sample_get_char(td_void) +{ + if (g_sig_flag == 1) { + return; + } + + sample_pause(); +} + +static td_void sample_vi_get_default_vb_config(ot_size *size, ot_vb_cfg *vb_cfg, ot_vi_video_mode video_mode, + td_u32 yuv_cnt, td_u32 raw_cnt) +{ + ot_vb_calc_cfg calc_cfg; + ot_pic_buf_attr buf_attr; + + (td_void)memset_s(vb_cfg, sizeof(ot_vb_cfg), 0, sizeof(ot_vb_cfg)); + vb_cfg->max_pool_cnt = 128; /* 128 blks */ + + /* default YUV pool: SP420 + compress_seg */ + buf_attr.width = size->width; + buf_attr.height = size->height; + buf_attr.align = OT_DEFAULT_ALIGN; + buf_attr.bit_width = OT_DATA_BIT_WIDTH_8; + buf_attr.pixel_format = OT_PIXEL_FORMAT_YVU_SEMIPLANAR_420; + buf_attr.compress_mode = OT_COMPRESS_MODE_SEG; + ot_common_get_pic_buf_cfg(&buf_attr, &calc_cfg); + + vb_cfg->common_pool[0].blk_size = calc_cfg.vb_size; + vb_cfg->common_pool[0].blk_cnt = yuv_cnt; + + /* default raw pool: raw12bpp + compress_line */ + buf_attr.pixel_format = OT_PIXEL_FORMAT_RGB_BAYER_12BPP; + buf_attr.compress_mode = (video_mode == OT_VI_VIDEO_MODE_NORM ? OT_COMPRESS_MODE_LINE : OT_COMPRESS_MODE_NONE); + ot_common_get_pic_buf_cfg(&buf_attr, &calc_cfg); + vb_cfg->common_pool[1].blk_size = calc_cfg.vb_size; + vb_cfg->common_pool[1].blk_cnt = raw_cnt; +} + +static td_s32 sample_vio_sys_init(ot_vi_vpss_mode_type mode_type, ot_vi_video_mode video_mode, + td_u32 yuv_cnt, td_u32 raw_cnt) +{ + td_s32 ret; + ot_size size; + ot_vb_cfg vb_cfg; + td_u32 supplement_config; + sample_sns_type sns_type = SENSOR0_TYPE; + + sample_comm_vi_get_size_by_sns_type(sns_type, &size); + sample_vi_get_default_vb_config(&size, &vb_cfg, video_mode, yuv_cnt, raw_cnt); + + supplement_config = OT_VB_SUPPLEMENT_BNR_MOT_MASK; + ret = sample_comm_sys_init_with_vb_supplement(&vb_cfg, supplement_config); + if (ret != TD_SUCCESS) { + return TD_FAILURE; + } + + ret = sample_comm_vi_set_vi_vpss_mode(mode_type, video_mode); + if (ret != TD_SUCCESS) { + return TD_FAILURE; + } + + return TD_SUCCESS; +} + +static td_s32 sample_vio_start_vpss(ot_vpss_grp grp, ot_size *in_size) +{ + td_s32 ret; + ot_low_delay_info low_delay_info; + ot_vpss_grp_attr grp_attr; + ot_vpss_chn_attr chn_attr; + td_bool chn_enable[OT_VPSS_MAX_PHYS_CHN_NUM] = {TD_TRUE, TD_FALSE, TD_FALSE, TD_FALSE}; + + sample_comm_vpss_get_default_grp_attr(&grp_attr); + grp_attr.max_width = in_size->width; + grp_attr.max_height = in_size->height; + sample_comm_vpss_get_default_chn_attr(&chn_attr); + chn_attr.width = in_size->width; + chn_attr.height = in_size->height; + + ret = sample_common_vpss_start(grp, chn_enable, &grp_attr, &chn_attr, OT_VPSS_MAX_PHYS_CHN_NUM); + if (ret != TD_SUCCESS) { + return ret; + } + + low_delay_info.enable = TD_TRUE; + low_delay_info.line_cnt = 200; /* 200: lowdelay line */ + low_delay_info.one_buf_en = TD_FALSE; + ret = ss_mpi_vpss_set_low_delay_attr(grp, 0, &low_delay_info); + if (ret != TD_SUCCESS) { + sample_common_vpss_stop(grp, chn_enable, OT_VPSS_MAX_PHYS_CHN_NUM); + return ret; + } + + return TD_SUCCESS; +} + +static td_void sample_vio_stop_vpss(ot_vpss_grp grp) +{ + td_bool chn_enable[OT_VPSS_MAX_PHYS_CHN_NUM] = {TD_TRUE, TD_FALSE, TD_FALSE, TD_FALSE}; + + sample_common_vpss_stop(grp, chn_enable, OT_VPSS_MAX_PHYS_CHN_NUM); +} + +static td_s32 sample_vio_start_vo(sample_vo_mode vo_mode) +{ + g_vo_cfg.vo_mode = vo_mode; + + return sample_comm_vo_start_vo(&g_vo_cfg); +} + +static td_void sample_vio_stop_vo(td_void) +{ + sample_comm_vo_stop_vo(&g_vo_cfg); +} + +static td_s32 sample_vio_start_and_bind_vo(ot_vpss_grp vpss_grp[], td_u32 grp_num, const ot_size *in_size) +{ + td_u32 i; + td_s32 ret; + sample_vo_mode vo_mode = VO_MODE_1MUX; + const ot_vpss_chn vpss_chn = 0; + const ot_vo_layer vo_layer = 0; + ot_vo_chn vo_chn[4] = {0, 1, 2, 3}; /* 4: max chn num, 0/1/2/3 chn id */ + + if (grp_num > 1) { + vo_mode = VO_MODE_4MUX; + } + + ret = sample_vio_start_vo(vo_mode); + if (ret != TD_SUCCESS) { + goto start_vo_failed; + } + + + for (i = 0; i < grp_num; i++) { + ret = sample_comm_vpss_bind_vo(vpss_grp[i], vpss_chn, vo_layer, vo_chn[i]); + if (ret != TD_SUCCESS) { + goto vpss_bind_vo_failed; + break; + } + } + return TD_SUCCESS; + +vpss_bind_vo_failed: + sample_vio_stop_vo(); +start_vo_failed: + return TD_FAILURE; +} + +static td_void sample_vio_stop_and_unbind_vo(ot_vpss_grp vpss_grp[], td_u32 grp_num) +{ + td_u32 i; + const ot_vpss_chn vpss_chn = 0; + const ot_vo_layer vo_layer = 0; + ot_vo_chn vo_chn[4] = {0, 1, 2, 3}; /* 4: max chn num, 0/1/2/3 chn id */ + + for (i = 0; i < grp_num; i++) { + sample_comm_vpss_un_bind_vo(vpss_grp[i], vpss_chn, vo_layer, vo_chn[i]); + } + + sample_vio_stop_vo(); +} + +static td_s32 sample_vio_one_sensor(td_void) +{ + td_s32 ret; + td_u32 yuv_cnt = VB_YUV_ROUTE_CNT; + td_u32 raw_cnt = VB_RAW_CNT_NONE; + ot_vi_vpss_mode_type mode_type = OT_VI_ONLINE_VPSS_OFFLINE; + ot_vi_video_mode video_mode = OT_VI_VIDEO_MODE_NORM; + const ot_vi_pipe vi_pipe = 0; + const ot_vi_chn vi_chn = 0; + ot_vpss_grp vpss_grp[1] = {0}; + const td_u32 grp_num = 1; + const ot_vpss_chn vpss_chn = 0; + sample_vi_cfg vi_cfg; + sample_sns_type sns_type; + ot_size in_size; + + ret = sample_vio_sys_init(mode_type, video_mode, yuv_cnt, raw_cnt); + if (ret != TD_SUCCESS) { + goto sys_init_failed; + } + + sns_type = SENSOR0_TYPE; + sample_comm_vi_get_size_by_sns_type(sns_type, &in_size); + sample_comm_vi_get_default_vi_cfg(sns_type, &vi_cfg); + ret = sample_comm_vi_start_vi(&vi_cfg); + if (ret != TD_SUCCESS) { + goto start_vi_failed; + } + + sample_comm_vi_bind_vpss(vi_pipe, vi_chn, vpss_grp[0], vpss_chn); + ret = sample_vio_start_vpss(vpss_grp[0], &in_size); + if (ret != TD_SUCCESS) { + goto start_vpss_failed; + } + + ret = sample_vio_start_and_bind_vo(vpss_grp, grp_num, &in_size); + if (ret != TD_SUCCESS) { + goto start_venc_and_vo_failed; + } + + sample_get_char(); + + sample_vio_stop_and_unbind_vo(vpss_grp, grp_num); + +start_venc_and_vo_failed: + sample_vio_stop_vpss(vpss_grp[0]); +start_vpss_failed: + sample_comm_vi_un_bind_vpss(vi_pipe, vi_chn, vpss_grp[0], vpss_chn); + sample_comm_vi_stop_vi(&vi_cfg); +start_vi_failed: + sample_comm_sys_exit(); +sys_init_failed: + return ret; +} + +td_s32 main(td_void) +{ + td_s32 ret; + SDK_init(); + + ret = sample_vio_one_sensor(); + printf("helloworld exit normally! \n"); + + SDK_exit(); + return ret; +} diff --git a/vendor/hisilicon/demo/smp_linux_user_space.mak b/vendor/hisilicon/demo/smp_linux_user_space.mak new file mode 100644 index 0000000..b91a5bb --- /dev/null +++ b/vendor/hisilicon/demo/smp_linux_user_space.mak @@ -0,0 +1,49 @@ +MKDIRS := $(TARGET_PATH) +TARGET_NAME := $(patsubst %/,%,$(dir $(patsubst %/,%,$(TARGET_PATH)))) + +# target source +OBJS := $(SMP_SRCS:%.c=%.o) +CXX_OBJS := $(CXX_SRCS:%.cpp=%.o) + +CFLAGS += $(COMM_INC) + +MPI_LIBS += $(REL_LIB)/libss_hdmi.a +MPI_LIBS += $(LIBS_LD_CFLAGS) + +.PHONY : clean all + +all: $(TARGET) + +$(TARGET):$(COMM_OBJ) $(OBJS) $(CXX_OBJS) | $(MKDIRS) + @echo ... ld $@ + @echo ... $(TARGET) + @$(CC) $(CFLAGS) -lpthread -lm -o $(TARGET_PATH)/$@ $^ -Wl,--start-group $(MPI_LIBS) $(SDK_LIB) $(SENSOR_LIBS) $(INIPARSER_LIB) $(REL_LIB)/libsecurec.a -Wl,--end-group + @echo ================= $(notdir $(TARGET_NAME)) build success ================= + +$(COMM_OBJ): %.o : %.c + @echo @@@ cc $^ + @$(CC) $(CFLAGS) -c $< -o $@ + +$(OBJS): %.o : %.c + @echo @@@ cc $^ + @$(CC) $(CFLAGS) -c $< -o $@ + +$(CXX_OBJS): %.o : %.cpp + @echo @@@ c++ $^ + @$(CXX) $(CFLAGS) -c $< -o $@ + +$(MKDIRS): + @mkdir -p $(TARGET_PATH) + +clean: + @rm -rf $(TARGET_PATH) + @rm -f $(OBJS) + @rm -f $(COMM_OBJ) + @rm -f $(CXX_OBJS) + +cleanstream: + @rm -f *.h264 + @rm -f *.h265 + @rm -f *.jpg + @rm -f *.mjp + @rm -f *.mp4 diff --git a/vendor/hisilicon/patch_build.sh b/vendor/hisilicon/patch_build.sh new file mode 100755 index 0000000..dd70f14 --- /dev/null +++ b/vendor/hisilicon/patch_build.sh @@ -0,0 +1,20 @@ +# !/bin/bash + +################################################################################# +# Copyright (c) 2025 HiSilicon (Shanghai) Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +################################################################################# + +cd ../ebaina +./patch_build.sh -- Gitee From 40a1d8408e8793db6333193c3f566f369abb441f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=88=91=E5=BE=88=E5=BF=99?= Date: Thu, 27 Nov 2025 07:43:37 +0000 Subject: [PATCH 2/3] update --- vendor/build_gate.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vendor/build_gate.sh b/vendor/build_gate.sh index 9a60b9b..d8d9003 100755 --- a/vendor/build_gate.sh +++ b/vendor/build_gate.sh @@ -51,6 +51,7 @@ function build_clang_demo() export PATH="/home/build/openeuler_gcc_arm64le/bin:$PATH" cd ${DIR} + make LLVM=1 clean make LLVM=1 } @@ -61,6 +62,7 @@ function build_gcc_demo() export PATH="/home/build/openeuler_gcc_arm64le/bin:$PATH" cd ${DIR} + make LLVM=0 clean make LLVM=0 } -- Gitee From 58124745e4324ff8f1427260c76c8229913c334b Mon Sep 17 00:00:00 2001 From: ZX <1754188304@qq.com> Date: Mon, 1 Dec 2025 11:23:53 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=88=A0=E9=99=A4.vscode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/hisilicon/demo/.vscode/settings.json | 69 --------------------- 1 file changed, 69 deletions(-) delete mode 100644 vendor/hisilicon/demo/.vscode/settings.json diff --git a/vendor/hisilicon/demo/.vscode/settings.json b/vendor/hisilicon/demo/.vscode/settings.json deleted file mode 100644 index 50690bd..0000000 --- a/vendor/hisilicon/demo/.vscode/settings.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "files.associations": { - "ostream": "cpp", - "iostream": "cpp", - "types.h": "c", - "random": "cpp", - "array": "cpp", - "string_view": "cpp", - "deque": "cpp", - "string": "cpp", - "vector": "cpp", - "algorithm": "cpp", - "atomic": "cpp", - "bit": "cpp", - "cctype": "cpp", - "chrono": "cpp", - "clocale": "cpp", - "cmath": "cpp", - "compare": "cpp", - "complex": "cpp", - "concepts": "cpp", - "condition_variable": "cpp", - "cstdarg": "cpp", - "cstddef": "cpp", - "cstdint": "cpp", - "cstdio": "cpp", - "cstdlib": "cpp", - "cstring": "cpp", - "ctime": "cpp", - "cwchar": "cpp", - "cwctype": "cpp", - "list": "cpp", - "map": "cpp", - "set": "cpp", - "unordered_map": "cpp", - "unordered_set": "cpp", - "exception": "cpp", - "functional": "cpp", - "iterator": "cpp", - "memory": "cpp", - "memory_resource": "cpp", - "numeric": "cpp", - "optional": "cpp", - "ratio": "cpp", - "system_error": "cpp", - "tuple": "cpp", - "type_traits": "cpp", - "utility": "cpp", - "future": "cpp", - "initializer_list": "cpp", - "iomanip": "cpp", - "iosfwd": "cpp", - "istream": "cpp", - "limits": "cpp", - "mutex": "cpp", - "new": "cpp", - "numbers": "cpp", - "ranges": "cpp", - "semaphore": "cpp", - "sstream": "cpp", - "stdexcept": "cpp", - "stop_token": "cpp", - "streambuf": "cpp", - "thread": "cpp", - "cinttypes": "cpp", - "typeindex": "cpp", - "typeinfo": "cpp" - } -} \ No newline at end of file -- Gitee