2016-06-17 150 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中可以找出要定義的選項,以便相應的對象文件是建立並希望功能在連接階段就位。