tinyusb-sys-rs icon indicating copy to clipboard operation
tinyusb-sys-rs copied to clipboard

How to define SDK directory?

Open m5p3nc3r opened this issue 4 years ago • 3 comments

Hi there

I am struggling to build this crate. I am targeting the RP2040, and the build cannot find the pico.h header that would normally be found in the SDK.

Is there any way to define where the SDK is installed?

m5p3nc3r avatar Mar 31 '22 13:03 m5p3nc3r

Hi, I might also don't know how to use this 😭

I added this to my Cargo.toml: tinyusb-sys = { version = "0.1", features = ["host", "hid", "rp2040"] }

Is there something else missing?

noone@imac20 rp2040-project-template % RUST_BACKTRACE=1 cargo build
   Compiling tinyusb-sys v0.1.0
error: failed to run custom build command for `tinyusb-sys v0.1.0`

Caused by:
  process didn't exit successfully: `/Users/noone/Documents/rp2040-project-template/target/debug/build/tinyusb-sys-f467065c88a53664/build-script-build` (exit status: 101)
  --- stdout
  OPT_LEVEL = Some("3")
  TARGET = Some("thumbv6m-none-eabi")
  HOST = Some("x86_64-apple-darwin")
  CC_thumbv6m-none-eabi = None
  CC_thumbv6m_none_eabi = None
  TARGET_CC = None
  CC = None
  CROSS_COMPILE = None
  CFLAGS_thumbv6m-none-eabi = None
  CFLAGS_thumbv6m_none_eabi = None
  TARGET_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = None

  --- stderr
  thread 'main' panicked at 'Failed to run the compiler: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /Users/noone/.cargo/registry/src/github.com-1ecc6299db9ec823/tinyusb-sys-0.1.0/build.rs:34:14
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:584:5
     1: core::panicking::panic_fmt
               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/panicking.rs:142:14
     2: core::result::unwrap_failed
               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/result.rs:1785:5
     3: core::result::Result<T,E>::expect
     4: build_script_build::main
     5: core::ops::function::FnOnce::call_once
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
noone@imac20 rp2040-project-template % 

No0ne avatar Jul 06 '22 16:07 No0ne

I pushed a fix: https://github.com/nviennot/tinyusb-sys-rs/commit/c71f66761d66d1bc9230959b6d4cc302117248f6

There's more things to fix though, like configuring the stm32fxxx target. I'm not going to do it though, but whoever who'd like to do so can in tusb_config.rs

nviennot avatar Jul 07 '22 02:07 nviennot

Ah! I completely missed the point that I didn't have arm-none-eabi-gcc installed (via homebrew) on my Mac. Now I'm getting the same issue as @m5p3nc3r. Setting export PICO_SDK_PATH=~/pico-sdk also didn't work:

running: "arm-none-eabi-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-mthumb" "-march=armv6s-m" "-I" "tinyusb/src" "-I" "/Users/noone/Documents/rp2040-project-template/target/thumbv6m-none-eabi/debug/build/tinyusb-sys-d14208066ec1c970/out" "-Wall" "-Wextra" "-o" "/Users/noone/Documents/rp2040-project-template/target/thumbv6m-none-eabi/debug/build/tinyusb-sys-d14208066ec1c970/out/tinyusb/src/portable/raspberrypi/rp2040/hcd_rp2040.o" "-c" "tinyusb/src/portable/raspberrypi/rp2040/hcd_rp2040.c"
  cargo:warning=tinyusb/src/portable/raspberrypi/rp2040/hcd_rp2040.c:32:10: fatal error: pico.h: No such file or directory
  cargo:warning=   32 | #include "pico.h"
  cargo:warning=      |          ^~~~~~~~
  cargo:warning=compilation terminated.
  exit status: 1

How can I try the fix from c71f667?

No0ne avatar Jul 16 '22 07:07 No0ne