Same program, different compiled prog memory size

I have three pc's, one with W10, two with W7. The same program compiles with program memory size being different on each.

Program memory used:

  1. W10, Arduino IDE 1.8.19, Uno boards definition 1.8.5: 32352 bytes
  2. W7, Arduino IDE 1.8.13, Uno boards def 1.8.5: 32268 bytes
  3. W7, Arduino IDE 1.8.19, Uno board def 1.8.5: 32234 bytes

Max: 32256 bytes (Uno processor Atmega328 with optiboot.
All three pc's have new installs of the IDE.

Why are there different end results for the compiled program; the program in each case is identical.

The answer is obvious - different OS, different IDE versions, different libraries

The maximum difference between sizes is smaller than 0.5% of full volume...what are tiny variations. This is absolutely normal...

1 Like

All three computers use exactly the same libaries.

Changing the IDE version from 1.8.19 to 1.8.13 on the first computer in my OP the compile results on that computer are exactly the same, and same libraries/locations are used.

Different Windows operating system (W7 vs W10): how does this affect the functioning of an identical compiler?

It may not seem much, but in some instances this may matter. How then are these differences in compiled program size explained?

same library versions?

i agree that the PC OS is irrelevant, but different IDE's may have somewhat different base code.

you could try using nm, under hardware/tools/avr/bin/ on the .elf files to see which addresses changed

Yes, same library versions, same contents, same locations.

nm: I will try although this is a bit above my competence for now :slight_smile:

Why worry???

i'm curious

you should always be able to exactly reproduce a binary from the same source code. consider trying to debug a customer problem when the customer is using an earlier release of software.

1 Like

@gcjr : that is exactly what drives my question :slight_smile:

I don't consider it possible because two PC never be the same, and never has the same software configuration.
I build a big project on two very similar computers with the same versions IDE and libraries. I very rarely get the same firmware size on two computers

but this isn't code compiled to run on the PC.

you wouldn't used the Arduino avr-gcc to compile code on the PC, you would use the gcc compiler for the PC

1 Like

just to follow up how important this can be

i worked on a network processor (NP) controlled by a vxWorks application. vxWorks distributed a binary for the NP. the NP had 16 channels each with tx/rx bit/byte processors and a risc processor. 80+ processors, at least 5 separate binaries, one for each processor type

we routinely veriied checksums for each binary to make sure we weren't inadvertently changing something we didn't intend to.

often system test would report a problem. we'd ask which version and they were often unsure, the file sizes hadn't changed. being able to check checksums, we could easily identified that they weren't using the correct binaries.

we couldn't reproduce the binary distributed by vxWorks based on the version of source code the reported it was from.

after convincing them we knew what we were talking about, the provided source, which was modified from the version they reported the binary was for.

we reproduced the checksums for all but one of the bit processors and were satisfied that we has the source to work from

i feel that without being able to do this, we would have spent months trying to reproduce their results. instead it just took a couple weeks

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.