ahcbb6 / meta-raspberrypi-baremetal

Layer compatible with The Yocto Project/OpenEmbedded to build Baremetal applications for the Raspberry Pi Pico boards
MIT License
18 stars 1 forks source link

TinyUSB examples not being built #1

Open ahcbb6 opened 1 year ago

ahcbb6 commented 1 year ago

During configure, a warning is issued stating the TinyUSB examples wont be built, this due to the fact that the TinyUSB submodule module is not initialized/present (at the moment this is expected since we are using the git fetcher and not the git submodules fetcher which has problems with the pico-sdk repo.

CMake Warning attmp/work/cortexm0-plus-poky-eabi/pico-examples/1.0+gitAUTOINC+eca13acf57_6a7db34ff6-r0/pico-sdk/src/rp2_common/tinyusb/CMakeLists.txt:10 (message):
  TinyUSB submodule has not been initialized; USB support will be unavailable

  hint: try 'git submodule update --init' from your SDK directory
  (tmp/work/cortexm0-plus-poky-eabi/pico-examples/1.0+gitAUTOINC+eca13acf57_6a7db34ff6-r0/pico-sdk).

CMake Warning at hello_world/usb/CMakeLists.txt:19 (message):
  not building hello_usb because TinyUSB submodule is not initialized in the SDK

Skipping TinyUSB device examples as TinyUSB is unavailable
Skipping TinyUSB host examples as TinyUSB is unavailable
Skipping TinyUSB dual examples, as TinyUSB hw/mcu/raspberry_pi/Pico-PIO-USB submodule unavailable
ahcbb6 commented 1 year ago

The underlying issue here is that the gitsm:// fetcher recursed through the submodules of the pico-sdk repo, one of these is the tinyusb submodule, which itself has a submodule of the stm32u5xx_hal_driver, bitbake will try to fetch all submodules and then it checks if the sources were fetched properly using the function contains_ref() in the git.py fetcher: https://git.openembedded.org/bitbake/tree/lib/bb/fetch2/git.py#n640

 def _contains_ref(self, ud, d, name, wd):
        cmd = ""
        if ud.nobranch:
            cmd = "%s log --pretty=oneline -n 1 %s -- 2> /dev/null | wc -l" % (
                ud.basecmd, ud.revisions[name])
        else:
            cmd =  "%s branch --contains %s --list %s 2> /dev/null | wc -l" % (
                ud.basecmd, ud.revisions[name], ud.branches[name])

The issue here is that the pico-sdk repo checks out a certain commit from the tinyUSB repo that checks out a certain commit from the stm32u5xx_haldriver repo that is not found (even github complains: "This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository."_ https://github.com/STMicroelectronics/stm32u5xx_hal_driver/tree/2e1d4cdb386e33391cb261dfff4fefa92e4aa35a)

I can't exactly tell what happened in that repository, but when manually doing a bare clone of it, the commit that is required doesn't exist:

$ git log --pretty=oneline -n 1 2e1d4cd --
fatal: bad revision '2e1d4cd'

Since that command returns an error, bitbake will try to fetch the submodule again, check again, and fail again and so on and so on until an error is thrown out:

WARNING: pico-examples-1.0+gitAUTOINC+eca13acf57_6a7db34ff6-r0 do_fetch: Failed to fetch URL gitsm://github.com/raspberrypi/pico-sdk.git;protocol=https;branch=master;name=sdk;destsuffix=pico-sdk, attempting MIRRORS if available
ERROR: pico-examples-1.0+gitAUTOINC+eca13acf57_6a7db34ff6-r0 do_fetch: Fetcher failure for URL: 'gitsm://github.com/hathach/tinyusb.git;protocol=https;name=tinyusb;subpath=tinyusb;nobranch=1;bareclone=1;nobranch=1'. Unable to fetch URL from any source.
ERROR: pico-examples-1.0+gitAUTOINC+eca13acf57_6a7db34ff6-r0 do_fetch: Bitbake Fetcher Error: FetchError('Unable to fetch URL from any source.', 'gitsm://github.com/raspberrypi/pico-sdk.git;protocol=https;branch=master;name=sdk;destsuffix=pico-sdk')

There may be a couple of solutions to this, however none of them seem very appealing: