Author Topic: Has anyone tried the XC8 PRO compiler with AVRs?  (Read 16877 times)

0 Members and 2 Guests are viewing this topic.

Offline voltsandjolts

  • Supporter
  • ****
  • Posts: 2429
  • Country: gb
Re: Has anyone tried the XC8 PRO compiler with AVRs?
« Reply #50 on: September 24, 2019, 12:23:13 pm »
For Windows-
C:\Program Files (x86)\Microchip\xc8\v2.00\avr\libexec\gcc\avr\5.4.0\cc1.exe  - file offset 0xBF5890 - change FFFFFFFFFFFFFFFF to 0200000000000000

Address has shifted a little for AVR "PRO" mode in XC8 v2.10 (MS Windows):
C:\Program Files (x86)\Microchip\xc8\v2.10\avr\libexec\gcc\avr\5.4.0\cc1.exe  - file offset 0xC22690 - change FFFFFFFFFFFFFFFF to 0200000000000000
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3508
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: Has anyone tried the XC8 PRO compiler with AVRs?
« Reply #51 on: September 24, 2019, 04:27:23 pm »
For Windows-
C:\Program Files (x86)\Microchip\xc8\v2.00\avr\libexec\gcc\avr\5.4.0\cc1.exe  - file offset 0xBF5890 - change FFFFFFFFFFFFFFFF to 0200000000000000

Address has shifted a little for AVR "PRO" mode in XC8 v2.10 (MS Windows):
C:\Program Files (x86)\Microchip\xc8\v2.10\avr\libexec\gcc\avr\5.4.0\cc1.exe  - file offset 0xC22690 - change FFFFFFFFFFFFFFFF to 0200000000000000
Can I just compile upstream avr-gcc and avr-libc, and use that as a drop-in? Also how good is Microchip's optimizer for GCC 5.4 than that in mainline GCC 8.2?
 
The following users thanked this post: bmjjr

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4311
  • Country: us
Re: Has anyone tried the XC8 PRO compiler with AVRs?
« Reply #52 on: September 24, 2019, 11:42:18 pm »
Quote
Can I just compile upstream avr-gcc and avr-libc, and use that as a drop-in?
People have done it. ( https://www.avrfreaks.net/forum/avr-gcc-91-avr-libc-xmega3-device-support )  IMO, it's risky - the gcc developers don't pay much attention to AVR, and they tend to break things.  One of the reasons that AS7 and XC8 are behind is because of wanting to stay with "known working" code.
avr-libc is thornier.  BSD rather than GPL, so Microchip can in theory develop a divergent version of avr-libc with undocumented changes :-(
 

Online magic

  • Super Contributor
  • ***
  • Posts: 7215
  • Country: pl
Re: Has anyone tried the XC8 PRO compiler with AVRs?
« Reply #53 on: September 25, 2019, 07:10:40 am »
I noticed that Atmel/Microchip switched from preprocessor macros to structures and enums in their official C headers for the "xmega3" chips.
Is avr-libc doing the same, are they source-level compatible?

Also, does anyone know why they added suffixes like _gc to the names of enum values? Any official explanation what those things mean? :-//

edit
Nevermind, found it. It's another thing carried over from the Xmega line, documented in AVR1000. The 3rd party avr-libc appears to follow this convention for classic Xmegas so they surely will for the new chips too. If they ever wake up and release an update, that is :)
« Last Edit: September 25, 2019, 08:44:06 am by magic »
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4311
  • Country: us
Re: Has anyone tried the XC8 PRO compiler with AVRs?
« Reply #54 on: September 25, 2019, 10:23:16 am »
Quote
noticed that Atmel/Microchip switched from preprocessor macros to structures and enums in their official C headers for the "xmega3" chips.
Is avr-libc doing the same, are they source-level compatible?
Yes.  This started with the ARM and XMega chips (CMSIS compatible, more or less.)  Long overdue, IMO.  Having 4 sets of individual registers for the 4 UARTs on an ATmega1280 was silly.
Quote
Also, does anyone know why they added suffixes like _gc to the names of enum values?
_bm: bitmask, for single bits.  _bp: bit position for single bits_gm: group(?) mask, for multibit fields.  _gp: group position.  _gc: group(?) code(?) individual values of multibit field


Quote
documented in AVR1000.
Oh cool!  You found documentation!  ('c' is apparently "configuration", not code.)

Quote
The 3rd party avr-libc ...  surely will for the new chips too. If they ever wake up and release an update, that is
As far as the #include files and compiler specs are concerned, the OSSW compilers can use the files included in the "packs" that microchip distributes.  (supposedly, the chip .h files are generated automatically from some common .xml files that come out of the chip design.  Despite the large number of fixes in avr-libc that say "fixed a particular definition in a particular chip .h file."  Hmmph.)
 

Offline sunjob

  • Newbie
  • Posts: 1
  • Country: ru
avr-gcc vs хс8-avr
« Reply #55 on: January 16, 2021, 01:40:22 am »
this my cut from text's and project's, some tests, avr-gcc vs xc8-avr

Code: (cpp) [Select]
///////////////////////////////////////////
optimisation / size *.hex-file
///////////////////////////////////////////
gcc1 - avr-gcc-3.6.2 custom Makefile
gcc2 - avr-gcc-3.6.2 build on mplabx
xc8  - xc8-2.10      build on mplabx
///////////////////////////////////////////
opt  |  gcc1   |  gcc2   | xc8
///////////////////////////////////////////
s    |  5,496  |  5,696  | 6,357
g    |  5,508  |         |
fast |  5,504  |         |
0    |  5,966  |  8,433  | 9,188
1    |  5,508  |  5,721  | 6,386
2    |  5,500  |  5,700  | 6,361
3    |  5,504  |  5,717  | 6,365
///////////////////////////////////////////

and

Code: (cpp) [Select]
///////////////////////////////////////////
avr-gcc toolchain
- avr_gcc      4.9.2
- avr_binutils 2.25
- avr_gdb      7.8.1
- avr_libc     1.8.1
////////////////////////////////////////////////
gcc  - avr-gcc  build on mplabx
xc8  - xc8-2.20 build on mplabx
////////////////////////////////////////////////
opt  |  gcc    |  xc8    |
////////////////////////////////////////////////
0    |  8,024  |  8,971  |
1    |  5,402  |  6,169  |
2    |  5,381  |  6,144  |
3    |  5,385  |  6,148  |
s    |  5,377  |  6,140  |
////////////////////////////////////////////////

and

Code: (cpp) [Select]
////////////////////////////////////////////////
optimisation -S2
////////////////////////////////////////////////
gcc  - avr-gcc  build on mplabx
xc8  - xc8-2.20 build on mplabx
////////////////////////////////////////////////
    avr-gcc   | xc8 2.20 |
////////////////////////////////////////////////
3.6.2 - 5,496 |   6,144  |
7.3.0 - 5,361 |          |
9.2.0 - 5,336 |          |
////////////////////////////////////////////////
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf