• AVR Freaks

Helpful ReplyHot!SOLVED: Very different compiled program sizes on Win 10 vs Win 7

Author
cooljustin
Starting Member
  • Total Posts : 52
  • Reward points : 0
  • Joined: 2010/11/13 00:32:55
  • Location: 0
  • Status: offline
2020/01/26 16:47:02 (permalink)
0

SOLVED: Very different compiled program sizes on Win 10 vs Win 7

 
My sincere thanks to all the smart people who have a clue about this stuff.
 
I am migrating to a Windows 10 computer (finally) since Windows 7 support is stopping.
 
I installed the same last C30 compiler (v.3.31) and the same old MPLABX (v.2.15) that I used for many years on my Windows 7 computer onto the new Windows 10 computer.
 
When I compile my same code in MPLABx, using the same gcc options (large code model, large data model, optimization=3), in Windows 10 I get a program size of 67% (of a 256k dspic33fj256gp710a).  In Windows 7, it was 39%.  A HUGE difference!
 
For optimization=0 and optimization=1, the code sizes are identical between Windows 7 and Windows 10 setups.  Only optimization=2 and optimization=3 are vastly different.
 
I am running in "full evaluation" mode of C30 on Windows 10, so it shouldn't be any kind of license limitation (and it doesn't throw any error message as such).
 
The output looks identical (i.e. the "switches" are all the same).
 
I am pulling my hair out because I've checked everything I can check repeatedly and I just can't get optimization=3 to work properly on Windows 10.
 
Very, very appreciative of any pointers anyone cares to throw my way!!!
 
Thanks so much!
post edited by cooljustin - 2020/02/02 11:37:35
#1
cooljustin
Starting Member
  • Total Posts : 52
  • Reward points : 0
  • Joined: 2010/11/13 00:32:55
  • Location: 0
  • Status: offline
Re: Completely different compiled program sizes on Win 10 vs Win 7. Desperate, please hel 2020/01/26 16:53:37 (permalink)
0
Just for fun, I also tried the latest version of MPLAB X, with the same results. :(
 
#2
LdB_ECM
Super Member
  • Total Posts : 229
  • Reward points : 0
  • Joined: 2019/04/16 22:01:25
  • Location: 0
  • Status: offline
Re: Completely different compiled program sizes on Win 10 vs Win 7. Desperate, please hel 2020/01/26 20:45:09 (permalink)
0
On the windows 10 machine on the program launch icon right click and go to properties->compatability click the run box and go back to the earliest version of windows it will allow (probably Vista) and see what happens.
#3
cooljustin
Starting Member
  • Total Posts : 52
  • Reward points : 0
  • Joined: 2010/11/13 00:32:55
  • Location: 0
  • Status: offline
Re: Completely different compiled program sizes on Win 10 vs Win 7. Desperate, please hel 2020/01/27 07:02:39 (permalink)
+1 (1)
LdB_ECM
On the windows 10 machine on the program launch icon right click and go to properties->compatability click the run box and go back to the earliest version of windows it will allow (probably Vista) and see what happens.


Thanks much, Ldb_ECM!
 
Yes, I had already tried running both MPLAB X and the gcc executable in Windows 7 compatibility mode. 
 
I tried changing the compatibility mode all the way back to Windows XP but I get the exact same results, unfortunately.
 
Any other ideas you can think of, please?
#4
crosland
Super Member
  • Total Posts : 1769
  • Reward points : 0
  • Joined: 2005/05/10 10:55:05
  • Location: Warks, UK
  • Status: online
Re: Completely different compiled program sizes on Win 10 vs Win 7. Desperate, please hel 2020/01/27 07:21:56 (permalink)
+1 (1)
Have you checked the compiler output very carefully for any messages to say that -O2 and -O3 are not actually being applied on the new system?
 
Check the compiler command line being used on both systems.
 
Compare the compiler output from the two environments line-by-line. 
 
Look at the list and map files. Is it actually compiling the same code to the same addresses?
 
Any conditional code? Check what defines you have set on the command line.
#5
rodims
Super Member
  • Total Posts : 1538
  • Reward points : 0
  • Joined: 2009/02/10 11:08:59
  • Location: 51.9627, 7.6262
  • Status: online
Re: Completely different compiled program sizes on Win 10 vs Win 7. Desperate, please hel 2020/01/27 07:57:57 (permalink)
0
I installed the same last C30 compiler (v.3.31) and the same old MPLABX (v.2.15) that I used for many years on my Windows 7 computer onto the new Windows 10 computer.
 
...
 
For optimization=0 and optimization=1, the code sizes are identical between Windows 7 and Windows 10 setups.  Only optimization=2 and optimization=3 are vastly different.
 
I am running in "full evaluation" mode of C30 on Windows 10, so it shouldn't be any kind of license limitation (and it doesn't throw any error message as such).


