none
USB Device Firmware Update (DFU) Driver for WEC2013 RRS feed

  • Question

  • Hi,

    According to this thread, it is possible to use libusb and ceusbkwrapper to have direct access to a USB device. I am needing to do this because we need to be able to do a DFU for this microcontroller on our embedded device.

    I have successfully compiled ceusbkwrapper (which gives direct access to user space), but cannot compile the libusb project. Although it mentions that windows ce is supported, it looks like they were targeting wince 5.0. When trying to compile against WEC2013, it cannot find the header file setupapi.h.

    Has this been taken out of windows ce after 5.0? Also, is this the best way to go about getting a DFU driver setup for our needs? Or does WEC2013 have a better way of going about direct USB access from user space?

    Thanks for any insight

    Friday, August 25, 2017 11:19 PM

All replies

  • In case anyone else tries to build the libusb project, after I had inserted the wince_usb.c file in the build, I had forgotten to make sure the windows_usb.c file was taken out and not referenced. After that, replace the OS_WINDOWS macro with OS_WINCE in the config.h file and it will build after that. Also, take references out to windows_nt as well.
    Wednesday, August 30, 2017 7:05 PM
  • Hi, 

    I have compiled usblib-1.0.lib in VS2012 for ARM with WEC2013. But the Usblib-1.0.dll does not compile and the examples do not compile when detecting the following error in the usblib-1.0.lib:

    Error 39 error LNK2019: unresolved external symbol getenv referenced in function get_env_debug_level C:\libusb\libusb-master\msvc\libusb-1.0.lib(core.obj)

    In the project of the USBLIB-1.0(Static), I see that it has the following configuration:

    Configuration Propertis - Advanced 

    -  Calling Convention: __cdecl(/Gd)

    - Compile As: Default

    This configuration is correct for WEC2013?

    Thanks for any insight

    Wednesday, November 1, 2017 9:23 PM
  • There are no environment variables on Windows CE, so you will have to stub this function and return whatever makes sense for CE.

    Simply create a function in a library that implements getenv and link that to libusb. Something like this:

    char *getenv(const char *varname)
    {
        RETAILMSG(1, (L"getenv called with \"%S\"", varname));
        static char szReturn[MAX_PATH];
        szReturn[0] = 0;
        if (0 == _stricmp(varname, "%programfiles%"))
            strcpy_s(szReturn, _countof(szReturn), "\Program Files");
        RETAILMSG(1, (L"returning \"%S\"", szReturn));
        return szReturn;
    }
    

    Of course you'll need to figure out with what params this function is called by libusb and return meaningful values for your project.


    Good luck,

    Michel Verhagen, eMVP
    Check out my blog: https://guruce.com/blog

    GuruCE
    Microsoft Embedded Partner
    NXP Proven Partner
    https://guruce.com
    Consultancy, training and development services.

    Interested in WEC on i.MX6?
    Get the only 100% stable and best performing i.MX6 BSP for WEC7 and WEC2013 here: https://guruce.com/imx6

    Wednesday, November 1, 2017 11:03 PM
    Moderator
  • What version of usblib-1.0?

    I searched version 1.0.21 and can't find any instances of get_env_debug_level.  But I do find getenv both called - and implemented in missing.c which was written especially for Windows CE.

    I don't think that you are building it for Windows CE, I think that you are building it for Windows.  Both libusb_dll_wince.vcproj and libusb_static_wince.vcproj have missing.c - but those are eVC projects, so you will need to set up a Windows CE project to build in VS2012.


    Bruce Eitman
    Senior Engineer
    Bruce.Eitman AT Synopsys DOT com
    My BLOG http://geekswithblogs.net/bruceeitman
    I work for Synopsys

    Friday, November 3, 2017 3:55 AM
    Moderator