earlephilhower / arduino-pico

Raspberry Pi Pico Arduino core, for all RP2040 and RP2350 boards
GNU Lesser General Public License v2.1
1.99k stars 412 forks source link

Strange compiler error #1359

Closed obdevel closed 1 year ago

obdevel commented 1 year ago

I'm trying to compile the LVGL graphics library and have a compiler error I've never seen before. A google search doesn't throw up anything recent or relevant. I'm compiling for Pico W but this doesn't seem related. The assembler seems to be complaining that the compiler has generated invalid code.

I'm using Bodmer's TFT_eSPI library for the low-level stuff and this works well on its own, but I'd like to try a higher level of abstraction and have access to the LVGL UI widgets.

I have raised an issue with the LVGL project (https://forum.lvgl.io/t/rp2040-and-lvgl/11071/2) with full details but I've received no responses yet (my post is the third one in this thread).

Any thoughts ? I'm happy to try any suggestions.

The error output is:

/Users/xxx/Library/Arduino15/packages/rp2040/tools/pqt-gcc/1.5.0-b-c7bab52/bin/arm-none-eabi-gcc -c -Wall -Wextra -Werror=return-type -Wno-ignored-qualifiers -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DUSBD_PID=0x000a -DUSBD_VID=0x2e8a -DUSBD_MAX_POWER_MA=250 "-DUSB_MANUFACTURER=\"Raspberry Pi\"" "-DUSB_PRODUCT=\"Pico\"" -DPICO_CYW43_ARCH_THREADSAFE_BACKGROUND=1 -DCYW43_LWIP=1 -DLWIP_IPV6=0 -DLWIP_IPV4=1 -DLWIP_IGMP=1 -DLWIP_CHECKSUM_CTRL_PER_NETIF=1 "-DARDUINO_VARIANT=\"rpipico\"" -DTARGET_RP2040 -march=armv6-m -mcpu=cortex-m0plus -mthumb -ffunction-sections -fdata-sections -fno-exceptions -DARM_MATH_CM0_FAMILY -DARM_MATH_CM0_PLUS -MMD -iprefix/Users/xxx/Library/Arduino15/packages/rp2040/hardware/rp2040/3.1.0/ @/Users/xxx/Library/Arduino15/packages/rp2040/hardware/rp2040/3.1.0/lib/platform_inc.txt -I/Users/xxx/Library/Arduino15/packages/rp2040/hardware/rp2040/3.1.0/include -std=gnu17 -g -pipe -DF_CPU=133000000L -DARDUINO=10819 -DARDUINO_RASPBERRY_PI_PICO "-DBOARD_NAME=\"RASPBERRY_PI_PICO\"" -DARDUINO_ARCH_RP2040 -Os -I/Users/xxx/Library/Arduino15/packages/rp2040/hardware/rp2040/3.1.0/cores/rp2040 -I/Users/xxx/Library/Arduino15/packages/rp2040/hardware/rp2040/3.1.0/variants/rpipico -I/Users/xxx/Documents/Arduino/libraries/TFT_eSPI -I/Users/xxx/Library/Arduino15/packages/rp2040/hardware/rp2040/3.1.0/libraries/SPI/src -I/Users/xxx/Library/Arduino15/packages/rp2040/hardware/rp2040/3.1.0/libraries/LittleFS/src -I/Users/xxx/Documents/Arduino/libraries/lvgl/src /Users/xxx/Documents/Arduino/libraries/lvgl/src/core/lv_obj.c -o /var/folders/03/s3pv8qk91w78m4_st_nbxl5m0000gn/T/arduino_build_571161/libraries/lvgl/core/lv_obj.c.o
{standard input}: Assembler messages:
{standard input}: Error: unaligned opcodes detected in executable segment
earlephilhower commented 1 year ago

This is an unfortunately known bug in GCC 10.x where there's a case statement that gets invalid assembly generated. The LVGL source is fine, the core is fine, but unfortunately GCC somehow slipped out w/a problem.

Right now if you need this, then see #1294 for a GCC 12 pre-release build.

At some point we will move to GCC 12, but in my experience changing a compiler always uncovers new and wonderfully odd bugs. So it's going to wait for a major release (i.e. 4.x) and not just slipped in as a minor one. I also think as of SDK1.5 there were a couple Pico-SDK issued w/GCC12 that still need to be addressed.