Author Topic: XC8 Compiler and Linker  (Read 14218 times)

JorgenSandberg

  • Member
  • ***
  • Posts: 4
XC8 Compiler and Linker
« on: January 29, 2013, 11:08:32 am »
I have installed the new MPLAB X IDE and the free versions of the XC compilers. Hence, I want to switch to the new XC8 version 1.12 compiler and linker for all my 8-bit PIC developments. I find it neater but it comes with trouble. My fundamental question is whether there is an easy way to perform the conversion of the USB library.

I am currently converting the USB HID Generic (lvr)  to XC8 and I have the following questions:

1. The USB HID Generic (lvr) contains the following: #pragma udata, #pragma romdata, #pragma code and some specifi memory location definitions like #pragma USB_VARIABLES = 0x260. The XC8 compiler does not recognise these #pragma and I can't find an equivalent directive in the XC8 User's Guide. The XC8 has a facility called psect, but it is not as the #pragma as far as I understand it. Does anyone have a neat solution? (Please, do not reply that I should stay with the C18)

2. There are several sections to be included or not depending on the choice of compiler and microcontroller. The XC8 is stated in one file, but not in the others. Should I use define C18 in place of XC8?

3. Are there plans to update the USB stack to work with the XC8?

Regards,
Jorgen

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: XC8 Compiler and Linker
« Reply #1 on: January 29, 2013, 01:02:23 pm »
I've updated the project for MPLAB X.

http://janaxelson.com/hidpage.htm#MyExampleCode

However it's still using the c18 compiler. I will probably convert the project for the new compiler at some point but can't promise when.

The Microchip forums are probably the best place for help if you want to give it a try.
« Last Edit: July 13, 2014, 09:56:59 pm by Jan Axelson »

JorgenSandberg

  • Member
  • ***
  • Posts: 4
Re: XC8 Compiler and Linker
« Reply #2 on: January 29, 2013, 01:26:12 pm »
Thanks for your reply. I am building on your example.

I have studied the PIC18F4550 manual and realised that the BDTs shall start at address 400h and the data Tx and Rx buffers shall be in the data RAM area accessible by the USB unit implying the RAM area from 400h to 7FFh. I am forcing that by using absolute addressing. The Tx and Rx buffers start at 500h.

Regards,

Jorgen