New script downloaded to board but old one still runs

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
pmulvey
Posts: 16
Joined: Sun Jul 29, 2018 8:12 am
Location: Athlone, Ireland

New script downloaded to board but old one still runs

Post by pmulvey » Thu Apr 04, 2019 9:32 pm

I had a problem with the "MemoryError: memory allocation failed" error. I was using the __init__.py structure. After trying to remove offending code from my library module (~10k) for days the problem persisted. Finally I split the module into two 5k modules and the situation resolved itself. Now I have a problem whereby my Testing module will download to the esp but the esp runs the previous version. The new script is definitely there because I have read it off the esp. My program has 13 files together amounting to 49k. I know I will be criticised for lack of specific code but there is just too much to upload. I might be doing something really silly here that someone may spot.

I am using Wemos D1 mini
Micropython v1.10-8-g8b7039d7d

On a hard reset I get:

Code: Select all

ets_post: task 31 queue full
ets_post: task 31 queue full
After importing via the __init__.py the first line of code
print (gc.mem_free())
gives me:
9904

Using the os.statvfs and a few lines of manipulation code I get 3.277Mb free

The response to sys.modules is:

Code: Select all

{'Globals.PCF8574': <module 'Globals.PCF8574'>,
 'Globals.MiscLib_02': <module 'Globals.MiscLib_02'>,
 'Demo': <module 'Demo'>,
 'Globals.lcd_api': <module 'Globals.lcd_api'>, 
 'onewire': <module 'onewire'>, 
 'Globals.DS18B20': <module 'Globals.DS18B20'>, 
 'Globals.WebServer': <module 'Globals.WebServer'>, 
 'Globals.MiscLib_01': <module 'Globals.MiscLib_01'>, 
 'Globals.esp8266_i2c_lcd': <module 'Globals.esp8266_i2c_lcd'>, 
 'Globals': <module 'Globals'>, 
 'flashbdev': <module 'flashbdev'>, 
 'Globals.Sound': <module 'Globals.Sound'>}
**Update**
I erased the esp, downloaded all of the files again and it now seems OK.
Previously print (gc.mem_free()) after all imports gave me 9904, I am now seeing 13488. It seems that many of the other modules download correctly as well but some other version of each was running. It's as if the esp accepted the script but never converted it into the current byte code or whatever it does. We'll see how long this lasts!

Is there any possibility that my constant development on this esp has wasted the flash assuming that I didn't have code that wrote to it incessantly. Has anyone ever worn down an esp through intensive development?
Last edited by pmulvey on Fri Apr 05, 2019 3:00 pm, edited 3 times in total.
Paul Mulvey

User avatar
dhylands
Posts: 3212
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: New script downloaded to board but old one still runs

Post by dhylands » Thu Apr 04, 2019 9:52 pm

If you created a frozen module, then that might be getting loaded instead of the internal one.

You can use help('modules') to see the list of internal modules.

When loading modules, micropython searches for them along the path specified in sys.path. So check that as well:

Code: Select all

>>> sys.path
['', '/lib', '/']
>>> 
The location of the empty string in the list is where it will check for internal modules.

Post Reply