joepasquariello
Well-known member
"FlasherX buffers the new code in flash by default, and automatically defines the largest possible flash buffer, from the top of existing code to the bottom of FLASH_RESERVE (settable in FlashTxx.h). "
I think what you're seeing is a consequence of changes that have been made to the Teensy bootloader. FlasherX determines the largest possible buffer by starting at the bottom of FLASH_RESERVE and then working downward until non-erased flash is found. In older versions of the bootloader, every firmware update caused the entire flash to be erased (except for space reserved for LITTLEFS and EEPROM). I can't remember why the change was made, but the latest bootloader erases less of the flash.
You could verify this is what is happening by doing the 15-second hold of the program button, which causes the entire flash to be erased and the built-in blink program to be loaded. After that, reload your application and see if it reports a larger available buffer.
Paul just wrote a post a few days ago about the logic for how much flash is erased on a given upload. I'm going to have to think about how FlasherX could be modified to accommodate the new logic. One thing to know, though, is that if start with a completely erased T4.1, install your sketch with Teensy bootloader, and thereafter do updates only via FlasherX, the buffering will work correctly because FlasherX erases the buffer after it does the update.
Another thing you could try is setting FLASH_RESERVE to a larger value, such as (256*FLASH_SECTOR_SIZE). You might find that there is enough erased flash below that address to do the update.
@Paul, if you can point me to your recent post on the topic of erasing flash, I would appreciate it.