I also would first check the topics proposed by crosland.
Just from your description I would not assume that it has to do with Windows 7 and Windows 10. More likely it could be related to the fact that you have two different PCs / Operating systems / installations and the licensing (required for optimization 2 and 3) does not work as expected.
"Full evaluation" mode of C30 for me sounds like a special version downloaded from Microchip. Did you try to install/activate your full license on the Windows 10 computer as you did for Windows 7 ?
What does the license manager say (pic30-lm.exe) ...
 
[edit: do NOT post the license key number !]
post edited by rodims - 2020/01/27 08:05:35
#6
cooljustin
Starting Member
  • Total Posts : 52
  • Reward points : 0
  • Joined: 2010/11/13 00:32:55
  • Location: 0
  • Status: offline
Re: Completely different compiled program sizes on Win 10 vs Win 7. Desperate, please hel 2020/01/27 08:15:01 (permalink)
+1 (1)
Thanks very much, crosland and rodims!
 
I checked the output with a diff program very carefully.  -O3 is definitely being called correctly.  You can tell a change is being made as the program size with -O3 on the Windows 10 machine is actually way bigger than -O0 or -O1.  There are no other output differences between the Win10 and Win7 machines.
 
@rodims I agree, it "feels" like it is a license issue (particularly since -O0 and -O1 are identical), but not sure how to resolve it.  
 
My old license was from when I was in school, it is an academic license (it was so long ago, I don't know how I did it).  The new license is a demo. 
 
LM says: "This demo-version license for MPLAB C for dsPIC devices, has 59 days remaining after today."
 
I don't suppose there's a way to get an academic license just to test if this is the issue?
 
In the meantime, I will continue to look at crosland's suggestions.  I'm not an expert at compilers, so will take me awhile.  
 
Any other suggestions are very welcome!
#7
marcov
Super Member
  • Total Posts : 258
  • Reward points : 0
  • Joined: 2006/10/08 01:59:40
  • Location: Eindhoven, NL.
  • Status: offline
Re: Completely different compiled program sizes on Win 10 vs Win 7. Desperate, please hel 2020/01/27 10:35:41 (permalink)
0
Why it is different, I don't know, but depending on optimization settings (for size or for speed) higher optimizations can be larger, e.g. due to loop unrolling
#8
Antipodean
Super Member
  • Total Posts : 1802
  • Reward points : 0
  • Joined: 2008/12/09 10:19:08
  • Location: Didcot, United Kingdom
  • Status: offline
Re: $100 REWARD for help that solves: Very different compiled program sizes on Win 10 vs W 2020/01/27 10:37:41 (permalink)
+2 (2)
cooljustin
When I compile my same code in MPLABx, using the same gcc options (large code model, large data model, optimization=3), in Windows 10 I get a program size of 67% (of a 256k dspic33fj256gp710a).  In Windows 7, it was 39%.  A HUGE difference!
 
For optimization=0 and optimization=1, the code sizes are identical between Windows 7 and Windows 10 setups.  Only optimization=2 and optimization=3 are vastly different.
 
I am running in "full evaluation" mode of C30 on Windows 10, so it shouldn't be any kind of license limitation (and it doesn't throw any error message as such).
 

 
I bet it IS a licensing issue. The compiler will have a serial number and will have "phoned home" when originally installed on the Win7 machine. It will have "phoned home" again when installed on the Win10 machine and will have found that it was previously installed and so the O3 option os not actually enabled, whatever the log file says.
 

Do not use my alias in your message body when replying, your message will disappear ...

Alan
#9
Jim Nickerson
User 452
  • Total Posts : 6463
  • Reward points : 0
  • Joined: 2003/11/07 12:35:10
  • Location: San Diego, CA
  • Status: offline
Re: $100 REWARD for help that solves: Very different compiled program sizes on Win 10 vs W 2020/01/27 11:07:56 (permalink)
0
I seem to remember you could install/license a compiler on 3 machines.
When one of the machines no longer existed ( BROKE ) you could contact SW Licensing to get the number of license copies adjusted.
edit: add screen shot

 
post edited by Jim Nickerson - 2020/01/27 11:13:37

Attached Image(s)

#10
dan1138
Super Member
  • Total Posts : 3333
  • Reward points : 0
  • Joined: 2007/02/21 23:04:16
  • Location: 0
  • Status: offline
Re: Completely different compiled program sizes on Win 10 vs Win 7. Desperate, please hel 2020/01/27 13:54:56 (permalink) ☄ Helpfulby cooljustin 2020/01/30 11:11:22
+4 (4)
With regards to Jim Nickerson, Antïpodean, et all.

The Original Poster has issues with getting C30 v3.31 running in Windows 10.

What the OP does not know is that Microchip's shipped C30 v3.31 with a bug in the pic30-lm.exe file.

This bug prevents any installation of C30 from actually running at higher optimizations.

Another thing is that to get C30 to run fully licensed all you need is the serial number that came PRINTED on the original distribution package. The serial number looks like: MTInnnnnnnnn where the 'n' are decimal digits.

To upgrade an existing demo version to the full version without having to reinstall invoke:

pic30-lm.exe -uMTInnnnnnnnn

The pic30-lm.exe utility may be found in the 'bin' subdirectory of the MPLAB C30 installation directory.


I believe the solution to getting a licensed version of Microchip C30 v3.31 going on windows10 are:
  1. Update the pic30-lm.exe file.
  2. Find the original serial number.
  3. Manually install it using the above instructions.

Attached is a ZIP archive with the updated pic30-lm.exe file for C30 v3.31.
post edited by dan1138 - 2020/01/27 17:36:29
#11
dan1138
Super Member
  • Total Posts : 3333
  • Reward points : 0
  • Joined: 2007/02/21 23:04:16
  • Location: 0
  • Status: offline
Re: Completely different compiled program sizes on Win 10 vs Win 7. Desperate, please hel 2020/01/29 17:06:56 (permalink)
+5 (5)
I wonder if cooljustin has C30 v3.31 working now?
 
If my suggestions helped I do not want any payment, just a note to say if it's working or not.
#12
rodims
Super Member
  • Total Posts : 1538
  • Reward points : 0
  • Joined: 2009/02/10 11:08:59
  • Location: 51.9627, 7.6262
  • Status: online
Re: Completely different compiled program sizes on Win 10 vs Win 7. Desperate, please hel 2020/01/30 10:48:30 (permalink)
0
My old license was from when I was in school, it is an academic license (it was so long ago, I don't know how I did it).  The new license is a demo.

From his explanation I would conclude he does not have a license key (anymore).
#13
cooljustin
Starting Member
  • Total Posts : 52
  • Reward points : 0
  • Joined: 2010/11/13 00:32:55
  • Location: 0
  • Status: offline
Re: Completely different compiled program sizes on Win 10 vs Win 7. Desperate, please hel 2020/01/30 11:06:07 (permalink)
0
Hey guys,
 
Sorry about the delay in responding.  I did indeed get it working. I'm very appreciative of everyone who responded!
 
I racked my brain trying to remember how I installed v.3.31 from the earlier academic license version.  It turns out that I had saved that v.3.24 version that had the academic license built in.  I installed it, then just simply ran the 3.31 installer, and it upgraded the compiler but maintained the academic license.
 
Although I haven't verified this, it does seem that although the license manager reported a full demo license was applied (even counting down the 60 days), it does not seem to be the case that the compiler actually compiled -O2 and -O3 as if it was a "full demo" license.  So dan1138 may be correct in that the license manager is broken in this release.
 
However, it really was everyone who contributed to this thread that lead me to thinking about how it was likely a licensing issue, making me reconstruct how I originally installed v.3.31 many years ago.
 
So, I think the fair thing to do is divide up the reward amongst you all!  I count 7 people, so that's $14.28 a person.
 
Just PM your Paypal or Venmo ID (be sure to state which one you're sending) and I will send it to you! :)
 
Many thanks for everyone's help!
#14
Jim Nickerson
User 452
  • Total Posts : 6463
  • Reward points : 0
  • Joined: 2003/11/07 12:35:10
  • Location: San Diego, CA
  • Status: offline
Re: Completely different compiled program sizes on Win 10 vs Win 7. Desperate, please hel 2020/01/30 11:07:59 (permalink)
+4 (4)
I would like my share to go to the Australian fire support please.
#15
crosland
Super Member
  • Total Posts : 1769
  • Reward points : 0
  • Joined: 2005/05/10 10:55:05
  • Location: Warks, UK
  • Status: online
Re: Completely different compiled program sizes on Win 10 vs Win 7. Desperate, please hel 2020/01/30 11:11:39 (permalink)
+4 (4)
Give mine to your local cat rehoming centre :)
#16
cooljustin
Starting Member
  • Total Posts : 52
  • Reward points : 0
  • Joined: 2010/11/13 00:32:55
  • Location: 0
  • Status: offline
Re: Completely different compiled program sizes on Win 10 vs Win 7. Desperate, please hel 2020/01/30 11:11:53 (permalink)
+2 (4)
JANickerson
I would like my share to go to the Australian fire support please.


You got it, Jim.
#17
cooljustin
Starting Member
  • Total Posts : 52
  • Reward points : 0
  • Joined: 2010/11/13 00:32:55
  • Location: 0
  • Status: offline
Re: Completely different compiled program sizes on Win 10 vs Win 7. Desperate, please hel 2020/01/30 11:12:34 (permalink)
+1 (1)
crosland
Give mine to your local cat rehoming centre :)


I already volunteer for our local shelter, and would be happy to donate on your behalf, crosland.  Thanks!
#18
nigelwright7557
Super Member
  • Total Posts : 342
  • Reward points : 0
  • Joined: 2006/11/06 08:15:51
  • Location: 0
  • Status: offline
Re: Completely different compiled program sizes on Win 10 vs Win 7. Desperate, please hel 2020/01/30 12:06:27 (permalink)
0
Sounds like optimisation isnt working on new machine.
Does your new pc have a compiler license for opt=3 ?
I suspect it doesnt hence poor results.
 
 
#19
crosland
Super Member
  • Total Posts : 1769
  • Reward points : 0
  • Joined: 2005/05/10 10:55:05
  • Location: Warks, UK
  • Status: online
Re: Completely different compiled program sizes on Win 10 vs Win 7. Desperate, please hel 2020/02/01 02:47:31 (permalink)
0
nigelwright7557
Sounds like optimisation isnt working on new machine.
Does your new pc have a compiler license for opt=3 ?
I suspect it doesnt hence poor results.

Late entries don't count.
#20
Jump to:
© 2020 APG vNext Commercial Version 4.5