You may have seen comments in here from Richard Burton about his bootloader. Well, I have to tell you – what a game-changer. If you look at a previous blog where I showed you how we’d moved code from the fairly normal 0x40000 starting point down to 0x20000 – freeing up LOADS of space for more FLASH code. Well Richard helped with that but he also suggested I give his bootloader a shot. This weekend after clearing out my many other jobs, I decided to get in touch with him. He pointed me to the source of his bootloader and with a minor tweak to my Windows PATH I managed to get MAKE to work in a DOS box so I could compile it – the upshot of that was a small bootloader .BIN file.
I’m still no use with Makefiles but I managed to generate the .bin file and Richard updated my Makefile. The result.. astounding.
What you see above – the left 2 columns represent the very original code I used with TuanPM’s MQTT as the base. In the middle one I’d moved non-volatile storage up to the top of available FLASH space (which applies to most of the current crop of boards from ESP-01 upwards) and moved the start of code all the way down to 0x10000 giving a massive amount of room for development – unlike the original case where I was running out.
Well, now with the bootloader you can see that virtually the whole LOT is available for programs! No extra cost, no extra work – just getting it right. I’m also now using the non-volatile storage routines in the SDK itself rather than the ones that TuanPM made (pointless having the same code twice). Right now my code (all in including the SDK) finishes at 0x54c00 – not much more than half way up – and that’s in an ESP-01 – the ESP-12 potentially has WAY more FLASH available. All of this is running with Espressif SDK 1.11
All that is needed now is a bit of careful thought as to how to best use the FLASH… there is still a good amount of RAM used up and I suspect that large routines in FLASH will just make matters worse – on the assumption that the whole routine gets pulled out into RAM to be used, I’m think it might better to split large routines up into smaller ones so that RAM can more readily be re-used. Time will tell whether that theory is sensible or a load of old codswallop.
This opens up some possibilities for large FLASH-based lookup tables for light shows – which brings me to the realisation I haven’t a clue how to make good use of that without pulling the lot into RAM – oh, well a challenge for another day. My thanks to Richard and lest we forget – here’s the link to his article on his bootloader.. http://richard.burtons.org/2015/05/18/rboot-a-new-boot-loader-for-esp8266/