Size of deployed image reported by VS2010

Greetings,

I get the following message from VS2010 when I deploy my application to the USBizi module, running sdk 4.1 and firmware 1.6
My PC is an XP, with a real serial port, and we are using the USBizi serial port to debug with, as we require the USB client to access the SD card via PC

“Incrementally deploying assemblies to device
Deploying assemblies for a total size of 135148 bytes”

But if I count my PE files, they total 86k.

If my PE size gets any larger than 100k, my application will no longer deploy, I just get a message that says, "check your hardware"
and, then I won’t get the message from VS2010 indicating the size.

so, using PE file size: 86K+14k = 100K image which does not deploy.

using VS2010 reported size: 135148 + 14000= 149148 which is larger than the 148K of code space on the USBizi.

so, it appears that VS2010 is reporting the correct number,
but from reading the posts, I am supposed to add up all the PE files to calculate the size of the deployment.

can anyone explain why VS2010 will not deploy when my PE file size gets over 100k?
or why the VS2010 reports that my assemblies are 135k, but my PE size is 86k?

any insight is appreciated.

There are probably other PE files that are not in your output folder that VS will pull in when it is deploying and not copy them locally. When your application runs, you can see all DLLs showing in the output window.

Another possibility is that VS needs to set assemblies at a sector start and this causes fragmentation.

This may not be exactly correct because I didn’t load the same exact project you originally posted, but I think it will help you understand what Gus means by other Microsoft DLLs.

I loaded a similiar project to your code and checked the output window.
Its very instructive to watch this output windows as you can see what is being loaded into memory
Below is what is being loaded according to VS.

Assembly: mscorlib (4.1.2821.0) (3880 RAM - 33236 ROM - 19134 METADATA)
Assembly: Microsoft.SPOT.IO (4.1.2821.0) (740 RAM - 4620 ROM - 2522 METADATA)
Assembly: Microsoft.SPOT.Hardware (4.1.2821.0) (1752 RAM - 11440 ROM - 7371 METADATA)
Assembly: IDWedgeBT_N (1.0.0.0) (1848 RAM - 65260 ROM - 7656 METADATA)
Assembly: GHIElectronics.NETMF.Hardware.USBizi (4.1.6.0) (172 RAM - 304 ROM - 95 METADATA)
Assembly: System.Xml (4.1.2821.0) (724 RAM - 6544 ROM - 2413 METADATA)
Assembly: GHIElectronics.NETMF.USBClient (4.1.6.0) (916 RAM - 8640 ROM - 3196 METADATA)
Assembly: GHIElectronics.NETMF.IO (4.1.6.0) (212 RAM - 664 ROM - 289 METADATA)
Assembly: Microsoft.SPOT.Hardware.Usb (4.1.2821.0) (580 RAM - 3740 ROM - 1844 METADATA)
Assembly: FEZMini_GHIElectronics.NETMF.FEZ (4.1.6.0) (304 RAM - 896 ROM - 495 METADATA)
Assembly: Microsoft.SPOT.Native (4.1.2821.0) (1144 RAM - 6516 ROM - 4479 METADATA)
Assembly: System.IO (4.1.2821.0) (1548 RAM - 13292 ROM - 5862 METADATA)
Assembly: GHIElectronics.NETMF.Hardware (4.1.6.0) (1200 RAM - 7936 ROM - 4727 METADATA)
Assembly: Microsoft.SPOT.Hardware.SerialPort (4.1.2821.0) (508 RAM - 3440 ROM - 1527 METADATA)
Assembly: GHIElectronics.NETMF.System (4.1.6.0) (488 RAM - 2496 ROM - 1465 METADATA)

In your directory screen shot, you show all the PE files from GHIElectronics.NETMF. If you add them up, you get your total of 100K
But as Gus mentioned, you also need to include the Microsoft. files which are NOT shown in your project directory but shown (as indicated by Gus) in the output window.

IF I take the above list of assemblies and list just the microsoft DLLs, which again are NOT shown in the project directory (but in the output window during load), we see the following items are loaded into memory;

[ul]Assembly: mscorlib (4.1.2821.0) (3880 RAM - 33236 ROM - 19134 METADATA)
Assembly: Microsoft.SPOT.IO (4.1.2821.0) (740 RAM - 4620 ROM - 2522 METADATA)
Assembly: Microsoft.SPOT.Hardware (4.1.2821.0) (1752 RAM - 11440 ROM - 7371 METADATA)
Assembly: System.Xml (4.1.2821.0) (724 RAM - 6544 ROM - 2413 METADATA)
Assembly: Microsoft.SPOT.Hardware.Usb (4.1.2821.0) (580 RAM - 3740 ROM - 1844 METADATA)
Assembly: Microsoft.SPOT.Native (4.1.2821.0) (1144 RAM - 6516 ROM - 4479 METADATA)
Assembly: System.IO (4.1.2821.0) (1548 RAM - 13292 ROM - 5862 METADATA)
[/ul]

Doing some quick math, you can see include mscorlib in your project uses about 33K of Flash memory.
The XML code uses 6.5K of flash
Doing some quick math,
33236
4620
11440
6544
3740
6516
13292
3440

Total =- 82828

Now if you look at the very end of the VS output window shown during load, you’ll see
Total: (14036 RAM - 169024 ROM - 63075 METADATA)

Notice the ROM or Flash memory is actually 169024 or about 169K. If you take the Microsoft DLL assemblies, your main assembly and the GHI assemblies, you will get a total of 169K which is why you have reached the limit of device memory.

One interesting thing to note is including mscorlib uses about 33K or ROM. It uses up a bunch of memory!