Skip to content

error: static assertion failed: CFG_TUSB_RHPORT0_MODE/CFG_TUSB_RHPORT1_MODE must be defined on RP2040 since specific update #474

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

Open
doctea opened this issue Nov 19, 2024 · 7 comments
Labels
Bug Something isn't working

Comments

@doctea
Copy link

doctea commented Nov 19, 2024

Operating System

Windows 11

Arduino IDE version

VSCode+Platformio

Board

RP2040

ArduinoCore version

n/a

TinyUSB Library version

f13b57a

Sketch as ATTACHED TXT

n/a

Compiled Log as ATTACHED TXT

In file included from C:\Users\doctea\.platformio\packages\framework-arduinopico\libraries\FreeRTOS\src\variantHooks.cpp:37:
C:\Users\doctea\.platformio\packages\framework-arduinopico\libraries\FreeRTOS\src\variantHooks.cpp: In function 'void __usb(void*)':
.pio\libdeps\pcb\Adafruit TinyUSB Library\src/tusb.h:146:53: error: static assertion failed: CFG_TUSB_RHPORT0_MODE/CFG_TUSB_RHPORT1_MODE must be defined
  146 |   #define _tusb_init_arg0()        TU_VERIFY_STATIC(false, "CFG_TUSB_RHPORT0_MODE/CFG_TUSB_RHPORT1_MODE must be defined")
      |                                                     ^~~~~
.pio\libdeps\pcb\Adafruit TinyUSB Library\src/common/tusb_compiler.h:39:31: note: in expansion of macro '_tusb_init_arg0'
   39 | #define TU_STRCAT(a, b)       a##b                ///< concat without expand
      |                               ^
.pio\libdeps\pcb\Adafruit TinyUSB Library\src/common/tusb_compiler.h:42:31: note: in expansion of macro 'TU_STRCAT'
   42 | #define TU_XSTRCAT(a, b)      TU_STRCAT(a, b)     ///< expand then concat
      |                               ^~~~~~~~~
.pio\libdeps\pcb\Adafruit TinyUSB Library\src/common/tusb_compiler.h:127:43: note: in expansion of macro 'TU_XSTRCAT'
  127 | #define TU_FUNC_OPTIONAL_ARG(func, ...)   TU_XSTRCAT(func##_arg, TU_ARGS_NUM(__VA_ARGS__))(__VA_ARGS__)
      |                                           ^~~~~~~~~~
.pio\libdeps\pcb\Adafruit TinyUSB Library\src/tusb.h:151:46: note: in expansion of macro 'TU_FUNC_OPTIONAL_ARG'
  151 | #define tusb_init(...)                       TU_FUNC_OPTIONAL_ARG(_tusb_init, __VA_ARGS__)
      |                                              ^~~~~~~~~~~~~~~~~~~~
C:\Users\doctea\.platformio\packages\framework-arduinopico\libraries\FreeRTOS\src\variantHooks.cpp:468:5: note: in expansion of macro 'tusb_init'
  468 |     tusb_init();
      |     ^~~~~~~~~

What happened ?

Updated to newer version of TinyUSB on my RP2040 project, compile fails with the output below. I've done a git bisect and found that f13b57a01aaed4fe51b3000cb3ce89ad8c8c83dc is the first bad commit. Hope this helps someone!

How to reproduce ?

Compile on RP2040 with any version of TinyUSB after commit f13b57a.

Debug Log

No response

Screenshots

No response

@doctea doctea added the Bug Something isn't working label Nov 19, 2024
@hathach
Copy link
Member

hathach commented Nov 20, 2024

what is the arduino core version ?

@doctea
Copy link
Author

doctea commented Nov 20, 2024

what is the arduino core version ?

I'll check precise version and get back to you. I believe it should be the latest version of the earlephilhower arduino-pico core, though.

@doctea
Copy link
Author

doctea commented Nov 21, 2024

My platformio.ini says platform = https://github.com/maxgerhardt/platform-raspberrypi and board_build.core = earlephilhower and it was installed on the 20th November -- is that all you need to know?

@mztulip
Copy link

mztulip commented Jan 28, 2025

I have the same problem. Solutions for me is to add definition which is requested. My code with usb device works. I hope that this solution helps, because I spend a lot of time trying to understand what happens and solve it.
Here is my platformio.ini with added CFG_TUSB_RHPORT0_MODE define:

[env]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
framework = arduino
board_build.core = earlephilhower
build_flags = -DUSE_TINYUSB -DCFG_TUSB_RHPORT0_MODE

[env:pico]
board = pico

@hathach
Copy link
Member

hathach commented Feb 6, 2025

My platformio.ini says platform = https://github.com/maxgerhardt/platform-raspberrypi and board_build.core = earlephilhower and it was installed on the 20th November -- is that all you need to know?

please specify the core release version of arduino-pico https://github.com/earlephilhower/arduino-pico/releases

@mztulip
Copy link

mztulip commented Feb 9, 2025

My core version is 4.4.1, but I am not sure how to check it.
This is my build log:
PLATFORM: Raspberry Pi RP2040 (1.15.0+sha.39b9039) > Raspberry Pi Pico
HARDWARE: RP2040 133MHz, 256KB RAM, 2MB Flash
DEBUG: Current (blackmagic) External (blackmagic, cmsis-dap, jlink, pico-debug, picoprobe, raspberrypi-swd)
PACKAGES:

  • framework-arduinopico @ 1.40300.0+sha.e16c459
  • tool-picotool-rp2040-earlephilhower @ 5.140200.240929 (14.2.0)
  • toolchain-rp2040-earlephilhower @ 5.140200.240929 (14.2.0)

And log from pio pkg:

