Skip to content

Update dwc2_stm32.h #1438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 1, 2022
Merged

Update dwc2_stm32.h #1438

merged 3 commits into from
Jun 1, 2022

Conversation

Nikitarc
Copy link

@Nikitarc Nikitarc commented Apr 19, 2022

Support STM32H7 with only 1 USB port: H72x / H73x / H7Ax / H7Bx
Avoid GCC compiler warnings when -pedantic option is used (strict ISO C)

Describe the PR
The STM32H7 family have 2 sub families:

  • H74x and H75x have 2 USB, and USB2 have an internal FS PHY. No problem with this sub family.
  • H72x, H73x, H7Ax, H7Bx have only 1 USB named USB1 with an internal FS PHY (this USB1 is equivalent to the USB2 of the other sub family). And in the CMSIS files of this sub family the values USB_OTG_FS_PERIPH_BASE and OTG_FS_IRQn are not declared, so the file synopsys/dwc2/dwc2_stm32.h produce compile errors.

Add to tusb_options.h
typedef int make_iso_compilers_happy ;

Additional context
Successfully tested on NUCLEO-H723ZG (1 USB) and NUCLEO-H743ZI (2 USB).
fixes #1431

Support STM32H7 with only 1 USB port: H72x / H73x / H7Ax / H7Bx
Copy link
Owner

@hathach hathach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing #endif

// H7 with only 1 USB port: H72x / H73x / H7Ax / H7Bx
// USB_OTG_FS_PERIPH_BASE and OTG_FS_IRQn not defined
#define USB_OTG_FS_PERIPH_BASE USB1_OTG_HS_PERIPH_BASE
#define OTG_FS_IRQn OTG_HS_IRQn
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like you miss an #endif, please make sure you compile the example and verify the changes works

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry this is my first PR, and I got confused.
I'm sure it works now.

Nikitarc added 2 commits April 20, 2022 11:29
Add missing #endif
Makes ISO compiler happy
@Nikitarc
Copy link
Author

These warning:

..\TinyUSB\src\class\msc\msc_host.c:499: warning: ISO C forbids an empty translation unit [-Wpedantic]

Copy link
Owner

@hathach hathach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for your PR. Sorry for the late response.

@hathach hathach merged commit 9352f75 into hathach:master Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support of STM32H7xx with only 1 USB
3 participants