-
Notifications
You must be signed in to change notification settings - Fork 3k
STM32 USB update step 1 #11675
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
STM32 USB update step 1 #11675
Conversation
@jeromecoutant, thank you for your changes. |
@@ -1,6 +1,6 @@ | |||
""" | |||
* mbed Microcontroller Library | |||
* Copyright (c) 2006-2018 ARM Limited | |||
* Copyright (c) 2019 ARM Limited |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be 2006-2019, unless you are sure that none of this was developed in the years inbetween.
if "OTG" not in signal: | ||
usb_list.append([pin, name, signal]) | ||
if signal.startswith("USB_OTG_FS"): | ||
usb_otgfs_list.append([pin, name, signal]) | ||
if signal.startswith("USB_OTG_HS"): | ||
usb_otghs_list.append([pin, name, signal]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be incorrect as it changes the behaviour for all signals that contain 'OTG' that do not match the special case. Whilst there may be none of these today, this will fail to add the pin in future if the signal contains 'OTG'. Suggest an if..elif..elif...else construct could be better here.
If this is not the intent then there should be a big comment explaining why. Ideally there should be a comment to explain what this new code is trying to do in any case.
use_hs_in_fs = False | ||
nb_loop = 1 | ||
inst = "USB_FS" | ||
if lst == usb_otgfs_list: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a list element comparison - use 'is' instead. However, the pattern of accessing a global variable from inside the function in this way makes the code harder to understand, harder to maintain and harder to test.
inst = "USB_FS" | ||
if lst == usb_otgfs_list: | ||
inst = "USB_FS" | ||
elif lst == usb_otghs_list: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here.
s1 += "\n" | ||
out_c_file.write(s1) | ||
if lst: | ||
if lst == usb_otghs_list: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
8408fa8
to
83536ee
Compare
Rebased after @mark-edgeworth comments |
Note, there is a conflict now. |
83536ee
to
f0d4a1b
Compare
Conflict solved |
CI started |
Test run: FAILEDSummary: 1 of 4 test jobs failed Failed test jobs:
|
The errors look related , please review |
Removed unsupported MBED2 features: - USB_STM_HAL - USBHOST_OTHER
No more need to explicitly configure each targets. Pins are now defined in the PeripheralPin.c file which is build by a script.
f0d4a1b
to
dab09f3
Compare
Error corrected. |
CI restarted |
Test run: SUCCESSSummary: 12 of 12 test jobs passed |
Hi @jeromecoutant, |
Description
Hi
Goal is to make USB Device integration easy for each STM32 targets.
Step 1 (this PR):
even if USB_DEVICE feature is not supported yet
even is the board doesn't have any connector
This fixes How to configure USB pins for custom target based on STM32F746? #10806
Only addition of USB_DEVICE in the local mbed_app.json file is necessary
This fixes Above array bounds access warning in ST USB implementation #10822
So targets, which was supporting USB, still supports USB (no removed target, no target added)
Next step (other PR coming soon):
@bulislaw @MarceloSalazar @LMESTM
Pull request type
Reviewers
Release Notes