IDE v1.0.6 vs IDE v1.8.9 Verify/Compile

Forum for posting topics and questions about anything.
Post Reply
RetroBoy
Posts: 64
Joined: Sat Feb 26, 2022 11:29 am
Location: U.K.

IDE v1.0.6 vs IDE v1.8.9 Verify/Compile

Post by RetroBoy » Fri Aug 05, 2022 6:14 pm

Hi Andrew,

I need help to understand what I am getting when I Verify/Compile the same 'Code' using different versions of IDE.

i)
IDE v1.0.6

Binary sketch size: 25,242 bytes (of a 30,720 byte maximum)
ii)
IDE v1.8.9

Sketch uses 20718 bytes (67%) of program storage space. Maximum is 30720 bytes.
Global variables use 1393 bytes (68%) of dynamic memory, leaving 655 bytes for local variables. Maximum is 2048 bytes.
Even if I add the Global Variables reported in v1.8.9 onto the Sketch Size I still do not get the same TOTAL BYTES that v1.0.6 reports. In any case that is a saving of 4524 bytes ( approx 15% ), which with the size of 'prog' I will have is a big saving.

So ;
Q1 - WHY? - Does v1.8.9 use 'Compression' or a different Compiler?

My next question may just be something I am simply missing somewhere in 'my' Logic.

As you know I use/attach a separate file to my sketch 'Own_Data.h'. When I Verify/Compile with v1.0.6 the file gets 'included'. When I verify/Compile with v1.8.9 my file is IGNORED - I know this as the sketch will not run/display info that it should. I will add there is no '.cpp' file to my own .h file, as all the work is done in the .h file.

So:
Q2 - Does any IDE after v1.0.6 rely on .cpp file to get included ( eg #include "foo.h" -> foo.cpp )?

Regards S.

andrew
Site Admin
Posts: 1276
Joined: Sun Aug 05, 2012 4:15 pm

Re: IDE v1.0.6 vs IDE v1.8.9 Verify/Compile

Post by andrew » Sun Aug 07, 2022 8:34 am

Q1 - WHY? - Does v1.8.9 use 'Compression' or a different Compiler?

Optimisation is a better way to describe it. During the compilation process the compiler (well optimiser) will look at your code and attempt to remove any code that it thinks is not being used. For example look at this bit of code:

  1. data = 1;
  2. data = 2;
  3. Serial.println(data);
  4.  
  5. void foo(void)
  6. {
  7.   Serial.println(“Hello”);
  8. }


The optimiser will see that the first line and the function foo() aren't doing anything and so will remove them from your code before compiling it. It’s the same with any libraries you include in your sketch. If there are any functions within the library you’re not using, the optimiser will automatically remove them before compiling the sketch. So it’s probably just the case that the newer version is just better at optimising your code.

As you know I use/attach a separate file to my sketch 'Own_Data.h'. When I Verify/Compile with v1.0.6 the file gets 'included'. When I verify/Compile with v1.8.9 my file is IGNORED

Are you sure about this? If you’re referencing anything in your .h file from your sketch and the compiler isn’t including the file then it should definitely generate error(s). Try changing the name of something in your .h file that your sketch references and see if it generates an error when you compile it.

Q2 - Does any IDE after v1.0.6 rely on .cpp file to get included ( eg #include "foo.h" -> foo.cpp

No, you don’t need a .cpp file for a .h file.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Post Reply

Return to “General Discussion”