2

我正在尝试将 DFU 支持添加到我在项目中使用的 u-boot,因为我发现其中未启用 DFU 支持。

我正在使用飞思卡尔 u-boot(从gi​​t://git.freescale.com/imx/uboot-imx.git克隆),我检查了标签“ rel_imx_4.1.15_1.1.0_ga ”,这是我的m 需要继续工作。

问题是通过 u-boot 文档我可以看到必须启用 DFU。我将以下内容添加到我的 .h 文件中

#define CONFIG_USB_FUNCTION_DFU
#define CONFIG_CMD_DFU
#define CONFIG_DFU_MMC
#define CONFIG_SYS_DFU_DATA_BUF_SIZE SZ_16M
#define DFU_DEFAULT_POLL_TIMEOUT 300

但我收到以下错误:

common/built-in.o: In function `do_dfu':
/home/m4l490n/uboot-imx/common/cmd_dfu.c:29: undefined reference to `dfu_init_env_entities'
/home/m4l490n/uboot-imx/common/cmd_dfu.c:35: undefined reference to `dfu_show_entities'
/home/m4l490n/uboot-imx/common/cmd_dfu.c:41: undefined reference to `g_dnl_clear_detach'
/home/m4l490n/uboot-imx/common/cmd_dfu.c:42: undefined reference to `g_dnl_register'
/home/m4l490n/uboot-imx/common/cmd_dfu.c:44: undefined reference to `g_dnl_detach'
/home/m4l490n/uboot-imx/common/cmd_dfu.c:50: undefined reference to `dfu_usb_get_reset'
/home/m4l490n/uboot-imx/common/cmd_dfu.c:67: undefined reference to `usb_gadget_handle_interrupts'
/home/m4l490n/uboot-imx/common/cmd_dfu.c:70: undefined reference to `g_dnl_unregister'
/home/m4l490n/uboot-imx/common/cmd_dfu.c:72: undefined reference to `dfu_free_entities'
/home/m4l490n/uboot-imx/common/cmd_dfu.c:77: undefined reference to `g_dnl_clear_detach'
arm-linux-gnueabihf-ld.bfd: BFD (GNU Binutils for Ubuntu) 2.24 assertion fail ../../bfd/elf32-arm.c:7696
arm-linux-gnueabihf-ld.bfd: BFD (GNU Binutils for Ubuntu) 2.24 assertion fail ../../bfd/elf32-arm.c:7696
arm-linux-gnueabihf-ld.bfd: BFD (GNU Binutils for Ubuntu) 2.24 assertion fail ../../bfd/elf32-arm.c:7696
arm-linux-gnueabihf-ld.bfd: BFD (GNU Binutils for Ubuntu) 2.24 assertion fail ../../bfd/elf32-arm.c:7696
arm-linux-gnueabihf-ld.bfd: BFD (GNU Binutils for Ubuntu) 2.24 assertion fail ../../bfd/elf32-arm.c:7696
arm-linux-gnueabihf-ld.bfd: BFD (GNU Binutils for Ubuntu) 2.24 assertion fail ../../bfd/elf32-arm.c:7696
arm-linux-gnueabihf-ld.bfd: BFD (GNU Binutils for Ubuntu) 2.24 assertion fail ../../bfd/elf32-arm.c:7696
arm-linux-gnueabihf-ld.bfd: BFD (GNU Binutils for Ubuntu) 2.24 assertion fail ../../bfd/elf32-arm.c:7696
arm-linux-gnueabihf-ld.bfd: BFD (GNU Binutils for Ubuntu) 2.24 assertion fail ../../bfd/elf32-arm.c:7696
arm-linux-gnueabihf-ld.bfd: error: required section '.rel.plt' not found in the linker script
arm-linux-gnueabihf-ld.bfd: final link failed: Invalid operation
make: *** [u-boot] Error 1

我注意到如果我从 .h 文件中删除#define CONFIG_CMD_DFU它编译得很好但是如果我在 u-boot shell 中输入=> dfu它会说:

Unknown command 'dfu' - try 'help'

所以问题是*你知道我还需要添加什么来在我正在使用的 u-boot 中启用 DFU 吗?

谢谢!!

4

1 回答 1

1
  1. 要修复这些链接错误:

    未定义的引用dfu_*

    启用 DFU USB 类的 USB 部分:

    #define CONFIG_DFU_FUNCTION
    
  2. 要修复此链接错误:

    未定义的引用usb_gadget_handle_interrupts

    启用您的 UDC 控制器(我很确定您的平台有 ChipIdea UDC 控制器),并启用 USB 小工具:

    #define CONFIG_CI_UDC
    #define CONFIG_USBD_HS
    
    #define CONFIG_USB_GADGET
    #define CONFIG_USB_GADGET_DUALSPEED
    #define CONFIG_USB_GADGET_VBUS_DRAW 2
    
  3. 要修复这些链接错误:

    未定义的引用g_dnl_*

    启用和配置 USB 下载小工具:

    #define CONFIG_USBDOWNLOAD_GADGET
    #define CONFIG_G_DNL_VENDOR_NUM     0x18d1
    #define CONFIG_G_DNL_PRODUCT_NUM    0x0d02
    #define CONFIG_G_DNL_MANUFACTURER   "FSL"
    

现在您应该能够成功构建 U-Boot。测试configs/mx7dsabresd_defconfig(更改为include/configs/mx7dsabresd.h)。下载小工具 (G_DNL) 的配置值取自include/configs/mx7dsabresdandroid.h.

基本上,链接问题可以通过下一个方式解决。要找出缺少的定义,您可以查看缺少的功能在哪里实现,然后查找在Makefile哪里启用了相应的源文件进行构建,并从中Makefile找出要定义的选项,以便构建相应的目标文件并想要的功能在链接阶段就位。

于 2016-07-07T23:42:26.210 回答