Author Topic: Switching to XC8 compiler  (Read 5237 times)

0 Members and 1 Guest are viewing this topic.

Offline mrcrud5Topic starter

  • Contributor
  • Posts: 36
  • Country: ca
Switching to XC8 compiler
« on: March 30, 2017, 03:21:56 pm »
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.
 

Offline cv007

  • Frequent Contributor
  • **
  • Posts: 825
Re: Switching to XC8 compiler
« Reply #1 on: March 30, 2017, 03:39:48 pm »
http://www.microchip.com/mplab/compilers#what-are-the-different-modes
Compiler 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.
 
The following users thanked this post: mrcrud5

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12856
Re: Switching to XC8 compiler
« Reply #2 on: March 30, 2017, 03:54:28 pm »
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.
 
The following users thanked this post: mrcrud5

Offline Luminax

  • Regular Contributor
  • *
  • Posts: 159
  • Country: my
    • Electronesk
Re: Switching to XC8 compiler
« Reply #3 on: April 13, 2017, 01:15:53 pm »
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.
Jack of all trade - Master of some... I hope...
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3507
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Switching to XC8 compiler
« Reply #4 on: April 13, 2017, 11:58:08 pm »
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.
You 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.
 

Online JPortici

  • Super Contributor
  • ***
  • Posts: 3461
  • Country: it
Re: Switching to XC8 compiler
« Reply #5 on: April 14, 2017, 09:15:40 am »
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.


optimization in XC8 is not for code size but rather because the compiler add unnecessary bloat
in 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, though

XC16, XC32... they produce fine code with -O1 already, which is available in free mode
 

Offline Bruce Abbott

  • Frequent Contributor
  • **
  • Posts: 627
  • Country: nz
    • Bruce Abbott's R/C Models and Electronics
Re: Switching to XC8 compiler
« Reply #6 on: April 17, 2017, 05:43:30 pm »
optimization in XC8 is not for code size but rather because the compiler add unnecessary bloat
in 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.
Some people have suggested that older versions deliberately added code to bloat the executable, but I don't believe that is true. I think they just applied no optimization, 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...

   
 

Offline ebclr

  • Super Contributor
  • ***
  • Posts: 2328
  • Country: 00
Re: Switching to XC8 compiler
« Reply #7 on: April 17, 2017, 06:06:32 pm »
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.

 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7732
  • Country: ca
Re: Switching to XC8 compiler
« Reply #8 on: April 18, 2017, 02:54:33 am »
If you need speed for a particular loop, you can always use the:
#asm
.....
#endasm

Available 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.
 

Offline Bruce Abbott

  • Frequent Contributor
  • **
  • Posts: 627
  • Country: nz
    • Bruce Abbott's R/C Models and Electronics
Re: Switching to XC8 compiler
« Reply #9 on: April 18, 2017, 07:01:24 am »
If you insist on programming small PICs in C and want fast code then try mikroC 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 use EmBitz.
 
 

Online JPortici

  • Super Contributor
  • ***
  • Posts: 3461
  • Country: it
Re: Switching to XC8 compiler
« Reply #10 on: April 18, 2017, 08:22:13 am »
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
 

Online mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13745
  • Country: gb
    • Mike's Electric Stuff
Re: Switching to XC8 compiler
« Reply #11 on: April 18, 2017, 09:46:16 am »
optimization in XC8 is not for code size but rather because the compiler add unnecessary bloat
in 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.
Some people have suggested that older versions deliberately added code to bloat the executable, but I don't believe that is true. I think they just applied no optimization, leaving the raw compiler output intact without removing redundant branches etc.   
I 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.
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf