Switching to XC8 compiler - Page 1
Forum section: electronics / general

author: mrcrud5
author_rank: Contributor
timestamp: March 30, 2017, 03:21:56 pm
content: I've been looking into installing the XC8 compiler for microchip. I've been searching the site and cant seem to find out if its free or if there is a paid version or something that has better code optimization or something? Is it a limited free version?Thanks.

author: cv007
author_rank: Frequent Contributor
timestamp: March 30, 2017, 03:39:48 pm
content: http://www.microchip.com/mplab/compilers#what-are-the-different-modesCompiler FAQs, second question.Just download it (no registration required), install it. At some point in the installation it will ask if you have a license (or something- it will be obvious when you see it). Don't get hung up on the lack of the 'Pro' optimizations, until you can longer fit your program in the available flash, and you can't spend the 20 cents more to go to the next size up pic.

author: Ian.M
author_rank: Super Contributor
timestamp: March 30, 2017, 03:54:28 pm
content: There's a free trial of the PRO mode with full optimisation (IIRC 60 days) that you can trigger at any time by selecting PRO mode. When that expires it drops back to FREE mode - bigger slower code but no other restrictions (its even legal for commercial use). However the licence manager restricts you to ONE free trial per PC, so if you upgrade to a newer version, you don't get another bite of the cherry.You can also rent PRO mode by the month.My advice is DON'T trigger the free trial until you are up against the wall for code space or execution speed, as there is no point in wasting the 60 days while you are still learning to use it.

author: Luminax
author_rank: Regular Contributor
timestamp: April 13, 2017, 01:15:53 pm
content: I've been doing some CCP and LCD driving plus some weird calculations with SPI/I2C on top of that and I haven't yet hit that wall of code space...I did ponder about external ROM and RAM etc somewhere along the line but I guess I'm just prematurely worrying...With that said, XC8, XC16 (I haven't really explored XC32 all that much) in its free form is quite satisfactory for your run-of-the-mill everyday embedded design.

author: technix
author_rank: Super Contributor
timestamp: April 13, 2017, 11:58:08 pm
content: Quote from: Ian.M on March 30, 2017, 03:54:28 pmYou don't even need to buy the Pro version for XC16 and XC32. Those are GCC, and full source code is available as mandated by GPL. You just need to download the source code, patch out the license checks, and recompile the compiler. This way you can get full optimization for free, and if you worked in another patch, C++ on 16-bit PIC. Both patches available online and are applied at the source level.

author: JPortici
author_rank: Super Contributor
timestamp: April 14, 2017, 09:15:40 am
content: Quote from: Luminax on April 13, 2017, 01:15:53 pmoptimization in XC8 is not for code size but rather because the compiler add unnecessary bloatin older version you could even see instruction put there just to deliberately waste time!yes, of course more instructions == more code but i'm talking about crippling, not lack of optimization. Not a real problem anymore, thoughXC16, XC32... they produce fine code with -O1 already, which is available in free mode

author: Bruce Abbott
author_rank: Frequent Contributor
timestamp: April 17, 2017, 05:43:30 pm
content: Quote from: JPortici on April 14, 2017, 09:15:40 amSome people have suggested that older versions deliberatelyaddedcode to bloat the executable, but I don't believe that is true. I think they just appliednooptimization, leaving the raw compiler output intact without removing redundant branches etc.But hey, it works and it's free - and obviously isn't too much of a problem because nobody has bothered to create a better (free) alternative. If you want the best performance out of an 8 bit PIC you should be programming in assembler anyway...

author: ebclr
author_rank: Super Contributor
timestamp: April 17, 2017, 06:06:32 pm
content: This is true, does not use the free version for anything that needs time < 10 ms, your code will be forced with a lot a ridiculous code made by the compiler only to force bigger size and slow execution.

author: BrianHG
author_rank: Super Contributor
timestamp: April 18, 2017, 02:54:33 am
content: If you need speed for a particular loop, you can always use the:#asm.....#endasmAvailable to you. My typical use is when I want to bit-bang a port as fast as possible on an 8 bit pic while leaving everything else in C.

author: Bruce Abbott
author_rank: Frequent Contributor
timestamp: April 18, 2017, 07:01:24 am
content: If you insist on programming small PICs in C and want fast code then trymikroC Pro for PIC. The unregistered version is limited to 2k words, but many smaller PICs only have that much ROM or less.For PIC18F you can useEmBitz.

author: JPortici
author_rank: Super Contributor
timestamp: April 18, 2017, 08:22:13 am
content: mikro c also did very strange stuff, like allocating const both in flash and ram. plus the code is completely non portable to another compiler

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: April 18, 2017, 09:46:16 am
content: Quote from: Bruce Abbott on April 17, 2017, 05:43:30 pmI suspect it may have been adding code to structure things to help the optimiser later on. ISTR it was often blatently redundant stuff that even the crudest peephole optimiser could have culled.