How do I calculate how much flash memory remains?

My application is growing steadily and I’d like to know how close I am getting to limits. Debug.GC gives good information about RAM, but for flash memory I am confused. Deploying gives the following message:

Total: (14072 RAM - 125484 ROM - 61810 METADATA)

I assume FREE = TOTAL - (ROM + METADATA)

But what is the correct figure for TOTAL (on Usbizi)? I assume it is not the full 512KB.

From the FAQ

Add your pe files and that is the size

Thanks Gus and Rajesh, I see that I can work out how much flash I am using by adding up the sizes of the PE Assemblies that Visual Studio loads into the Usbizi chip. What I want to know is how much flash is still [italic]free[/italic]. To work that out, I need to know how much is available to Visual Studio once the firmware has been loaded (i.e. on a chip that has been freshly “erased” in MFDeploy).

Is the FAQ saying I have 100KB for my own PE assembly based on some reasonable assumptions of which GHI and Microsoft assemblies it references? It cannot be 100KB for ALL assemblies because Visual Studio reports it is already deploying considerably more than that.

My own assembly is reported as follows:

Assembly: FEZ Domino Application (1.0.0.0) (1280 RAM - 13048 ROM - 4309 METADATA)

But 15 other assemblies from Microsoft and GHI are also being deployed, which make up the rest of the total given in the OP.

The FAQ claims I am unlikely to run out of flash if I “manage to write the code properly”. I’d just like to be able to keep a running check on how I am doing against this (possibly quite demanding) standard!

I normally do not worry much about my app size because the available flash is plenty and will most likely be more than enough for your application.

There is 148KB of FLASH for your app. IF you add up all your PR files you will probably have 50KB

Wow - was not expecting a reply until Monday!

Actually, per OP Visual Studio did the adding for me and it comes to over 125KB. Because you keep telling me to, I added up the assemblies by hand and came to exactly the figure Visual Studio gave.

mscorlib, SPOT.Hardware and NETMF.W5100 together total more than 50KB.

But on your 148KB figure it looks like I will be just about OK since I now have all the library assemblies I need and there is still room to more than double the size of my own code.

I missed something, sorry :slight_smile:

Some assemblies are part of the firmware, like mscorelib, so you shouldn’t add it in your calculation.

Connect MFDeploy, attach, and reset the board. In the boot messages you will see “loading assembly” and “loading deployed assembly”. You only need to add the deployed ones.

I am curious on what you will have.

OK: mscorlib is the only “Attaching file” all the others are “Attaching deployed file”. The “total” I have been reporting includes 33,236B for mscorlib.

So the available ROM is 148KB + 33KB = 181KB.
And I have 181KB - 125KB = 56KB remaining.

(It is easier to do the calculation using the 181KB figure because then we can use the total from the report rather than having to add up all the deployed assemblies by hand).

Thanks Gus, I am reassured!