Skip to content
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

Fix build issues when building for RP2040 from pico-examples/pico-sdk. #2151

Merged
merged 2 commits into from
Aug 7, 2023

Conversation

kilograham
Copy link
Collaborator

@kilograham kilograham commented Jul 18, 2023

  • include_guard requires GLOBAL as family.cmake is included in multiple non child places
  • the following recently rp2040 added check is sueprfluous (family_configure_host_example on rp2040 should do this already), and breaks if pico_pio_usb is not avaialble, so i have removed the rp2040 check
    family_configure_host_example(${PROJECT} noos)
    # Add pico-pio-usb for rp2040 since user can choose to run on bit-banging host
    if(FAMILY STREQUAL "rp2040")
        family_add_pico_pio_usb(${PROJECT})
    endif()
    
  • added new family_example_missing_dependency function to print missing dependency warning, so pico-examples can override it to be less in your face, and also more contextual to pico-examples
  • added TINYUSB_OPT_SKIP_CHECK_IPO_SUPPORTED var to skip the recently added IPO check which produces a bunch of warnings on RP2040

note: we really should set up an action to build pico-sdk/pico-examples periodically - either on pico- end, or tinyusb- end... there will be times when it is genuinely broken, but it would be nice to catch these breaks.

* include_guard requires GLOBAL as family.cmake is included in multiple non child places
* the following recently added check is suprfluous (family_configure_host_example for rp2040 should do this already),
  and breaks if pico_pio_usb is not avaialble, so i have removed
   # Add pico-pio-usb for rp2040 since user can choose to run on bit-banging host
   if(FAMILY STREQUAL "rp2040")
      family_add_pico_pio_usb(${PROJECT})
   endif()
* added new familt_example_missing_dependency functino to print missing dependency warning, so
  pico-examples can override it to be less in your face, and also more contextual to pico-examples
@hathach
Copy link
Owner

hathach commented Jul 18, 2023

oops, sorry, I am still getting used to cmake. Though you are right, I will try to include building a couple of usb examples from pico-examples into the ci as well.

if (IPO_SUPPORTED)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
endif ()
if (NOT TINYUSB_OPT_SKIP_CHECK_IPO_SUPPORTED)
Copy link
Owner

@hathach hathach Aug 2, 2023

Choose a reason for hiding this comment

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

yeah this is spot-on. Actualy I think we should skip this entirely for rp2040. LTO is global option, and it should only be set by top level application cmakelists.txt. It is ok for other ports since it only applies to examples within tinyusb. But I don't really want to force this on user application at all.

@hathach
Copy link
Owner

hathach commented Aug 2, 2023

hmm, I pushed some update to your branch, but look like github doesn't pick that up. Will try to close and re-open to force an update

PS: work like a charm :)

@hathach hathach closed this Aug 2, 2023
@hathach hathach reopened this Aug 2, 2023
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.

I skip the LTO option entirely for rp2040 since this should be decision by application top level cmake file. @kilograham let me know you are with the changes.

@hathach
Copy link
Owner

hathach commented Aug 4, 2023

update: and PR building pico-examples will be added soon (after this one). CI will only build 2 usb example in the pico-examples repo dev_hid_composite and host_cdc_msc_hid (currently disabled due to usb host api changes). let me know if this is sufficient enough.

- name: Build pico-examples
if: matrix.family == 'rp2040'
env:
PICO_SDK_PATH: ${{ github.workspace }}/pico-sdk
PICO_EXAMPLES_PATH: ${{ github.workspace }}/pico-examples
run: |
# symlink tinyusb to pico-sdk
rm -rf $PICO_SDK_PATH/lib/tinyusb
ln -s ${{ github.workspace }} $PICO_SDK_PATH/lib/
# change CMakelists.txt to only build selected examples
cd $PICO_EXAMPLES_PATH
sed -i -r 's/add_subdirectory/#add_subdirectory/g' CMakeLists.txt
echo "" >> CMakeLists.txt
echo "add_subdirectory(usb/device/dev_hid_composite)" >> CMakeLists.txt
# TODO temporarily disable host examples since tinyusb API is changed
# echo "add_subdirectory(usb/host/host_cdc_msc_hid)" >> CMakeLists.txt
cmake -S . -B _build -G Ninja -DFAMILY=rp2040 -DBOARD=pico_sdk
cmake --build _build

@kilograham
Copy link
Collaborator Author

LGTM - not sure if it is better to just have the job fail if there are any issues (e.g. the host API changing is a valid reason for failure), though we could add a second job for that - perhaps i'll add that on our end

@hathach
Copy link
Owner

hathach commented Aug 7, 2023

LGTM - not sure if it is better to just have the job fail if there are any issues (e.g. the host API changing is a valid reason for failure), though we could add a second job for that - perhaps i'll add that on our end

maybe you could update the pico-examples on dev branch, and we can use dev branch here. otheriwse a failed ci will prevent any merge on this repo. We could fix and enable it in follow up PR. Thank you.

@hathach hathach merged commit accc3fd into hathach:master Aug 7, 2023
40 of 41 checks passed
@hathach
Copy link
Owner

hathach commented Aug 7, 2023

PS: let me know if you need to set up an hook when there is pushed to tinyusb for running ci on pico-examples.

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.

2 participants