platformio / platform-intel_mcs51

Intel MCS-51 (8051): development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/intel_mcs51
Apache License 2.0
56 stars 45 forks source link

support `size` target #1

Closed Palatis closed 6 years ago

Palatis commented 7 years ago

there's a firmware.mem containing the size info, generated while linking

Internal RAM layout:
      0 1 2 3 4 5 6 7 8 9 A B C D E F
0x00:|0|0|0|0|0|0|0|0|b|b|b|b|b|c|c|c|
0x10:|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|
0x20:|B|T|a|a|a|a|a|a|a|a|a|a|a|a|a|a|
0x30:|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|
0x40:|a|a|a|a|a|a|a|a|a|a|d|d|d|d|d|d|
0x50:|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|e|
0x60:|e|e|e|e|e|e|e|f|Q|Q|Q|Q|Q|Q|Q|Q|
0x70:|Q|Q|Q|S|S|S|S|S|S|S|S|S|S|S|S|S|
0x80:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0x90:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0xa0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0xb0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0xc0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0xd0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0xe0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0xf0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0-3:Reg Banks, T:Bit regs, a-z:Data, B:Bits, Q:Overlay, I:iData, S:Stack, A:Absolute

Stack starts at: 0x73 (sp set to 0x72) with 141 bytes available.
No spare internal RAM space left.

Other memory:
   Name             Start    End      Size     Max     
   ---------------- -------- -------- -------- --------
   PAGED EXT. RAM                         0      256   
   EXTERNAL RAM     0x0001   0x0424    1060    65536   
   ROM/EPROM/FLASH  0x0000   0x1158    4441    65536

maybe we can just add a target to print that out, but I don't know how.

zerog2k commented 6 years ago

I would like to take this enhancement on. In my old makefile projects, just tail out the last n lines of main.mem or whatever firmware target is. I see that platform-nordicnrf51 does something similar: https://github.com/platformio/platform-nordicnrf51/blob/develop/builder/main.py#L143-L151

zerog2k commented 6 years ago

@ivankravets I would like to try to take this on. Any helpful pointers here?

ivankravets commented 6 years ago

There is a file .pioenvs/stc15f204ea/firmware.mem with memory details. Could you someone explain to me how to do a correct calculation of used RAM & Flash?