Skip to content

pico-sdk and tinyusb fail to build with GCC 11.2 #780

@lurch

Description

@lurch

I'm not sure exactly where the problem is, so pinging @kilograham @liamfraser and @hathach

If I build just pico-sdk with GCC 11.2 from https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/downloads then it builds fine, but if I also clone the tinyusb sumbodule, then when I try to build it fails with:

[ 75%] Building C object test/kitchen_sink/CMakeFiles/kitchen_sink_extra_stdio.dir/__/__/lib/tinyusb/src/portable/raspberrypi/rp2040/rp2040_usb.c.obj
/pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040/rp2040_usb.c: In function 'rp2040_usb_init':
/pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040/rp2040_usb.c:61:3: error: 'memset' offset [0, 155] is out of the bounds [0, 0] [-Werror=array-bounds]
   61 |   memset(usb_hw, 0, sizeof(*usb_hw));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040/rp2040_usb.c:62:3: error: 'memset' offset [0, 4095] is out of the bounds [0, 0] [-Werror=array-bounds]
   62 |   memset(usb_dpram, 0, sizeof(*usb_dpram));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [test/kitchen_sink/CMakeFiles/kitchen_sink_extra_stdio.dir/build.make:781: test/kitchen_sink/CMakeFiles/kitchen_sink_extra_stdio.dir/__/__/lib/tinyusb/src/portable/raspberrypi/rp2040/rp2040_usb.c.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:2069: test/kitchen_sink/CMakeFiles/kitchen_sink_extra_stdio.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

😢

To reproduce:
(I'm doing everything inside docker just to rule out any other part of the system interfering with things)

sudo docker run -it ubuntu:20.04

and then inside docker:

apt update
apt install -y build-essential git python3 cmake wget
wget https://developer.arm.com/-/media/Files/downloads/gnu/11.2-2022.02/binrel/gcc-arm-11.2-2022.02-x86_64-arm-none-eabi.tar.xz
tar xf gcc-arm-11.2-2022.02-x86_64-arm-none-eabi.tar.xz
git clone https://github.com/raspberrypi/pico-sdk.git
cd pico-sdk
git checkout develop
mkdir build.nousb
cd build.nousb
PATH=../../gcc-arm-11.2-2022.02-x86_64-arm-none-eabi/bin:$PATH cmake ..
make
# this 'make' all works fine, and builds to 100%
cd ..
git submodule update --init
mkdir build.usb
cd build.usb
PATH=../../gcc-arm-11.2-2022.02-x86_64-arm-none-eabi/bin:$PATH cmake ..
make
# this 'make' fails with the memset error detailed above

I'm happy to provide any other info and/or do any other testing that might be needed.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions