Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table output for segment size script #8551

Merged
merged 7 commits into from
May 11, 2022
Merged

Conversation

mcspr
Copy link
Collaborator

@mcspr mcspr commented Apr 25, 2022

Re-format the file, hints and clean-up the resulting data dict

Also include maximum aka total for every segment key, so now we could also display it every time

(penv) ~\D\A\s\test> C:\\Users\\maxim\\Documents\\Arduino\\hardware\\esp8266com\\esp8266/tools/python3/python3 \
  -I "C:\\Users\\maxim\\Documents\\Arduino\\hardware\\esp8266com\\esp8266/tools/sizes.py" \
  --elf "C:\\Users\\maxim\\AppData\\Local\\Temp\\arduino-sketch-47C53BFFA994BDA8380BC89E427DA2CA/test.ino.elf" \
  --path "C:\\Users\\maxim\\Documents\\Arduino\\hardware\\esp8266com\\esp8266/tools/xtensa-lx106-elf/bin" \
  --mmu "-DMMU_IRAM_SIZE=0x8000 -DMMU_ICACHE_SIZE=0x8000"
SEGMENT  USED     TOTAL    PERCENT  DESCRIPTION
----------------------------------------------------
ICACHE   32768    32768    100%     flash instruction cache
IROM     232088   1048576  22%      code in flash (default, ICACHE_FLASH_ATTR)
IRAM     26205    32768    79%      code in IRAM (IRAM_ATTR, ICACHE_RAM_ATTR)
DATA     1496     81920    1%       initialized variables (global, static) in RAM
RODATA   876      81920    1%       constants (global, static) in RAM
BSS      25520    81920    31%      zeroed variables (global, static) in RAM

vs. old

Executable segment sizes:
ICACHE : 32768           - flash instruction cache
IROM   : 232088          - code in flash         (default or ICACHE_FLASH_ATTR)
IRAM   : 26205   / 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

idk about the percentage, though... whether it should be for specific segment, or for the memory overall. we could combine data + rodata + bss percentages as "User-data RAM" and IRAM & ICACHE as... "Instruction RAM"?
could just remove it too

Also include maximum aka total for every segment key
Re-format the file and clean-up the resulting data dict
@earlephilhower
Copy link
Collaborator

I'm indifferent on the table vs. the more organic way that @d-a-v was doing it, but I think this line is going to cause concern among people who don't know any better:

ICACHE   32768    32768    100%     flash instruction cache

Reporting 100% use seems like it's going to make people ask questions or be worried. For this special-case, can we do something similar to before where we don't report the usage? Something like

SEGMENT  USED     TOTAL    PERCENT  DESCRIPTION
----------------------------------------------------
ICACHE            32768             flash instruction cache

@d-a-v, thoughts?

@mhightower83
Copy link
Contributor

In hindsight, configured flash instruction cache size might have been a more accurate description. Or is that getting too long for a brief description?

@d-a-v
Copy link
Collaborator

d-a-v commented Apr 29, 2022

There could be misunderstanding about RAM content, which I had tried to show with the three parenthesis ) in the original representation.
In the new representation above, RAM details are imho hidden or confusing.
If RAM details matter, how are the lines below improvable to fit with this PR's intent ?

SEGMENT  USED     TOTAL    PERCENT  DESCRIPTION
----------------------------------------------------
ICACHE   32768    32768    100%     configured flash instruction cache
IROM     232088   1048576  22%      code in flash (default, ICACHE_FLASH_ATTR)
IRAM     26205    32768    79%      code in IRAM (IRAM_ATTR, ICACHE_RAM_ATTR)
RAM      27892    81920    34%      RAM details (global or static): 
 +DATA     1496              1%     - initialized variables
 +RODATA   876               1%     - constants
 +BSS      25520             31%    - zeroed variables

@mcspr
Copy link
Collaborator Author

mcspr commented Apr 30, 2022

