Skip to content

Check that we can compute the value of USB_DEVICES #3037

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 8 commits into from
Jun 24, 2020

Conversation

jepler
Copy link

@jepler jepler commented Jun 16, 2020

Rather than requiring that USB_DEVICES be changed when CIRCUITPY_USB_HID and CIRCUITPY_USB_MIDI are changed.

If this passes the CI, then it will be okay to accept a different PR which actually uses the computed value. However, this PR is only being prepared so that the CI can check the intermediate state in which USB_DEVICES_COMPUTED is checked against USB_DEVICES.

jepler added 3 commits June 15, 2020 15:22
These are already disabled via the USB_DEVICES setting, but the code is
included anyway.
@jerryneedell
Copy link
Collaborator

jerryneedell commented Jun 16, 2020

ah -- I was puzzled by why the pewpew10 build worked as it is currently written - it does not set USB_DEVICES.. ii turns out, it does not! I just built it for the current main and it does not boot to a CIRCUITPY drive -- similar to what I saw on the m0_rfm9x
I guess it has not been tested...

adding USB_DEVICES="CDC,MSC,HID" restores it to normal operation

@jepler
Copy link
Author

jepler commented Jun 16, 2020

@tannewt I think that for the cases that are failing here, what we actually want to do is bring the CIRCUITPY_USB_yyy macros in line with the USB_DEVICES, rather than the other way around; they seem to be situations where some element of USB is disabled to cope with a board-specific limitation, whether it's memory or USB endpoints available.

The failed doc build pointed the way to quick checking for all ports locally.

ports/atmel-samd - 8086_commander: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC,HID"'.  Stop.
ports/atmel-samd - winterbloom_big_honking_button: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO"' different than hard-coded USB devices '"CDC,MSC"'.  Stop.
ports/atmel-samd - xinabox_cs11: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,HID"' different than hard-coded USB devices '"CDC,MSC,AUDIO,HID"'.  Stop.
ports/atmel-samd - pewpew10: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,HID"' different than hard-coded USB devices '"CDC,MSC,AUDIO,HID"'.  Stop.
ports/atmel-samd - ugame10: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC"' different than hard-coded USB devices '"CDC,MSC,AUDIO,HID"'.  Stop.
ports/esp32s2 - espressif_saola_1_wrover: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC,HID"'.  Stop.
ports/esp32s2 - espressif_saola_1_wroom: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC,HID"'.  Stop.
ports/mimxrt10xx - feather_m7_1011: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC,HID"'.  Stop.
ports/mimxrt10xx - imxrt1010_evk: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC,HID"'.  Stop.
ports/mimxrt10xx - feather_mimxrt1062: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC,HID"'.  Stop.
ports/mimxrt10xx - feather_mimxrt1011: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC,HID"'.  Stop.
ports/mimxrt10xx - teensy40: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC,HID"'.  Stop.
ports/mimxrt10xx - imxrt1060_evk: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC,HID"'.  Stop.
ports/mimxrt10xx - imxrt1020_evk: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC,HID"'.  Stop.
ports/mimxrt10xx - teensy41: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC,HID"'.  Stop.
ports/stm - stm32f412zg_discovery: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC,HID"'.  Stop.
ports/stm - thunderpack: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC"'.  Stop.
ports/stm - espruino_wifi: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC"'.  Stop.
ports/stm - pyboard_v11: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC"'.  Stop.
ports/stm - feather_stm32f405_express: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC"'.  Stop.
ports/stm - stm32f411ve_discovery: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC"'.  Stop.
ports/stm - nucleo_h743zi_2: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC"'.  Stop.
ports/stm - stm32f4_discovery: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC"'.  Stop.
ports/stm - stm32f746g_discovery: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC"'.  Stop.
ports/stm - espruino_pico: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC"'.  Stop.
ports/stm - pyb_nano_v2: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC"'.  Stop.
ports/stm - stm32f411ce_blackpill: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC"'.  Stop.
ports/stm - openmv_h7: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC"'.  Stop.
ports/stm - meowbit_v121: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC"'.  Stop.
ports/stm - nucleo_f767zi: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC"'.  Stop.
ports/stm - nucleo_f746zg: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO,HID"' different than hard-coded USB devices '"CDC,MSC"'.  Stop.
import os
import subprocess

SUPPORTED_PORTS = ['atmel-samd', 'esp32s2', 'litex', 'mimxrt10xx', 'nrf', 'stm']

def check_makefile(port_dir, board_name):
    """ Invoke make in a mode which prints the database, then parse it for
        settings.

        This means that the effect of all Makefile directives is taken
        into account, without having to re-encode the logic that sets them
        in this script, something that has proved error-prone
    """
    contents = subprocess.run(
            ["make", "-C", port_dir, f"BOARD={board_name}", "-qp", "print-CC"],
            encoding="utf-8",
            errors="replace",
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE
        )
    # Make signals errors with exit status 2; 0 and 1 are "non-error" statuses
    if contents.returncode not in (0, 1):
        print(f"{port_dir} - {board_name}: {contents.stderr.strip()}")

for port in SUPPORTED_PORTS:

    port_dir = "ports/{}/boards".format(port)
    for entry in os.scandir(port_dir):
        if not entry.is_dir():
            continue

        check_makefile(f'ports/{port}', entry.name)

@tannewt
Copy link
Member

tannewt commented Jun 16, 2020

This is probably a newer issue because I "fixed" the CIRCUITPY_ directives to remove TinyUSB code here: dcb0e50

@tannewt
Copy link
Member

tannewt commented Jun 16, 2020

@jepler Yes, for cases where the compute is a superset, we should disable the corresponding CIRCUITPY define. That will free up code space.

jepler added 5 commits June 23, 2020 10:56
.. it was not in the USB descriptors anyway (lack of enough endpoints?)
.. it was not in the USB descriptors anyway (lack of enough endpoints?)
.. it was not in the USB descriptors anyway (lack of enough endpoints?)
This makes them all overridable on the board level, tersely
@jepler jepler merged commit 93d3629 into adafruit:main Jun 24, 2020
@jepler jepler deleted the check-usb-devices branch November 3, 2021 21:09
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.

3 participants