raspberrypi / pico-examples

BSD 3-Clause "New" or "Revised" License
2.94k stars 844 forks source link

USB examples don't build when using RTT #565

Open peterharperuk opened 1 month ago

peterharperuk commented 1 month ago

[ 90%] Building C object usb/host/tinyusb_host_examples/msc_file_explorer/CMakeFiles/tinyusb_host_msc_file_explorer.dir/home/peterh/source/pico2/pico-sdk-rp2350/src/rp2_common/pico_stdio_rtt/stdio_rtt.c.o /home/peterh/source/pico2/pico-sdk-rp2350/src/rp2_common/pico_stdio_rtt/stdio_rtt.c: In function 'stdio_rtt_out_chars': /home/peterh/source/pico2/pico-sdk-rp2350/src/rp2_common/pico_stdio_rtt/stdio_rtt.c:29:30: error: conversion to 'unsigned int' from 'int' may change the sign of the result [-Werror=sign-conversion] 29 | SEGGER_RTT_Write(0, buf, length); | ^~ compilation terminated due to -Wfatal-errors. cc1: all warnings being treated as errors make[2]: ** [usb/host/tinyusb_host_examples/msc_file_explorer/CMakeFiles/tinyusb_host_msc_file_explorer.dir/build.make:893: usb/host/tinyusb_host_examples/msc_file_explorer/CMakeFiles/tinyusb_host_msc_file_explorer.dir/home/peterh/source/pico2/pico-sdk-rp2350/src/rp2_common/pico_stdio_rtt/stdio_rtt.c.o] Error 1 [ 90%] Building C object usb/host/tinyusb_host_examples/msc_file_explorer/CMakeFiles/tinyusb_host_msc_file_explorer.dir/home/peterh/source/pico2/pico-sdk-rp2350/src/rp2_common/pico_stdio_rtt/SEGGER/RTT/SEGGER_RTT.c.o /home/peterh/source/pico2/pico-sdk-rp2350/src/rp2_common/pico_stdio_rtt/SEGGER/RTT/SEGGER_RTT.c: In function '_DoInit': /home/peterh/source/pico2/pico-sdk-rp2350/src/rp2_common/pico_stdio_rtt/SEGGER/RTT/SEGGER_RTT.c:327:27: error: cast increases required alignment of target type [-Werror=cast-align] 327 | p = (volatile SEGGER_RTT_CB)((char*)&_SEGGER_RTT + SEGGER_RTT_UNCACHED_OFF); // Access control block uncached so that nothing in the cache ever becomes dirty and all changes are visible in HW directly | ^ compilation terminated due to -Wfatal-errors.

out.txt

peterharperuk commented 1 month ago

https://forum.segger.com/index.php/Thread/9156-SOLVED-RTT-compile-error-with-GCC/?postID=33015