Search code examples
embeddedmicrocontrollerlibusblibusb-1.0

Can libusb be ported onto a microcontroller?


I am looking forward to implement some file operations on a USB device which will be plugged into a microcontroller-based bench-top device. The device does not have any OS/RTOS and only runs on a firmware code that I plan to develop. The firmware will have all the necessary functionalities (UART, timer, SPI, I2C, external memory controller etc) that an embedded device usually has.

My questions are:

  1. Can the libusb library be incorporated into the firmware that I plan to develop?
  2. Does the libusb work in non-operating system based environment? Or will I have to choose an OS that I can port onto the microcontroller and then use the libusb library in user space?

Solution

  • libusb is currently only supported on Linux, OS X, Windows, Windows CE, Android, and OpenBSD/NetBSD. So yes, it does require an underlying OS. Unless your microcontroller is an ARM that can run Linux, it would not be possible to run libusb without porting the low-level code to your microcontroller hardware and making it work without an OS which would be a huge amount of work.

    If you have a microcontroller with USB capability, it is very likely the manufacturer already has a library to access the USB functionality, and/or there are third-party libraries available.