原版修复 目前能用了。
#!/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 后出错 如图
解决方法在
/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()
最终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