Compiling errors when using optimizations on 6.7

I’m trying to upgrade my boards to 6.7. And whenever I change the optimizations to anything but “Smallest Code” I get the same compiling error:

Summary
Arduino: 1.8.19 (Windows 10), Board: "Proffieboard V2, Serial + Mass Storage + WebUSB, SDCARD (SPI), 80 MHz, Fastest"

c:/users/baldu/appdata/local/arduino15/packages/proffieboard/tools/arm-none-eabi-gcc/9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld.exe:C:\Users\baldu\AppData\Local\Arduino15\packages\proffieboard\hardware\stm32l4\3.6.0\variants\STM32L433CC-ProffieboardV2/linker_scripts/STM32L433CC_FLASH.ld:224: warning: memory region `SRAM2' not declared

In function 'operator new',

    inlined from 'run' at D:\Sabers\ProffieOS\styles\fire.h:61:15,

    inlined from 'run' at D:\Sabers\ProffieOS\styles\fire.h:115:68,

    inlined from 'run' at D:\Sabers\ProffieOS\styles\blade_style.h:64:28,

    inlined from 'RunStyle' at D:\Sabers\ProffieOS\styles\blade_style.h:87:61,

    inlined from 'run' at D:\Sabers\ProffieOS\styles\style_ptr.h:82:18:

C:\Users\baldu\AppData\Local\Arduino15\packages\proffieboard\hardware\stm32l4\3.6.0\cores\stm32l4\new.cpp:22:16: warning: argument 1 value '4294967295' exceeds maximum object size 2147483647 [-Walloc-size-larger-than=]

   22 |   return malloc(size);

      |                ^

C:\Users\baldu\AppData\Local\Arduino15\packages\proffieboard\hardware\stm32l4\3.6.0\cores\stm32l4\new.cpp: In member function 'run':

c:\users\baldu\appdata\local\arduino15\packages\proffieboard\tools\arm-none-eabi-gcc\9-2020-q2-update\arm-none-eabi\include\malloc.h:37:14: note: in a call to allocation function 'malloc' declared here

   37 | extern void *malloc (size_t);

      |              ^

In function 'operator new',

    inlined from 'run' at D:\Sabers\ProffieOS\functions\sparkle.h:22:17,

    inlined from 'run' at D:\Sabers\ProffieOS\styles\blade_style.h:129:5,

    inlined from 'RunFunction' at D:\Sabers\ProffieOS\styles\blade_style.h:142:64,

    inlined from 'run' at D:\Sabers\ProffieOS\styles\alpha.h:21:40,

    inlined from 'run' at D:\Sabers\ProffieOS\styles\blade_style.h:99:28,

    inlined from 'RunLayer' at D:\Sabers\ProffieOS\styles\blade_style.h:111:61,

    inlined from 'run' at D:\Sabers\ProffieOS\styles\layers.h:25:47,

    inlined from 'run' at D:\Sabers\ProffieOS\styles\blade_style.h:99:28,

    inlined from 'RunLayer' at D:\Sabers\ProffieOS\styles\blade_style.h:111:61,

    inlined from 'run' at D:\Sabers\ProffieOS\styles\alpha.h:20:46,

    inlined from 'run' at D:\Sabers\ProffieOS\styles\blade_style.h:99:28,

    inlined from 'RunLayer' at D:\Sabers\ProffieOS\styles\blade_style.h:111:61,

    inlined from 'run' at D:\Sabers\ProffieOS\styles\layers.h:25:47,

    inlined from 'run' at D:\Sabers\ProffieOS\styles\blade_style.h:99:28,

    inlined from 'RunLayer' at D:\Sabers\ProffieOS\styles\blade_style.h:111:61,

    inlined from 'run' at D:\Sabers\ProffieOS\styles\layers.h:24:46,

    inlined from 'run' at D:\Sabers\ProffieOS\styles\blade_style.h:99:28,

    inlined from 'RunLayer' at D:\Sabers\ProffieOS\styles\blade_style.h:111:61,

    inlined from 'run' at D:\Sabers\ProffieOS\styles\layers.h:24:46,

    inlined from 'run' at D:\Sabers\ProffieOS\styles\blade_style.h:99:28,

    inlined from 'RunLayer' at D:\Sabers\ProffieOS\styles\blade_style.h:111:61,

    inlined from 'run' at D:\Sabers\ProffieOS\styles\layers.h:24:46,

    inlined from 'run' at D:\Sabers\ProffieOS\styles\blade_style.h:99:28,

    inlined from 'RunLayer' at D:\Sabers\ProffieOS\styles\blade_style.h:111:61,

    inlined from 'run' at D:\Sabers\ProffieOS\styles\layers.h:24:46,

    inlined from 'run' at D:\Sabers\ProffieOS\styles\blade_style.h:99:28,

    inlined from 'RunLayer' at D:\Sabers\ProffieOS\styles\blade_style.h:111:61,

    inlined from 'run' at D:\Sabers\ProffieOS\styles\layers.h:24:46,

    inlined from 'run' at D:\Sabers\ProffieOS\styles\blade_style.h:99:28,

    inlined from 'RunLayer' at D:\Sabers\ProffieOS\styles\blade_style.h:111:61,

    inlined from 'run' at D:\Sabers\ProffieOS\styles\layers.h:24:46,

    inlined from 'run' at D:\Sabers\ProffieOS\styles\blade_style.h:77:30,

    inlined from 'RunStyle' at D:\Sabers\ProffieOS\styles\blade_style.h:87:61,

    inlined from 'run' at D:\Sabers\ProffieOS\styles\style_ptr.h:82:18:

C:\Users\baldu\AppData\Local\Arduino15\packages\proffieboard\hardware\stm32l4\3.6.0\cores\stm32l4\new.cpp:22:16: warning: argument 1 value '4294967295' exceeds maximum object size 2147483647 [-Walloc-size-larger-than=]

   22 |   return malloc(size);

      |                ^

C:\Users\baldu\AppData\Local\Arduino15\packages\proffieboard\hardware\stm32l4\3.6.0\cores\stm32l4\new.cpp: In member function 'run':

c:\users\baldu\appdata\local\arduino15\packages\proffieboard\tools\arm-none-eabi-gcc\9-2020-q2-update\arm-none-eabi\include\malloc.h:37:14: note: in a call to allocation function 'malloc' declared here

   37 | extern void *malloc (size_t);

      |              ^

c:/users/baldu/appdata/local/arduino15/packages/proffieboard/tools/arm-none-eabi-gcc/9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld.exe: warning: changing start of section .bss by 16 bytes

c:/users/baldu/appdata/local/arduino15/packages/proffieboard/tools/arm-none-eabi-gcc/9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld.exe: warning: changing start of section .bss by 16 bytes

c:/users/baldu/appdata/local/arduino15/packages/proffieboard/tools/arm-none-eabi-gcc/9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\baldu\AppData\Local\Temp\arduino_build_865692/ProffieOS.ino.elf section `.text' will not fit in region `FLASH'

