- Mon Mar 30, 2015 9:56 pm
#13079
The way I would love to see this work is something like this:
user1.bin and user2.bin are completely different programs
user1.bin fits completely in iram. All it does is download user2.bin and flash it. Since it is loaded in iram at startup, it can overwrite itself.
when user1.bin finishes, it reboots into the new code (not an OTA reboot... just a standard one).
now basically the entire space is available for code and html.
There are several impediments to this goal.
My lack of knowledge around linker scripts.
Can we actually fit all the necessary espconn_* symbols, lwip, etc. along with any flash functions and other necessary symbols from the sdk in 64k of iram? I'm not 100% sure how that 64k works - is it 32k loaded at boot and another 32k paged in as needed, or is it 64k available at boot time and there's another 32k available as cached flash?
Can we even identify all the necessary symbols in the closed source sdk? Of course, the answer is yes, but is this something we can readily parse or will we have to slog through tons of assembly to find them?
If that is feasible, can we pick and choose only the symbols we need, or would we be stuck linking in a whole library.a file or none of it anyway?
Does the reverse engineered stage 1 bootloader actually compile and work, or would we basically have to write our own bootloader? (we may not need one, or it may be nothing but a single jump / function call).
So, given all those difficulties and the lack of free time that comes with a 10-month-old baby, I'd be completely happy with something that basically acts like the built-in OTA system. I've got one of the fancy 4 MByte versions of ESP-12 from ebay, so I'll want to use the first 1MB for code (two sections of almost 512KB), and the other 3 MB for the file system. But just thought I'd throw this idea out there in case someone with more time than me wants to run with it
P.S. Weren't they supposed to be adding an API to jump to any address after OTA reboot in bootv1.3? If so, that might get us most of the way there... at least to the point of having asymmetric bin files and having a small version for the "download-only" code and a large version for the real application.
EDIT: Yes, it looks like they did... just noticed the system_restart_enhance function that lets you reboot and run code from any location. This could let you tweak the build even more to squeeze in more room for code or files, whichever you need more of.
Last edited by dpwhittaker on Mon Mar 30, 2015 11:26 pm, edited 1 time in total.