Guarantee memory for the Flash File System?

I’m configuring a flash file system for the ConnectME. However, I need to verify that there is enough memory in flash to accomodate the file system size as defined in customize.ldr or at least figure out how much memory in flash is available (sectors that are free).

The problem is that I don’t think the GNU compiler or any other utility checks if image.bin exceeds the flash memory constraints, so the application image could possibly overwrite sectors assigned for the flash file system and even NVRAM.

Does anyone have a solution for determining the size of the application (“image.bin”) in flash or to guarantee that the amount specified for the file system is actually available in flash?

The best way to do this is to set limits on the image.bin size. This can be done by changing the MaxFileSize parameter in the bootldr.dat file. (The bootldr.dat file is located in the platform directory.)

For example, if you want to limit your image.bin to a size of 425943 bytes, then you would set the MaxFileSize parameter to 0x67fd8. (Note the value must be in hex format.)

Thanks for the prompt response. The boothdr utility does spit out an error if image.bin will exceed that max file size.

Do you know if the MaxFileSize value is provided for the application during runtime?

That’s a compile time check.

For run time checks, you can add anything you want to your application code. For instance, if you plan to upgrade over FTP, you can recieve a full image into RAM first, then check for size. Discard it if it gets too big.

Does that answer your question? Or did I miss your point?