c:/users/baldu/appdata/local/arduino15/packages/proffieboard/tools/arm-none-eabi-gcc/9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld.exe: warning: changing start of section .bss by 16 bytes

c:/users/baldu/appdata/local/arduino15/packages/proffieboard/tools/arm-none-eabi-gcc/9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld.exe: warning: changing start of section .bss by 16 bytes

c:/users/baldu/appdata/local/arduino15/packages/proffieboard/tools/arm-none-eabi-gcc/9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld.exe: warning: changing start of section .bss by 16 bytes

c:/users/baldu/appdata/local/arduino15/packages/proffieboard/tools/arm-none-eabi-gcc/9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld.exe: region `FLASH' overflowed by 4248 bytes

collect2.exe: error: ld returned 1 exit status

exit status 1

Error compiling for board Proffieboard V2.



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

From the error I would guess it’s a cast between unit and int. But may be is something with my installation. I’ve tried using a new ProffieOS download and get the exact same error. And I am using the 3.6 Proffie Board manager. I feel like I’m doing something really silly, but if there are problems with optimizations in 6.7, it would help understanding what’s going on.
Incidentally, when I switched the same config to Proffieboard v3, there was no problem.

Most of these things are warnings that can safely be ignored.
(However, I should still fix them at some point.)

This however, is not just a warning:

1 Like

I’m surprised because up until 5.9 using “Fastest Code” usually resulted in smaller code. Also had inverted the meaning of .text and .data in the ELF format. I haven’t touched a binary executable in a long time. Any strategy for reducing preset memory footprint?

Here are a few things you can do:

The biggest difference in how these behaves probably happened when I updated gcc in the arduino-proffieboard plugin. Newer gcc have more aggressive optimizations which also use more memory. The solution to these problems is of course to use a V3 proffieboard, if only those components were actually available…

1 Like