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

Add PlatformIO manifest #2293

Merged
merged 2 commits into from Nov 3, 2023
Merged

Add PlatformIO manifest #2293

merged 2 commits into from Nov 3, 2023

Conversation

Yveaux
Copy link
Contributor

@Yveaux Yveaux commented Oct 28, 2023

Allows easy usage of TinyUSB in PlatformIO (see https://platformio.org/).

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.

look good, please fix the missing end of file per ci recommendation.

@Yveaux
Copy link
Contributor Author

Yveaux commented Nov 2, 2023

Should be fixed. Thanks for the headsup!

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.

look good, thank you

@hathach hathach merged commit f3eaf06 into hathach:master Nov 3, 2023
2 checks passed
@nerdyscout
Copy link

hi @Yveaux
I am trying to setup TinyUSB with platformio in this project but get 'undefined references' and can not figure out why. maybe you could help?

@Yveaux
Copy link
Contributor Author

Yveaux commented Dec 3, 2023

Hey @nerdyscout,

You should include the TinyUSB library as an external library instead of including the files in your project.
The TinyUSB config file does need to be part of your project and CFG_TUSB_CONFIG_FILE must point at it; I placed it in include/tusb_config.h.

I use the TinyUSB library on an RPI Pico with Arduino, and the platformio.ini looks something like:

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

build_flags =
  -D DEBUG_PORT=Serial1
  -D DEBUG_BAUDRATE=115200
  -D DEBUG_RP2040_PORT=DEBUG_PORT
  -D PIO_FRAMEWORK_ARDUINO_NO_USB=1
  -D DISABLE_USB_SERIAL
  -D NO_USB
  -UUSE_TINYUSB
  ; TinyUSB settings
  -D CFG_TUSB_MCU=OPT_MCU_RP2040
  -D CFG_TUSB_OS=OPT_OS_PICO
  -D CFG_TUSB_RHPORT0_MODE=OPT_MODE_HOST
  -D CFG_TUSB_CONFIG_FILE=\"$PROJECT_DIR/include/tusb_config.h\"
  ; Log level: 1=Error, 2=Warning, 3=Info
  -D CFG_TUSB_DEBUG=2

lib_deps =
  https://github.com/hathach/tinyusb.git

Good luck!

@nerdyscout
Copy link

nerdyscout commented Feb 1, 2024

thank you @Yveaux !
I did add TinyUSB not as library as it should allow to use its hardware abstraction.
Using it as an external library now i run into exactly this issue bsp/* not been build as it is neither part of my project nor part of TinyUSB/src.

#include "bsp/board_api.h" // can not be found from within my project, therefor board_init() not available which means board is not set up. 
#include "tusb.h"

//------------- prototypes -------------//
static void cdc_task(void);

/*------------- MAIN -------------*/
int main(void)
{
  board_init();

  // init device stack on configured roothub port
  tud_init(BOARD_TUD_RHPORT);

  if (board_init_after_tusb) {
    board_init_after_tusb();
  }

  while (1)
  {
    tud_task(); // tinyusb device task
    cdc_task();
  }
}

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.

None yet

3 participants