I’m using Teensy 3.2 and cannot build my teensy code due to two warnings resulting in an error 1 return.
Warning 1 - .pio/build/teensy31/firmware.elf section .text' will not fit in region FLASH’
Warning 2 - region `FLASH’ overflowed by 86948 bytes
Error - collect2: error: ld returned 1 exit status
From what I read it basically means that the file is too large but my src folder is 40129 bytes and Teensy 3.2 flash size is 262144 bytes as it is written in the platforms/teensy/boards/teensy31.json file.
Even the build begins with >
Verbose mode can be enabled via -v, --verbose
option
CONFIGURATION: https://docs.platformio.org/page/boards/teensy/teensy31.html
PLATFORM: Teensy (4.16.0) > Teensy 3.1 / 3.2
HARDWARE: MK20DX256 72MHz, 64KB RAM, 256KB Flash
DEBUG: Current (jlink) External (jlink)
PACKAGES:
- framework-arduinoteensy @ 1.156.0 (1.56)
- toolchain-gccarmnoneeabi @ 1.50401.190816 (5.4.1)
The src folder is a cpp file (with setup and loop functions) + 4 header files surrounding it with functions used in the cpp file. Also, the 2 warnings in the .h files are unrelated to the issue. Tree for more clarity
From what I read it basically means that the file is too large but my src folder is 40129 bytes and Teensy 3.2 flash size is 262144
The size of your src folder has not much to do with the size of the generated program. If you are interested in where all that memory goes to you can use an ELF viewer.
For example, here you find an online viewer: http://www.sunshine2k.de/coding/javascript/onlineelfviewer/onlineelfviewer.html. Upload your elf file and scroll down to the symbol table section to find out what eats up that huge amount of memory.