pio pkg outdated
Checking  [####################################]  100%          

Semantic Versioning color legend:
<Major Update>  backward-incompatible updates
<Minor Update>  backward-compatible features
<Patch Update>  backward-compatible bug fixes

Package      Current             Wanted    Latest              Type      Environments
-----------  ------------------  --------  ------------------  --------  --------------
raspberrypi  1.15.0+sha.39b9039            1.15.0+sha.76ecf3c  Platform  pico, rpipico2

 pio pkg list
Resolving pico dependencies...
Platform raspberrypi @ 1.15.0+sha.39b9039 (required: git+https://github.com/maxgerhardt/platform-raspberrypi.git)
├── framework-arduino-mbed @ 4.2.1 (required: platformio/framework-arduino-mbed @ ~4.2.1)
├── framework-arduinopico @ 1.40300.0+sha.e16c459 (required: git+https://github.com/earlephilhower/arduino-pico.git#e16c459598b86ce67d8b83ac5b1384dcb8c982ae)
├── tool-picotool-rp2040-earlephilhower @ 5.140200.240929 (required: https://github.com/earlephilhower/pico-quick-toolchain/releases/download/4.0.1/x86_64-linux-gnu.picotool-8a9af99.240929.tar.gz)
└── toolchain-rp2040-earlephilhower @ 5.140200.240929 (required: https://github.com/earlephilhower/pico-quick-toolchain/releases/download/4.0.1/x86_64-linux-gnu.arm-none-eabi-8ec9d6f.240929.tar.gz)

Libraries
└── Adafruit TinyUSB Library @ 3.4.1+sha.1f77496 (required: git+https://github.com/pschatzmann/Adafruit_TinyUSB_Arduino.git#Audio)

Resolving rpipico2 dependencies...
Platform raspberrypi @ 1.15.0+sha.39b9039 (required: git+https://github.com/maxgerhardt/platform-raspberrypi.git)
├── framework-arduino-mbed @ 4.2.1 (required: platformio/framework-arduino-mbed @ ~4.2.1)
├── framework-arduinopico @ 1.40300.0+sha.e16c459 (required: git+https://github.com/earlephilhower/arduino-pico.git#e16c459598b86ce67d8b83ac5b1384dcb8c982ae)
├── tool-picotool-rp2040-earlephilhower @ 5.140200.240929 (required: https://github.com/earlephilhower/pico-quick-toolchain/releases/download/4.0.1/x86_64-linux-gnu.picotool-8a9af99.240929.tar.gz)
└── toolchain-rp2040-earlephilhower @ 5.140200.240929 (required: https://github.com/earlephilhower/pico-quick-toolchain/releases/download/4.0.1/x86_64-linux-gnu.arm-none-eabi-8ec9d6f.240929.tar.gz)

Libraries
└── Adafruit TinyUSB Library @ 3.4.1+sha.1f77496 (required: git+https://github.com/pschatzmann/Adafruit_TinyUSB_Arduino.git#Audio)

It looks that I have version 1.4 not 4.4.1 as I thought.
When I execute commands:
; pio lib update ; pio run ; pio pkg list
It changes to following result:

Resolving pico dependencies...
Platform raspberrypi @ 1.15.0+sha.76ecf3c (required: git+https://github.com/maxgerhardt/platform-raspberrypi.git)
├── framework-arduino-mbed @ 4.2.1 (required: platformio/framework-arduino-mbed @ ~4.2.1)
├── framework-arduinopico @ 1.40402.0+sha.b506c01 (required: git+https://github.com/earlephilhower/arduino-pico.git#b506c010f7766cfb181c8da6db93cb8d554460f6)
├── tool-picotool-rp2040-earlephilhower @ 5.140200.240929 (required: https://github.com/earlephilhower/pico-quick-toolchain/releases/download/4.0.1/x86_64-linux-gnu.picotool-8a9af99.240929.tar.gz)
└── toolchain-rp2040-earlephilhower @ 5.140200.240929 (required: https://github.com/earlephilhower/pico-quick-toolchain/releases/download/4.0.1/x86_64-linux-gnu.arm-none-eabi-8ec9d6f.240929.tar.gz)

Libraries
└── Adafruit TinyUSB Library @ 3.4.1+sha.1f77496 (required: git+https://github.com/pschatzmann/Adafruit_TinyUSB_Arduino.git#Audio)

Resolving rpipico2 dependencies...
Platform raspberrypi @ 1.15.0+sha.76ecf3c (required: git+https://github.com/maxgerhardt/platform-raspberrypi.git)
├── framework-arduino-mbed @ 4.2.1 (required: platformio/framework-arduino-mbed @ ~4.2.1)
├── framework-arduinopico @ 1.40402.0+sha.b506c01 (required: git+https://github.com/earlephilhower/arduino-pico.git#b506c010f7766cfb181c8da6db93cb8d554460f6)
├── tool-picotool-rp2040-earlephilhower @ 5.140200.240929 (required: https://github.com/earlephilhower/pico-quick-toolchain/releases/download/4.0.1/x86_64-linux-gnu.picotool-8a9af99.240929.tar.gz)
└── toolchain-rp2040-earlephilhower @ 5.140200.240929 (required: https://github.com/earlephilhower/pico-quick-toolchain/releases/download/4.0.1/x86_64-linux-gnu.arm-none-eabi-8ec9d6f.240929.tar.gz)

Libraries
└── Adafruit TinyUSB Library @ 3.4.1+sha.1f77496 (required: git+https://github.com/pschatzmann/Adafruit_TinyUSB_Arduino.git#Audio)

It stays same 1.4, only git hash changes.

@hathach
Copy link
Member

hathach commented Feb 10, 2025

1.4 is too old, please update core version to latest and re-test. If you couldn't update the core, try to reduce the tinyusb lib to version that work with the old core.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants