• AVR Freaks

Helpful ReplyHot!GCC Build

Author
Brek
Starting Member
  • Total Posts : 45
  • Reward points : 0
  • Joined: 2016/08/29 19:11:39
  • Location: 0
  • Status: offline
2018/05/01 06:59:17 (permalink)
1 (1)

GCC Build

Hello,
I am wondering if there is any clear instruction on how to build GCC directly from sources provided with XC16/XC32 compilers?
Has anyone actually done so?
I’m not much for Linux experience, but it occurs to me that if it were easy to build from provided scripts as it ought to be,
then the commercial versions of XC16/XC32 would hardly sell. It should be worth $1000 to build from source yourself.
 
If it is not so easy, then how is that compliant with the GNU GCC compiler collection end user license?
Or is there some details I’m not aware of that require some special machine to make this possible?
Cheers, Brek.
 
 
#1
Jim Nickerson
User 452
  • Total Posts : 6257
  • Reward points : 0
  • Joined: 2003/11/07 12:35:10
  • Location: San Diego, CA
  • Status: offline
Re: GCC Build 2018/05/01 10:14:53 (permalink)
-1 (1)
I do not think the "Microchip added enhancements/ optimizations components " are included in the published sources.
I seem to recall seeing instructions for building the published sources your self.
[Edit:] andersm has pointed out my error in misusing the language and causing some misunderstanding
post edited by Jim Nickerson - 2018/05/01 11:43:37
#2
andersm
Super Member
  • Total Posts : 2651
  • Reward points : 0
  • Joined: 2012/10/07 14:57:44
  • Location: 0
  • Status: online
Re: GCC Build 2018/05/01 10:57:44 (permalink)
0 (2)
JANickersonI do not think the "Microchip added enhancements/ optimizations " are included in the published sources.

They are. Leaving them out would be a flagrant violation of the GPL. However, the XC16/XC32 distributions include components that are not covered by open-source licenses, and are not in of the source releases.
#3
btbass
Super Member
  • Total Posts : 359
  • Reward points : 0
  • Joined: 2004/12/10 13:50:32
  • Status: offline
Re: GCC Build 2018/05/01 11:10:36 (permalink)
-2 (2)
Interesting discussion on this subject here:
https://www.eevblog.com/f...msg1007099/#msg1007099

Extract Quote:
You can easily patch the GCC compiler without doing anything illegal (because we only alter a GPL licensed binary):

- save the hash: sha256sum /opt/microchip/xc32/v1.42/bin/xclm

- backup /opt/microchip/xc32/v1.42/bin/xclm

- compile a new "xclm" binary using the following C code:

Code: [Select]
int main(void)
{
  return 6;
}

and copy it to /opt/microchip/xc32/v1.42/bin/

- save also the hash of the new binary: sha256sum /opt/microchip/xc32/v1.42/bin/xclm

- backup /opt/microchip/xc32/v1.42/bin/bin/gcc/pic32mx/4.8.3/cc1

- open /opt/microchip/xc32/v1.42/bin/bin/gcc/pic32mx/4.8.3/cc1 with a hexeditor and
  replace the three occurrences of the old hash with the new hash.

That's it. Works fine here with all optimization settings.

#4
jdeguire
Super Member
  • Total Posts : 473
  • Reward points : 0
  • Joined: 2012/01/13 07:48:44
  • Location: United States
  • Status: offline
Re: GCC Build 2018/05/01 11:27:40 (permalink)
+1 (1)
https://github.com/chipKIT32/chipKIT-cxx-build
 
This builds the ChipKIT version of the compiler, which is very similar to XC32.  The differences are that ChipKIT32 uses Newlib instead of whatever libraries XC32 uses for C.  It does not build C++ by default, but the script can be modified to do that.  In that case, you'll get the GNU libstdc++ instead of the Dinkumware libs that come with XC32.  Note that ChipKIT32 still uses v1.43 of the compiler sources.
 
In my experience, XC32 generates smaller code than ChipKIT at the same optimization levels (about a 10-15% difference).  The toolchain sources are very similar, so XC32 might just come with more optimized libraries.
#5
cvm
Super Member
  • Total Posts : 293
  • Reward points : 0
  • Joined: 2011/09/16 05:16:15
  • Location: 0
  • Status: offline
Re: GCC Build 2018/05/02 21:18:31 (permalink)
0
Interesting discussion on this subject here

something better-
github . com / cv007 / XC3216
#6
JPortici
Super Member
  • Total Posts : 768
  • Reward points : 0
  • Joined: 2012/11/17 06:27:45
  • Location: Grappaland
  • Status: online
Re: GCC Build 2018/05/03 01:28:47 (permalink)
#7
Brek
Starting Member
  • Total Posts : 45
  • Reward points : 0
  • Joined: 2016/08/29 19:11:39
  • Location: 0
  • Status: offline
Re: GCC Build 2018/05/03 09:54:47 (permalink)
-2 (2)
It occurs to me that the company lacks integrity, and the way to respond with integrity is to discontinue use of the product.
#8
Jim Nickerson
User 452
  • Total Posts : 6257
  • Reward points : 0
  • Joined: 2003/11/07 12:35:10
  • Location: San Diego, CA
  • Status: offline
Re: GCC Build 2018/05/03 10:02:57 (permalink)
0
Brek
It occurs to me that the company lacks integrity, and the way to respond with integrity is to discontinue use of the product.


And which "company" are you referring to ?


#9
du00000001
Just Some Member
  • Total Posts : 3052
  • Reward points : 0
  • Joined: 2016/05/03 13:52:42
  • Location: Germany
  • Status: offline
Re: GCC Build 2018/05/03 10:09:44 (permalink)
0 (2)
Microchip has great microcontrollers (emphasis on micro) and one should be able to live with the XC-somethings. For most of my projects the free mode is sufficient, thus the tools are for free.
Programming "bare metal", I can easily wring more out of these micros than e.g. out of some 'duino (as these come with some "penalties" - due to their - otherwise quite nice - "ecosystem").

PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
#10
Brek
Starting Member
  • Total Posts : 45
  • Reward points : 0
  • Joined: 2016/08/29 19:11:39
  • Location: 0
  • Status: offline
Re: GCC Build 2018/05/03 10:11:39 (permalink)
-3 (3)
“occurs to me” meaning my current understanding of information that has been presented.
“the company” might as well mean any company that would take software intended by it’s authors to be free,
restrict access to it’s features, and then charge for those features in their own distribution of the software.
 
 
#11
du00000001
Just Some Member
  • Total Posts : 3052
  • Reward points : 0
  • Joined: 2016/05/03 13:52:42
  • Location: Germany
  • Status: offline
Re: GCC Build 2018/05/03 10:16:26 (permalink)
0 (2)
"Charging" is covered by the GPL.

Microchip put some effort and money into these compilers (consider e.g. the controller definition headers, the Dinkumware libs are not for free as well!), and the price tag is not that exorbitant. But you're clearly free to use whatever compiler you like...

PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
#12
Jim Nickerson
User 452
  • Total Posts : 6257
  • Reward points : 0
  • Joined: 2003/11/07 12:35:10
  • Location: San Diego, CA
  • Status: offline
Re: GCC Build 2018/05/03 11:00:43 (permalink)
-1 (1)
Brek
It occurs to me that the company lacks integrity, and the way to respond with integrity is to discontinue use of the product.
....
“occurs to me” meaning my current understanding of information that has been presented.
“the company” might as well mean any company that would take software intended by it’s authors to be free,
restrict access to it’s features, and then charge for those features in their own distribution of the software.
 

I wonder if you are:
A hobbyist making microprocessor things for the pure enjoyment of seeing things work ?
Making money from the things you have written software for ( employed by some company to write software or build hardware ) ?
A lawyer or formally educated in the law ? 
#13
Mysil
Super Member
  • Total Posts : 3349
  • Reward points : 0
  • Joined: 2012/07/01 04:19:50
  • Location: Norway
  • Status: online
Re: GCC Build 2018/05/03 13:04:42 (permalink)
-1 (1)
Hi Brek,
For instruction in how to tailor and build GCC, you should study GCC documentation and build environment.
 
There is a lot of stuff installed together with the compiler, in addition to the compiler itself.
In particular all the Device support header files, and linker scripts, that are tailored for peripherals and registers in every individual device type.
In addition to tailored optimization, a lot of the money paid for commercial licences for XC compilers, go into the Support contract that is part of the license agreement.
 
I am a cheap hobbyist, and are mostly satisfied with the free version of the compilers.
When dealing with peripherals in real-time, there are restrictions on what optimizations the compiler may perform anyway, so optimization level 1 that is available for free is the most important.
 
    Mysil
#14
Brek
Starting Member
  • Total Posts : 45
  • Reward points : 0
  • Joined: 2016/08/29 19:11:39
  • Location: 0
  • Status: offline
Re: GCC Build 2018/05/03 17:51:25 (permalink)
-1 (1)

I wonder if you are:
A hobbyist making microprocessor things for the pure enjoyment of seeing things work ?
Making money from the things you have written software for ( employed by some company to write software or build hardware ) ?
A lawyer or formally educated in the law ? 

I fail to see the relevance, but I’m a hobby electronics enthusiast and programmer, who has little time for hobby due to study to become an EE. Serious enough to have paid a MC subscription to complete what will become a GPL project, to add to a list of several, and also one who respects a programmer’s right to charge for their work.
 
If a post looks like some legal mumbo jumbo, it’s because “it occurs to me” makes it clear that I may not have understanding of all facts, but I think so. Regardless, Integrity doesn’t necessarily address what is and isn’t legal.
 
 
 
#15
Jim Nickerson
User 452
  • Total Posts : 6257
  • Reward points : 0
  • Joined: 2003/11/07 12:35:10
  • Location: San Diego, CA
  • Status: offline
Pablof7
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2015/01/02 11:50:55
  • Location: 0
  • Status: offline
Re: GCC Build 2018/11/26 06:45:57 (permalink)
-1 (1)
Hi, could anyone tell me how to get to the source code of XC16/XC32 compilers? I cannot find any link in microchip's web.. isn't it against GPL license? I understand that when you download a binary or installed GPL licenser, source code must be available or link provided.. mustn't it?
#17
andersm
Super Member
  • Total Posts : 2651
  • Reward points : 0
  • Joined: 2012/10/07 14:57:44
  • Location: 0
  • Status: online
Re: GCC Build 2018/11/26 08:00:05 (permalink) ☄ Helpfulby Pablof7 2018/11/26 08:04:14
#18
JPortici
Super Member
  • Total Posts : 768
  • Reward points : 0
  • Joined: 2012/11/17 06:27:45
  • Location: Grappaland
  • Status: online
Re: GCC Build 2018/11/26 08:06:21 (permalink)
0 (2)
keep looking (it's in the download archives)
https://www.microchip.com/development-tools/pic-and-dspic-downloads-archive
XC32 V2.10 is not there... probably because it also suppots some ATSAM parts? Not that it would mean anything, but notice that XC8 V2.00 which calls AVR-GCC when building for ATMEL parts also have the limitations, but the sources haven't been published either. They probably have yet to sort some things out...
#19
jarin
Super Member
  • Total Posts : 845
  • Reward points : 0
  • Joined: 2005/05/23 13:50:02
  • Status: offline
Re: GCC Build 2018/11/28 15:18:47 (permalink)

Jaromir Sukuba, Bratislava, Slovakia
http://jaromir.xf.cz/  - open source PIC18 debugger.
#20
Jump to:
© 2019 APG vNext Commercial Version 4.5