卐词意不达 · 2021年12月11日

xr806 编译 Unable to load "...SDKconfig.gni"

原版修复 目前能用了。

#!/usr/bin/python3

import os

pwd = os.path.dirname (__file__)
f = open('{0}/.config'.format(pwd),'r')


DATA = ['#XR806 config']
for line in f.readlines():
    if line[0] != '#' and line[0] != '\n':
        line = line.strip('\n')
        DATA.append(line)

GNf = open('{0}/../liteos_m/SDKconfig.gni'.format(pwd),'w')
GNf.write('#Build by config.py DO NOT EDIT!\n\n')
GNf.write('SDK_cflags = [\n\
    "-mcpu=cortex-m33",\n\
    "-mtune=cortex-m33",\n\
    "-march=armv8-m.main+dsp",\n\
    "-mfpu=fpv5-sp-d16",\n\
    "-mfloat-abi=softfp",\n\
    "-mcmse",\n\
    "-mthumb",\n\
    "-c",\n\
    "-g",\n\
    "-fno-common",\n\
    "-fmessage-length=0",\n\
    "-fno-exceptions",\n\
    "-ffunction-sections",\n\
    "-fdata-sections",\n\
    "-fomit-frame-pointer",\n\
    "-Wall",\n\
    #"-Werror",\n\
    "-Wno-cpp",\n\
    "-Wpointer-arith",\n\
    "-Wno-error=unused-function",\n\
    "-MMD",\n\
    "-MP",\n\
    "-Os",\n\
    "-DNDEBUG",\n\
    "-Wno-error=stringop-truncation",\n\
    "-Wno-error=restrict",\n\
    "-includexr_config.h",\n\
    "-includecommon/prj_conf_opt.h",\n\
    "-DCONFIG_CHIP_ARCH_VER=3",\n\
    "-DCONFIG_ARCH_APP_CORE",\n\
    "-DCONFIG_CPU_CM33F",\n\
]\n\n')

PROJECT = [x for i,x in enumerate(DATA) if x.find('CONFIG_PROJECT=') != -1]
if len(PROJECT) == 1:
    ProjectPath = PROJECT[0]
    ProjectPath = ProjectPath.strip('CONFIG_PROJECT=')
GNf.write('ProjectPath = {0}\n\n'.format(ProjectPath))
if ProjectPath == '"bootloader"' or ProjectPath == '"test/etf"':
    GNf.write('declare_args() {IsBootloader = "true"}\n')
else:
    GNf.write('declare_args() {IsBootloader = "false"}\n')



#print (DATA)

下面是这次修复的过程总结。

py版本 Python 3.9.9
我的系统用户名是make 各位自己看着改

hb build -f 后出错 如图
error.png
解决方法在
/home/make/xr806_openharmony/device/xradio/xr806/xr_skylark/
放置一个
congfig1.py
内容如下 如若复制无效进 全志在线官方交流2群 看群共享文件
使用的是绝对路径
不会py 网上复制粘贴改的。

#!/usr/bin/python3

file = open('/home/make/xr806_openharmony/device/xradio/xr806/xr_skylark/.config', 'r')

try:
 DATA = ['#XR806 config']
 text_lines = file.readlines()
 print(type(text_lines), text_lines)
 for line in text_lines:
    if line[0] != '#' and line[0] != '\n':
        line = line.strip('\n')
        DATA.append(line)
 GNf = open('/home/make/xr806_openharmony/device/xradio/xr806/liteos_m/SDKconfig.gni', 'w')
 GNf.write('#Build by config.py DO NOT EDIT!\n\n')
 GNf.write('SDK_cflags = [\n\
    "-mcpu=cortex-m33",\n\
    "-mtune=cortex-m33",\n\
    "-march=armv8-m.main+dsp",\n\
    "-mfpu=fpv5-sp-d16",\n\
    "-mfloat-abi=softfp",\n\
    "-mcmse",\n\
    "-mthumb",\n\
    "-c",\n\
    "-g",\n\
    "-fno-common",\n\
    "-fmessage-length=0",\n\
    "-fno-exceptions",\n\
    "-ffunction-sections",\n\
    "-fdata-sections",\n\
    "-fomit-frame-pointer",\n\
    "-Wall",\n\
    #"-Werror",\n\
    "-Wno-cpp",\n\
    "-Wpointer-arith",\n\
    "-Wno-error=unused-function",\n\
    "-MMD",\n\
    "-MP",\n\
    "-Os",\n\
    "-DNDEBUG",\n\
    "-Wno-error=stringop-truncation",\n\
    "-Wno-error=restrict",\n\
    "-includexr_config.h",\n\
    "-includecommon/prj_conf_opt.h",\n\
    "-DCONFIG_CHIP_ARCH_VER=3",\n\
    "-DCONFIG_ARCH_APP_CORE",\n\
    "-DCONFIG_CPU_CM33F",\n\
]\n\n')
 PROJECT = [x for i,x in enumerate(DATA) if x.find('CONFIG_PROJECT=') != -1]
 if len(PROJECT) == 1:
    ProjectPath = PROJECT[0]
    ProjectPath = ProjectPath.strip('CONFIG_PROJECT=')
 GNf.write('ProjectPath = {0}\n\n'.format(ProjectPath))
 if ProjectPath == '"bootloader"' or ProjectPath == '"test/etf"':
    GNf.write('declare_args() {IsBootloader = "true"}\n')
 else:
    GNf.write('declare_args() {IsBootloader = "false"}\n')
finally:
    file.close()

ok.png

最终SDKconfig.gni内容

#Build by config.py DO NOT EDIT!

SDK_cflags = [
    "-mcpu=cortex-m33",
    "-mtune=cortex-m33",
    "-march=armv8-m.main+dsp",
    "-mfpu=fpv5-sp-d16",
    "-mfloat-abi=softfp",
    "-mcmse",
    "-mthumb",
    "-c",
    "-g",
    "-fno-common",
    "-fmessage-length=0",
    "-fno-exceptions",
    "-ffunction-sections",
    "-fdata-sections",
    "-fomit-frame-pointer",
    "-Wall",
    #"-Werror",
    "-Wno-cpp",
    "-Wpointer-arith",
    "-Wno-error=unused-function",
    "-MMD",
    "-MP",
    "-Os",
    "-DNDEBUG",
    "-Wno-error=stringop-truncation",
    "-Wno-error=restrict",
    "-includexr_config.h",
    "-includecommon/prj_conf_opt.h",
    "-DCONFIG_CHIP_ARCH_VER=3",
    "-DCONFIG_ARCH_APP_CORE",
    "-DCONFIG_CPU_CM33F",
]

ProjectPath = "demo/wlan_ble_demo"

declare_args() {IsBootloader = "false"}

不确定生成是否对。。望告知。
搜索文件在哪

find /home/make/xr806_openharmony/ -name *.img

/home/make/xr806_openharmony/device/xradio/xr806/xr_skylark/project/demo/wlan_ble_demo/image/xr806/xr_system.img

/home/make/xr806_openharmony/device/xradio/xr806/xr_skylark/out/xr_system.img
推荐阅读
关注数
13821
内容数
140
全志XR806开发板相关的知识介绍以及应用专栏。
目录
极术微信服务号
关注极术微信号
实时接收点赞提醒和评论通知
安谋科技学堂公众号
关注安谋科技学堂
实时获取安谋科技及 Arm 教学资源
安谋科技招聘公众号
关注安谋科技招聘
实时获取安谋科技中国职位信息