2016-06-17 157 views
1

我试图添加DFU支持到我在项目中使用的u-boot,因为我想通过它没有启用DFU支持。如何添加DFU支持到u-boot?

我使用飞思卡尔的u-boot(从混帐克隆://git.freescale.com/imx/uboot-imx.git),我检查了标签“rel_imx_4.1.15_1.1.0_ga“这是我需要的工作。

问题是,通过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的壳进入=> DFU它说:

Unknown command 'dfu' - try 'help' 

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

谢谢!

回答

0
  1. 要解决这些链接错误:

    undefined reference to dfu_*

    使DFU USB类的USB部分:

    #define CONFIG_DFU_FUNCTION 
    
  2. 为了解决这个问题链接错误:

    undefined reference to 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. 要解决这些链接错误:

    undefined reference to 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中可以找出要定义的选项,以便相应的对象文件是建立并希望功能在连接阶段就位。