Saving Space for Frozen Code

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
bitninja
Posts: 113
Joined: Thu Sep 15, 2016 4:09 pm
Location: Spring, Texas

Saving Space for Frozen Code

Post by bitninja » Thu Feb 07, 2019 7:19 am

I have been building the esp8266 version of MicroPython for some time now and have noticed some limitations of how much I can fit before it fails to build. I am at a point now where I have to choose between two important apps and was wondering if I can trim elsewhere to get them both to fit. Is everything else in the Modules folder fair game? Is there anything obviously "extra weight"?

Thanks!

kevinkk525
Posts: 326
Joined: Sat Feb 03, 2018 7:02 pm

Re: Saving Space for Frozen Code

Post by kevinkk525 » Thu Feb 07, 2019 7:24 am

I change the irom0 size with the following command (on linux, run on an unmodified file, you can edit the file manually though):

sed -i 's/irom0_0_seg : org = 0x40209000, len = 0x8f000/irom0_0_seg : org = 0x40209000, len = 0xe7000/' ~/micropython/ports/esp8266/esp8266.ld

For manually editing:
search for the string: irom0_0_seg : org = 0x40209000, len = 0x8f000
and replace it with: irom0_0_seg : org = 0x40209000, len = 0xe7000

This gives me plenty of flash size for frozen modules.

bitninja
Posts: 113
Joined: Thu Sep 15, 2016 4:09 pm
Location: Spring, Texas

Re: Saving Space for Frozen Code

Post by bitninja » Thu Feb 07, 2019 6:17 pm

Thanks for that!

I will give a try when I get home.

Tell me, does this take space away from the integrated flash file system?

kevinkk525
Posts: 326
Joined: Sat Feb 03, 2018 7:02 pm

Re: Saving Space for Frozen Code

Post by kevinkk525 » Thu Feb 07, 2019 7:49 pm

It probably does.

Post Reply