XC8 compiler

An open source USB virtual serial port driver for PICs

XC8 compiler

Postby edeca » Thu Dec 27, 2012 8:36 am

Has anybody tried the open source USB stack with the new XC* compilers?

I am a long term HiTech user but I'd like to play with this stack, would be interesting if it compiles easily with XC8/16. I guess it should as Microchip made the HiTech compilers compatible - any confirmation from people who have tried would be great.
edeca
Newbie
Newbie
 
Posts: 1
Joined: Thu Dec 27, 2012 8:32 am

Re: XC8 compiler

Postby honken » Thu Dec 27, 2012 11:10 am

I havn't tried xc8 but I have failed with xc16.
If that failure was due to the compiler or te fact that my working copy of the stack is in a state of mess (due to a svn server crash when much coding had been done) as it at the time didn't compile with pic30-gcc v3.30.

I'll give it a try later again
User avatar
honken
Full Member
Full Member
 
Posts: 190
Joined: Fri Feb 26, 2010 10:34 am
Location: Stockholm/Sweden

Re: XC8 compiler

Postby honken » Thu Dec 27, 2012 11:15 am

Actually, I just tried the xc16 again at it didn't work.
But it fails on a perfectly good type cast that isn't in the published verison of the stack, so perhaps it could work for you.
User avatar
honken
Full Member
Full Member
 
Posts: 190
Joined: Fri Feb 26, 2010 10:34 am
Location: Stockholm/Sweden

Re: XC8 compiler

Postby arhi » Thu Dec 27, 2012 7:53 pm

honken wrote:But it fails on a perfectly good type cast


share code where it breaks :)

did you maybe report bug to microchip (you should really)
User avatar
arhi
Hero Member
Hero Member
 
Posts: 2107
Joined: Thu Jun 24, 2010 11:41 am
Location: Belgrade, Serbia

Re: XC8 compiler

Postby honken » Fri Dec 28, 2012 6:13 pm

I will eventually, right now my working code is in a state of mess.
I redid all descriptors into structs and have done some halfway through implementing ping-pong (dubbel-) buffer mode.

I just today made it almost run again. But when it is back to the same level of (un)reliablility as before I will publish it on git somewere.

You're correct I should perhaps report this to microchip, but I have no intentions to be running the xc-series compiler as its optimisation functions are crippled. I prefere pic30-gcc v3.30, but I also toy:ed with the idea of writing a backend for llvm for the pic24. But that is probably never going to happen.
User avatar
honken
Full Member
Full Member
 
Posts: 190
Joined: Fri Feb 26, 2010 10:34 am
Location: Stockholm/Sweden

Re: XC8 compiler

Postby arhi » Fri Dec 28, 2012 8:37 pm

honken wrote:I will eventually, right now my working code is in a state of mess.


I meant just few lines that break it, not the whole code :)
User avatar
arhi
Hero Member
Hero Member
 
Posts: 2107
Joined: Thu Jun 24, 2010 11:41 am
Location: Belgrade, Serbia

Re: XC8 compiler

Postby honken » Sat Dec 29, 2012 3:36 am

OK, here goes,

This is the line that fails:
Code: Select all
uint16_t desc_len;

ROM const uint8_t *desc_ptr;

struct usb_configuration_descriptor_st {
  uint8_t  bLength;               /* size of this descriptor in bytes */
  uint8_t  bDescriptorType;       /* CONFIGURATION descriptor type */
  uint16_t wTotalLength;          /* total length of configuration */
  uint8_t  bNumInterfaces;        /* number of interfaces in this configuration */
  uint8_t  bConfigurationValue;   /* Configuration Index */
  uint8_t  iConfiguration;        /* Index of string descriptor */
  uint8_t  bmAttibutes;           /* */
  uint8_t  MaxPower;              /* maximum power consumption (x2) */
};

desc_len = ((struct usb_configuration_descriptor_st *) desc_ptr)->wTotalLength;


with the error message:

Code: Select all
xc16-gcc -mcpu=24FJ256GB106 -mconst-in-code -finline-functions -O2 -Wall -I ../core/ -I . -g --debug -D__DEBUG -o usb_stack.o -c ../core/usb_stack.c
Options have been disabled due to restricted license
Visit http://www.microchip.com/ to purchase a new key.
../core/usb_stack.c: In function 'usb_handle_StandardDeviceRequest':
../core/usb_stack.c:421:17: error: Unable to convert from
   const __psv__ uint8_t *
to type
   struct usb_configuration_descriptor_st *
../core/usb_stack.c:421: confused by earlier errors, bailing out
make: *** [usb_stack.o] Error 255


And now by actually writing it down, I realise that I'm discarding the const qualifier, but that is a different error message in all previous compilers I have used or made my self. Say so istead of exclaiming you're confused, you are a computer program you allways know exactly what you are expecting and what you actually got - you don't get confused, stupid!

Either way I'm not going to use the XC compilers until they (microchip) realise they are in the hardware buissness and a hobbyist growing up with a good free compiler are more likely to use their products when in a position to decide over a big commersial project.
User avatar
honken
Full Member
Full Member
 
Posts: 190
Joined: Fri Feb 26, 2010 10:34 am
Location: Stockholm/Sweden

Re: XC8 compiler

Postby arhi » Sat Dec 29, 2012 8:19 am

honken wrote:Either way I'm not going to use the XC compilers until they (microchip) realise they are in the hardware buissness and a hobbyist growing up with a good free compiler are more likely to use their products when in a position to decide over a big commersial project.


I dropped microchip almost completely from my workshop while back. They had a huge advantage over every other manufacturer 'cause they had representative office near me that always had everything from microchip at good prices, but all this compiler bs and mal and everything else wrt microchip other then chips itself is a huge fsckup :( so I decided to bail out

not that they are going to miss my few hundred chips a year
User avatar
arhi
Hero Member
Hero Member
 
Posts: 2107
Joined: Thu Jun 24, 2010 11:41 am
Location: Belgrade, Serbia


Return to Open source USB stack