dmitrystu / libusb_stm32

Lightweight USB device Stack for STM32 microcontrollers
Apache License 2.0
713 stars 163 forks source link

Add support for STM32F105 and STM32F107 #25

Closed FabianInostroza closed 6 years ago

dmitrystu commented 6 years ago

Thank you for your contribution. PR will be added after some review. But i think it's a bad idea to add target for dfu-util to the library's makefile even for demo-code. Also lot of STM32 MCU's doesn't supports USB in built-in bootloader.

kisielk commented 6 years ago

Given that it's a USB library, I think it's fair.. off the top of my head I can only think of some of the lower functionality L0/F0x1 series that don't support USB DFU

FabianInostroza commented 6 years ago

I don't have a strong opinion about the dfu-util, at least it isn't replacing the default method of programming and it's an option for people with mcu supporting the embedded USB DFU.

Also I shouldn't have commited that change since it's unrelated to the usb library support.

Let me know if you want that addition removed.

dmitrystu commented 6 years ago

Well. I accept your point about DFU. As i see the new file src/usbd_stm32f105_otgfs.c is the sameas the src/usbd_stm32f429_otgfs. So in this case it's unwanted to make a copy, you just need to update usb.h.


#elif defined(STM32F405xx) || defined(STM32F415xx) || \
      defined(STM32F407xx) || defined(STM32F417xx) || \
      defined(STM32F427xx) || defined(STM32F437xx) || \
      defined(STM32F429xx) || defined(STM32F439xx) || \
      defined(STM32F105xC) || defined(STM32F107xC)

    #define USBD_STM32F429

    #if !defined(__ASSEMBLER__)
    extern const struct usbd_driver usbd_otgfs;
    #define usbd_hw usbd_otgfs
    #endif
FabianInostroza commented 6 years ago

It's almost the same, are you OK if I add some ifdef to that file? What about the file name? What about the changes to the other files?

dmitrystu commented 6 years ago

Sorry. It was a my mistake. There is a differences at least in RCC. So i'll do a review at the weekend to avoid stupid mistakes.

dmitrystu commented 6 years ago

Commited.

FabianInostroza commented 6 years ago

Thank you.

You finally decided to keep the driver in a separate file? A did a later commit where the f429 driver was modified to support the f105.

dmitrystu commented 6 years ago

Yes. F429 and F105 has a bit different USB_OTG machines. It was my mistake to ask you to join them.