In fact a quick examination of fis_init() suggests it does
erase after the end of the cfg/fis blocks.
Sure looks like it always erases all the way to the end in
the following snippet from fis_init()
482 // Lastly, anything at the end, if there is any
483 if ( erase_start < (((CYG_ADDRESS)flash_end)+1) ) {
484 erase_size = ((CYG_ADDRESS)flash_end - erase_start) + 1;
485 if ((stat = flash_erase((void *)erase_start, erase_size,
486 (void **)&err_addr)) != 0) {
487 diag_printf(" initialization failed at %p: %s\n",
488 err_addr, flash_errmsg(stat));
489 }
I need to look more closely at it, but I _think_ that simply
deleting the above code will prevent fis_init() from erasing
the area above the direcotry block, but that still won't
prevent other code such as fis_free() from using blocks above
the directory block, will it?
AFAICT, all of the fis code uses flash_end as the end of usable
flash. Setting CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK has no
effect on flash_end -- all it does is determine the location of
the directory block.
IMO, there needs to be a CYGNUM_REDBOOT_FLASH_RESERVED_TOP
value that is subtracted from flash_end they way
CYGNUM_REDBOOT_FLASH_RESERVED_BASE is added to flash_start.