What is the right way to find out what parts of the FLASH are free for use by the application?
At this moment I understand that image.bin (the compressed format of the application) is located at the start of the flash and the latest sector is recerved for the NVRAM settings.
See the attached Memory Map. You’ll want to either use the flash filesystem if you have something more than a few KB to write. Keep in mind that NVRAM stores the devBoardParamsType structure at the start of the last sector of flash.
I compiled your “Flash Memory Sample” example application which tells, that flash will start from the address of 0x2000000, but the PDF document you gave shows that it starts from 0x50000000.