cx_bEXqny · 2022年01月16日

xr806代码量太大导致编译失败的解决方法

我使用的系统是OpenHarmony-v1.1.2-LTS,device和vendor仓是最近更新的(2022/1/14)。
我移植好最新的固件之后,发现只有hollowword例程可以编译成功,其余的稍微大一点的代码都编译报错(例如wlan_demo):

[OHOS ERROR] /opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-objcopy -O binary -R .xip   audio_demo.elf audio_demo.bin
[OHOS ERROR] /opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-size audio_demo.elf
[OHOS ERROR]    text       data     bss     dec     hex filename
[OHOS ERROR] 1155588       8032   76280 1239900  12eb5c audio_demo.elf
[OHOS ERROR] /opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-objcopy -O binary -j .xip audio_demo.elf audio_demo_xip.bin
[OHOS ERROR] cp audio_demo_xip.bin ../image/"xr806"/app_xip.bin
[OHOS ERROR] cd ../image/"xr806" && \
[OHOS ERROR] chmod a+r *.bin && \
[OHOS ERROR] /opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc -E -P -CC -DCONFIG_CHIP_ARCH_VER=3 -DCONFIG_ARCH_APP_CORE -DCONFIG_CPU_CM33F -DPRJ_XIP_SIZE=8M -DPRJ_BOOT_CERT="\"null\"" -DPRJ_IMAGE_BOOT_ATTR="\"0x1\"" -DPRJ_IMAGE_APP_SRAM_OFFS="\"0x00201000\"" -DPRJ_IMAGE_APP_EP="\"0x00201101\"" -DPRJ_IMAGE_BOOT_SRAM_OFFS="\"0x00230000\"" -DPRJ_IMAGE_BOOT_EP="\"0x00230101\"" -DPRJ_IMAGE_TZ_ATTR="\"0x25\"" -DPRJ_IMAGE_TZ_XIP_ATTR="\"0x26\"" -DPRJ_IMAGE_TZ_PSRAM_ATTR="\"0x25\"" -DPRJ_APP_BIN_CERT="\"null\"" -DPRJ_APP_XIP_BIN_CERT="\"null\"" -DPRJ_APP_PSRAM_BIN_CERT="\"null\"" -DPRJ_IMAGE_APP_ATTR="\"0x1\"" -DPRJ_IMAGE_APP_XIP_ATTR="\"0x2\"" -DPRJ_IMAGE_APP_PSRAM_ATTR="\"0x1\"" -DCONFIG_RAM_START=0x00201000 -DPRJ_RAM_SIZE=300K -DPRJ_PSRAM_START_OFFS="\"0x01400000\"" -DCONFIG_PSRAM_START=0x01400000 -DPRJ_PSRAM_SIZE=0K -DPRJ_IMAGE_BOOT_BIN="\"boot_"40"M.bin\"" -DPRJ_IMAGE_SYS_SDD_BIN="\"sys_sdd_"40"M.bin\""  -I../../../../../include/generated -include autoconf.h -o .image.cfg - < image.cfg && \
[OHOS ERROR] true && \
[OHOS ERROR] chmod 777 ../../../../../tools/mkimage && ../../../../../tools/mkimage  -c .image.cfg -o xr_system.img
[OHOS ERROR] err: bin 1 and bin 2 were overlaped!
[OHOS ERROR] Overlapped size: 4096 Byte(4kB)
[OHOS ERROR] bin 1 name:app.bin    begin: 0x00008000    end: 0x00018C00
[OHOS ERROR] bin 2 name:app_xip.bin    begin: 0x00017C00
[OHOS ERROR]
[OHOS ERROR] We've rearranged bin files and generated new cfg file 'image_auto_cal.cfg', the new one is recommended.
[OHOS ERROR] Generate image file failed
[OHOS ERROR] cfg string:
[OHOS ERROR] /*
[OHOS ERROR]  *
[OHOS ERROR]  * Automatically generated file; DO NOT EDIT.
[OHOS ERROR]  * XR806 SDK Configuration
[OHOS ERROR]  *
[OHOS ERROR]  */
[OHOS ERROR] {
[OHOS ERROR]     "magic" : "AWIH",
[OHOS ERROR]     "version" : "0.5",
[OHOS ERROR]     "image" : {"max_size": "1532K"},
[OHOS ERROR]     "section" :[
[OHOS ERROR]   {"id": "0xa5ff5a00", "bin" :"boot_40M.bin", "cert": "null", "flash_offs": "0K", "sram_offs": "0x00230000", "ep": "0x00230101", "attr":"0x1"},
[OHOS ERROR]   {"id": "0xa5fe5a01", "bin" :"app.bin", "cert": "null", "flash_offs": "32K", "sram_offs": "0x00201000", "ep": "0x00201101", "attr":"0x1"},
[OHOS ERROR]   {"id": "0xa5fd5a02", "bin" :"app_xip.bin", "cert": "null", "flash_offs": "95K", "sram_offs": "0xffffffff", "ep": "0xffffffff", "attr":"0x2"},
[OHOS ERROR]   {"id": "0xa5fa5a05", "bin" :"wlan_bl.bin", "cert": "null", "flash_offs": "1166K", "sram_offs": "0xffffffff", "ep": "0xffffffff", "attr":"0x1"},
[OHOS ERROR]   {"id": "0xa5f95a06", "bin" :"wlan_fw.bin", "cert": "null", "flash_offs": "1169K", "sram_offs": "0xffffffff", "ep": "0xffffffff", "attr":"0x1"},
[OHOS ERROR]   {"id": "0xa5f85a07", "bin" :"sys_sdd_40M.bin", "cert": "null", "flash_offs": "1194K", "sram_offs": "0xffffffff", "ep": "0xffffffff", "attr":"0x1"},
[OHOS ERROR]   {}
[OHOS ERROR]  ]
[OHOS ERROR] }
[OHOS ERROR]
[OHOS ERROR] ../../../../project/project.mk:519: recipe for target 'image' failed
[OHOS ERROR] make[2]: *** [image] Error 255
[OHOS ERROR] make[2]: Leaving directory '/home/qq1253176313/ubuntu_share/samba/openharmony/device/xradio/xr806/xr_skylark/project/demo/audio_demo/gcc'
[OHOS ERROR] ../../../../project/project.mk:493: recipe for target '__build' failed
[OHOS ERROR] make[1]: *** [__build] Error 2
[OHOS ERROR] make[1]: Leaving directory '/home/qq1253176313/ubuntu_share/samba/openharmony/device/xradio/xr806/xr_skylark/project/demo/audio_demo/gcc'
[OHOS ERROR] Makefile:164: recipe for target 'build' failed
[OHOS ERROR] make: *** [build] Error 2
[OHOS ERROR] you can check build log in /home/qq1253176313/ubuntu_share/samba/openharmony/out/xr806/wifi_skylark/build.log
[OHOS ERROR] command: "/home/qq1253176313/ubuntu_share/samba/openharmony/prebuilts/build-tools/linux-x86/bin/ninja -w dupbuild=warn -C /home/qq1253176313/ubuntu_share/samba/openharmony/out/xr806/wifi_skylark" failed
[OHOS ERROR] return code: 1
[OHOS ERROR] execution path: /home/qq1253176313/ubuntu_share/samba/openharmony

发现错误提示里面全是一些关于代码段长度的信息。后来经过调试后发现,只要将控制台移除编译,就可以节省很多代码空间,从而成功通过编译。

只需要将device\xradio\xr806\BUILD.gn文件中44行的"adapter/console:app_console"注释掉就可以将控制台移除编译。

if (IsBootloader == "false") {
    deps += [
      "adapter/hals:adapter",
      #"adapter/console:app_console",
      "ohosdemo:ohosdemo"
    ]
  }
推荐阅读
关注数
13823
内容数
139
全志XR806开发板相关的知识介绍以及应用专栏。
目录
极术微信服务号
关注极术微信号
实时接收点赞提醒和评论通知
安谋科技学堂公众号
关注安谋科技学堂
实时获取安谋科技及 Arm 教学资源
安谋科技招聘公众号
关注安谋科技招聘
实时获取安谋科技中国职位信息