When you build the firmware image, it will tell you the size of the text, data, and bss segments. The text segment goes in flash, the data and bss go in RAM. (Well, the data segment goes in both).
data comes from any object with static lifetime that has an initialised value, e.g.:
bss comes from global unintialised data, e.g.
The heap itself is in BSS. (38kiB by default).
So disabling any code that variables in data/bss will make more RAM available for the heap.
However, other than a few static buffers in some specific places, not much code in micropython uses global variables. Things tend to be allocated on the heap instead. So pfalcon is right that there is very little
RAM to be gained by disabling functionality.
But let's do some science. Compiling ESP8266 firmware at master:
Code: Select all
text data bss dec hex filename
586468 1040 66368 653876 9fa34 build/firmware.elf
Disabling btree:
Code: Select all
text data bss dec hex filename
567244 1024 66368 634636 9af0c build/firmware.elf
The disabling ussl & axtls
Code: Select all
text data bss dec hex filename
539232 1024 66368 606624 941a0 build/firmware.elf
So you can see there are some significant reductions to the text segment (i.e. flash) due to the reduced code size. But no change to the data/bss.
The ESP8266 has 80 kiB of RAM total, so this leaves 15552 kiB for the stack. (i.e. not very much)
But, to look at this another way -- rather than guessing things to disable and removing them to see what happens, we can look at what's actually using bss and data.
Code: Select all
$ xtensa-lx106-elf-objdump -j .bss -j .data -t build/firmware.elf | sort -k5
3ffea890 g O .bss 00000040 wDevCtrl
3ffee72c g O .bss 00000074 chip6_phy_init_ctrl
3fff835c l O .bss 00000090 pwm_single_toggle
3ffee698 g O .bss 00000094 chip6_sleep_params
3ffedf20 g O .bss 0000009c gScanStruct
3ffe9e60 g O .bss 000000e8 pmc
3ffe90d4 l O .bss 000000f0 arp_table
3ffe8940 g O .bss 00000100 event_TaskQueue
3fff822c l O .bss 00000100 stdin_ringbuf_array
3fff887c g O .bss 0000018c emu_tasks
3fff8678 g O .bss 000001d8 mp_state_ctx
3fff8001 l O .bss 00000200 filebuf$5274
3fff8474 l O .bss 00000200 LfnBuf
3ffe8c30 l O .bss 00000460 dns_table
3ffed818 g O .bss 000006b0 g_ic
3ffee7f8 l O .bss 00009800 heap
Unfortunately most of this comes from internal ESP8266 stuff. g_ic comes from libnet80211.a, etc. LfnBuf comes from micropython's FAT filesystem, so you could experiment with disabling LFN support (for 1.1kiB).