Arduino icon indicating copy to clipboard operation
Arduino copied to clipboard

Core 3.1.x: static and flash memory usage messages from compiler seem corrupted

Open bxparks opened this issue 2 years ago • 1 comments

Basic Infos

  • [X] This issue complies with the issue POLICY doc.
  • [X] I have read the documentation at readthedocs and the issue is not addressed there.
  • [how do I do this?] I have tested that the issue is present in current master branch (aka latest git).
  • [X] I have searched the issue tracker for a similar issue.
  • [X] If there is a stack dump, I have decoded it.
  • [X] I have filled out all fields below.

Platform

  • Hardware: [ESP-12]
  • Core Version: [3.1.2]
  • Development Env: [Arduino IDE 1.8.19]
  • Operating System: [Ubuntu]

Settings in IDE 1.8.19

--board esp8266:esp8266:nodemcuv2:xtal=80,vt=flash,exception=disabled,ssl=all,eesz=4M2M,led=2,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=921600

  • Module: [Nodemcu]
  • Flash Mode: [???]
  • Flash Size: [4MB/2MB]
  • lwip Variant: [v2 Lower Memory]
  • Reset Method: [???]
  • Flash Frequency: [???]
  • CPU Frequency: [80Mhz]
  • Upload Using: [SERIAL]
  • Upload Speed: [115200]

Problem Description

Prior to 3.1.x (e.g. 3.0.2), the compiler printed a summary of the static and flash memory usage that was formatted like this:

Executable segment sizes:
ICACHE : 32768       	- flash instruction cache
IROM   : 231500      	- code in flash     	(default or ICACHE_FLASH_ATTR)
IRAM   : 26217   / 32768 - code in IRAM      	(IRAM_ATTR, ISRs...)
DATA   : 1496  )     	- initialized variables (global, static) in RAM/HEAP
RODATA : 876   ) / 81920 - constants         	(global, static) in RAM/HEAP
BSS	: 25520 )     	- zeroed variables  	(global, static) in RAM/HEAP

Sketch uses 260089 bytes (24%) of program storage space. Maximum is 1044464 bytes.
Global variables use 27892 bytes (34%) of dynamic memory, leaving 54028 bytes for local variables. Maximum is 81920 bytes.

In 3.1.0, (and verified to be the same in 3.1.2), that changed to something like this, with a bunch of ? question marks, with no final summary lines:

. Variables and constants in RAM (global, static), used 28008 / 80192 bytes (34%)
???   SEGMENT  BYTES	DESCRIPTION
????????? DATA 	1496 	initialized variables
????????? RODATA   920  	constants  	 
????????? BSS  	25592	zeroed variables
. Instruction RAM (IRAM_ATTR, ICACHE_RAM_ATTR), used 59143 / 65536 bytes (90%)
???   SEGMENT  BYTES	DESCRIPTION
????????? ICACHE   32768	reserved space for flash instruction cache
????????? IRAM 	26375	code in IRAM    
. Code in flash (default, ICACHE_FLASH_ATTR), used 231636 / 1048576 bytes (22%)
???   SEGMENT  BYTES	DESCRIPTION
????????? IROM 	231636   code in flash

Expected Result

  1. Those ????????? seem to indicate corrupted strings.

  2. Print the 2 summary lines in the format of:

Sketch uses 260089 bytes (24%) of program storage space. Maximum is 1044464 bytes.
Global variables use 27892 bytes (34%) of dynamic memory, leaving 54028 bytes for local variables. Maximum is 81920 bytes.

for readability and compatibility with other cores.

MCVE Sketch

A blank sketch is sufficient to see this.

#include <Arduino.h>
void setup() {}
void loop() {}

Debug Messages

bxparks avatar Mar 24 '23 19:03 bxparks

Python forced into UTF-8 mode for the size script, and we kind of expect linux systems to use that by default. https://github.com/esp8266/Arduino/pull/8570 https://github.com/esp8266/Arduino/pull/8573 (which may be wrong assumption within IDE)

More output is the point here, basic size pattern is... too basic (but, still print it in verbose mode) https://github.com/esp8266/Arduino/pull/8572 already mentioned that original size pattern is pretty limiting and does not integrate with IDE all too well, but arduino-cli starting with 0.21 has recipe.advanced_size.pattern for IDE ≥2.0 which can be used instead

mcspr avatar Mar 25 '23 16:03 mcspr