fieldofcows / atari-st-rpikb

Connect USB keyboard and mouse to Atari ST using a Raspberry PI emulating the HD6301 keyboard controller
GNU General Public License v3.0
31 stars 10 forks source link

undefined reference to `USB_GetHIDReportItemInfo' #2

Open beeka opened 2 years ago

beeka commented 2 years ago

I am unable to build this, getting link errors:

/usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: CMakeFiles/atari_ikbd.dir/src/HidInput.cpp.obj: in function `HidInput::handle_mouse(long long)':
HidInput.cpp:(.text._ZN8HidInput12handle_mouseEx+0x10c): undefined reference to `USB_GetHIDReportItemInfo'
/usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: CMakeFiles/atari_ikbd.dir/src/HidInput.cpp.obj: in function `HidInput::get_usb_joystick(int, unsigned char&, unsigned char&)':
HidInput.cpp:(.text._ZN8HidInput16get_usb_joystickEiRhS0_+0xfa): undefined reference to `USB_GetHIDReportItemInfo'
/usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: CMakeFiles/atari_ikbd.dir/pico-sdk/lib/tinyusb/src/class/hid/hid_host.c.obj: in function `hidh_get_report_complete':
hid_host.c:(.text.hidh_get_report_complete+0x78): undefined reference to `USB_ProcessHIDReport'

This function looks like it is in lib/tinyusb/src/class/hid/hidparser/HIDParser.c but don't see this mentioned in any CMakeLists.txt file (should it be in pico-sdk\src\rp2_common\tinyusb\CMakeLists.txt?). Adding it to the target_sources for tinyusb_host does build and link but no idea if it is meant to be there.

As I wasn't sure what tweaks you had made to tinyusb (and seeing that the library has moved on since your changes), I figured I would try using the current SDK but get errors starting with:

../src/HidInput.cpp: In function 'void tuh_hid_mounted_cb(uint8_t)':
../src/HidInput.cpp:47:5: error: 'HID_TYPE' was not declared in this scope
   47 |     HID_TYPE tp = tuh_hid_get_type(dev_addr);
      |     ^~~~~~~~

The current SDK doesn't mention USB_GetHIDReportItemInfo at all, so the HID_TYPE error is likely to be the first of many.

FYI: I'm building this using Ninja in a container based on xingrz/rpi-pico-builder.

eventcatcher commented 2 years ago

same problem here. undefined reference to `USB_GetHIDReportItemInfo'

undefined reference to `USB_ProcessHIDReport'

compiled on macos 12.1.

git clone -b main https://github.com/fieldofcows/atari-st-rpikb.git cd atari-st-rpikb git submodule sync git submodule update --init --recursive

olivierjan commented 2 years ago

I've had the same error trying to compile on my Mac (Intel), I tried also in Ubuntu and on a Raspberry Pi running Raspbian, each gave me the same error. The missing symbols are part of HIDParser which seems not to be included in the Makefile, so I added it and it successfully compiled.

Edit following file : atari-st-rpikb/pico-sdk/src/rp2_common/tinyusb/CMakeLists.txt Add following line after line 91: ${PICO_TINYUSB_PATH}/src/class/hid/hidparser/HIDParser.c You should have something like this.

target_sources(tinyusb_host INTERFACE
            ${PICO_TINYUSB_PATH}/src/portable/raspberrypi/rp2040/hcd_rp2040.c
            ${PICO_TINYUSB_PATH}/src/portable/raspberrypi/rp2040/rp2040_usb.c
            ${PICO_TINYUSB_PATH}/src/host/usbh.c
            ${PICO_TINYUSB_PATH}/src/host/usbh_control.c
            ${PICO_TINYUSB_PATH}/src/host/hub.c
            ${PICO_TINYUSB_PATH}/src/class/cdc/cdc_host.c
            ${PICO_TINYUSB_PATH}/src/class/hid/hid_host.c
            ${PICO_TINYUSB_PATH}/src/class/hid/hidparser/HIDParser.c
            ${PICO_TINYUSB_PATH}/src/class/msc/msc_host.c
            ${PICO_TINYUSB_PATH}/src/class/vendor/vendor_host.c
            )

Go back to your build directory and rebuild.