Continuing my exploration of building a bootloader, I realise that my understanding of how RAM is managed is still a bit off. (Warning, probably a stupid question - they're my main area of expertise).
My intention is to write a really simple BL that will read an image from an SD card and write that into the flash of my MCU (eventually my second favourite one - ATmega1284P, but currently a 328 (4th favourite) for testing).
Both controllers have enough RAM to suck down a whole page from the SD card at a time, so no reason not to. Once I JMP to the freshly programmed firmware, presumably that chunk of RAM is now full of 'garbage'.
Is it enough to use malloc() and free() in my bootloader to allocate the read buffer to ensure that the RAM is then freed? Does the 'main' program even care that the bootloader allocated some RAM? I wasn't sure what actually tracks it all!