(and yeah, I haven't realized what ) was supposed to mean :)

What about something like this

. Variables and constants in RAM (total 80192 bytes)
├── DATA 1496 - initialized variables (global, static)
├── RODATA 876 - constants (global, static)
└── BSS 25520 - zeroed variables (global, static)
. Instruction cache (total 32768 bytes)
└── ICACHE 32768 - configured flash instruction cache
. Instruction RAM (total 32768 bytes)
└── IRAM 26205 - code in IRAM (IRAM_ATTR, ICACHE_RAM_ATTR)
. Code in flash (total 1048576 bytes)
└── IROM 232088 - code in flash (default, ICACHE_FLASH_ATTR)

Plus, IDE also prints this right after, through the size recipe
(...see #8550, we need to get {board}.upload.maximum_size=... back so it works. it is c/p from there)

Sketch uses 260665 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.

And which may actually be disabled in favour of the script

@d-a-v
Copy link
Collaborator

d-a-v commented May 2, 2022

The tree looks nice !
Did you remove percentages on purpose ?

@mcspr
Copy link
Collaborator Author

mcspr commented May 2, 2022

Just missed, will update the script to add it to total line.

Regarding IRAM... what about

. Instruction RAM (total 65536 bytes, used 58973 bytes (90%))
├── CACHE 32768  - reserved for flash instruction cache
└── CODE 26205   - (IRAM_ATTR, ICACHE_RAM_ATTR)

So there's also a space for HEAP in the tree output, which is otherwise missing
(names are under question, though. perhaps it should stay ICACHE, ICACHE_RAM... and add ICACHE_HEAP)

Copy link
Collaborator

@d-a-v d-a-v left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks !

I get this, all data are there, including percentages.

. Variables and constants in RAM, total 80192 bytes, used 38712 bytes (48%)
├── DATA     1760     initialized variables (global, static)
├── RODATA   5992     constants (global, static)
└── BSS      30960    zeroed variables (global, static)
. Instruction RAM, total 65536 bytes, used 47905 bytes (73%)
├── ICACHE   16384    reserved space for flash instruction cache
└── IRAM     31521    code in IRAM (IRAM_ATTR, ICACHE_RAM_ATTR)
. Code in flash, total 1048576 bytes, used 450264 bytes (42%)
└── IROM     450264   code in flash (default, ICACHE_FLASH_ATTR)

previously

Executable segment sizes:
ICACHE : 16384           - flash instruction cache 
IROM   : 450264          - code in flash         (default or ICACHE_FLASH_ATTR) 
IRAM   : 31521   / 49152 - code in IRAM          (IRAM_ATTR, ISRs...) 
DATA   : 1760  )         - initialized variables (global, static) in RAM/HEAP 
RODATA : 5992  ) / 81920 - constants             (global, static) in RAM/HEAP 
BSS    : 30960 )         - zeroed variables      (global, static) in RAM/HEAP 

This is trying to remove redundant text, making it more light.
ymmv

Variables and constants in RAM (global, static)
|    48%      38712 / 80192 bytes
├── DATA       1760   initialized variables 
├── RODATA     5992   constants
└── BSS       30960   zeroed variables
Instruction RAM (IRAM_ATTR, ICACHE_RAM_ATTR)
|    73%      47905 / 65536 bytes
├── ICACHE    16384   reserved space for flash instruction cache
└── IRAM      31521   code in IRAM
Code in flash (default, ICACHE_FLASH_ATTR)
|    42%     450264 / 1048576 bytes
└── IROM     450264   code in flash

@mcspr
Copy link
Collaborator Author

mcspr commented May 5, 2022

With the suggestion above

. Variables and constants in RAM (global, static), used 27892 / 80192 bytes (34%)
|   SEGMENT  BYTES    DESCRIPTION
├── DATA     1496     initialized variables
├── RODATA   876      constants
└── BSS      25520    zeroed variables
. Instruction RAM (IRAM_ATTR, ICACHE_RAM_ATTR), used 58973 / 65536 bytes (89%)
|   SEGMENT  BYTES    DESCRIPTION
├── ICACHE   16384    reserved space for flash instruction cache
├── IHEAP    16384    secondary heap space
└── IRAM     26205    code in IRAM
. Code in flash (default, ICACHE_FLASH_ATTR), used 232088 / 1048576 bytes (22%)
|   SEGMENT  BYTES    DESCRIPTION
└── IROM     232088   code in flash

(less dense, but still as wide as it was. only 81 chars btw)

@d-a-v d-a-v merged commit da4a19f into esp8266:master May 11, 2022
@mcspr mcspr deleted the sizes-py-table branch May 11, 2022 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants