Sonsivri

Electronics => Pic C Languages => Topic started by: metal on June 29, 2012, 12:59:17 00:59



Title: XC8 Compilers - Discussion
Post by: metal on June 29, 2012, 12:59:17 00:59
XC8 Compilers Discussion Topic

Related XC8 topics, updates, bugs, etc.
No "code does't work" here


Title: Re: XC8 Compilers - Discussion
Post by: asergin on July 03, 2012, 02:49:42 14:49
MPLAB xc8 v1.01 has been release
http://www.microchip.com/mplabxc8windows


Title: Re: XC8 Compilers - Discussion
Post by: marcodassi on July 10, 2012, 12:07:31 00:07
seems that MPLAB XC8 1.01 has been removed from microchip's site.
and XC16 download is down.

wondering about a next massive update...


Title: Re: XC8 Compilers - Discussion
Post by: metal on July 10, 2012, 08:44:40 08:44
I noticed that, I downloaded v1.01 nearly a week ago, and now microchip claims there are bug fixes that were introduced in v1.01, when you report a bug, they just tell you it was fixed in v1.01, this is not true, ... and their site reports that file is not found.. xc8_v1_01_windows.exe


Title: Re: XC8 Compilers - Discussion
Post by: marcodassi on July 12, 2012, 11:30:54 11:30
XC8 1.01 officially re-upped on Microchip site :)

EDIT: it's exactly the same as the one from a week ago (compared byte-by-byte)


Title: Re: XC8 Compilers - Discussion
Post by: metal on July 12, 2012, 01:09:45 13:09
yes, I agree, microchip has seriously ***ed up. The funny thing is that microchip is now lying/misleading about bug fixes and is putting irrelevant images on the support ticket to convince you that they solved the problem!

They are twisting the facts, unbelievable...


Title: Re: XC8 Compilers - Discussion
Post by: LithiumOverdosE on July 12, 2012, 03:28:38 15:28
Or perhaps HiTech guys are doing the same exact thing.  ;D


Title: Re: XC8 Compilers - Discussion
Post by: metal on July 12, 2012, 10:00:54 22:00
The problems are mainly in PIC18 compiler. In v1.00 header files were changed and differ from v1.01..


Title: Re: XC8 Compilers - Discussion
Post by: LithiumOverdosE on July 13, 2012, 12:50:34 12:50
You're talking about incompatibilities between MCC18 and PICC18  I guess?


Title: Re: XC8 Compilers - Discussion
Post by: metal on July 13, 2012, 05:49:39 17:49
No, I am talking about the new buggy PIC18 CX8. But it was a coincidence when I noticed that the header files were actually changed and differ from v1.01.


Title: Re: XC8 Compilers - Discussion
Post by: LithiumOverdosE on July 16, 2012, 11:25:44 11:25
Most interesting. I mean, I switched to XC8 and I'm doing a complex project but I haven't encountered any problems so far. I'm also using hardware libs (plib.h) which are basically the same as in PICC-18.

As a side note - I did quick and dirty adaptation of PWM and EPWM libs from PICC-18 to be used with MikroC so if somebody needs them I can post it here.


Title: Re: XC8 Compilers - Discussion
Post by: metal on July 16, 2012, 11:59:38 11:59
Strange, which PIC chip and what programmer are you using?


Title: Re: XC8 Compilers - Discussion
Post by: LithiumOverdosE on July 17, 2012, 03:50:25 15:50
I use 18F46K22 together with Proteus and PICkit3. Project involves XC8 (PICC18) EPWM libs together with custom LCD, 1-wire, SHT-75, SD Card and software PID procedures. Not a single problem so far with XC8.


Title: Re: XC8 Compilers - Discussion
Post by: marcodassi on July 18, 2012, 01:33:04 13:33
@metal:

can you please describe the bug you've found (in 1.00) that wasn't squashed in version 1.01

thank you


Title: Re: XC8 Compilers - Discussion
Post by: metal on July 18, 2012, 02:03:38 14:03
It is a configuration bits problem. When you set fuses for PIC18, they are not correctly configured, MC is not sure how many chips are affected. The problem is really complicated, it took more than 3 weeks to convince MC that there is a problem. I am not sure if they are going to be able to solve it in the next release.

The workaround for now is that you have to make sure you are using the programmer itself to set the configuration bits, and not to try configuring them neither from the code nor from the configuration bits window in MPALB.

I have not seen any problems with PIC16 chips on XC8, but be sure MC has received tons of bug reports on XC8.

regards.


Title: Re: XC8 Compilers - Discussion
Post by: odessa on July 27, 2012, 09:25:09 09:25
Is anyone else here getting a crash to desktop using XC8 with a Pickit2?
The machine I'm running on is XP 32bit Sp3.

I know there are seperate drivers for ICD3 etc but can't see anything regarding Pickit2


Title: Re: XC8 Compilers - Discussion
Post by: metal on July 27, 2012, 11:45:53 11:45
When does it happen, give more information..

It hangs for ever while I am debugging when PICKit3 enters a __delay_us() and __delay_ms() and I must end task MPLAB process.


Title: Re: XC8 Compilers - Discussion
Post by: odessa on July 27, 2012, 01:31:33 13:31
I would if I could, It happens just after compiling before programming. It's so quick I don't get a chance to read the build window. I'll try my pickit3 and see if that helps, just the place I work uses the pickit2.


Title: Re: XC8 Compilers - Discussion
Post by: metal on July 27, 2012, 01:54:02 13:54
you can record your desktop to see what the message says, I don't know if MPLAB saves a log in a file as well.


Title: Re: XC8 Compilers - Discussion
Post by: metal on July 28, 2012, 03:03:58 15:03
Any one tried to use microchip application libraries with xc8?


Title: Re: XC8 Compilers - Discussion
Post by: 8bitMCU on August 10, 2012, 11:34:06 23:34
MPLAB xc8 v1.10 has been release

http://www.microchip.com/mplabxc8windows (http://www.microchip.com/mplabxc8windows)


Title: Re: XC8 Compilers - Discussion
Post by: Gallymimu on September 16, 2012, 04:00:40 16:00
xc8 is still a bit buggy.  When using it with the PIC18 at least be careful of whether the IDE detects all of the include files properly.  In my situation the code will compile but the code detection doesn't work correctly (peripheral keywords are indicated as missing). 

Adding a define for:
#define __18Fxxxx

helped, even if #include <p18cxxx.h> exisited already. 


Title: Re: XC8 Compilers - Discussion
Post by: dotm on November 01, 2012, 12:03:55 00:03
Has anyone an idea how to reformat the __CONFIG() code generated by the config parser in MplabX not to be detected as an error?
says : unexpected token: (
I tried to enter space around the brackets as mentioned in some forums but nothing did work for me.
Altough it compiles without error, the marking in the editorwindow is annoying me!
If they want us to use #pragma instead, why does the config parser not support this formatting? AND(!) it is quite an effort to find the definitions for the options used with #pragma.


Title: Re: XC8 Compilers - Discussion
Post by: metal on November 01, 2012, 12:22:33 00:22
I assume you are asking about PIC18. In the manual:

2.5.14 Specifying Configuration Bits
The #pragma config directive may be used to program the configuration bits for a device. The pragma has the form:
#pragma config setting = state|value
2.5.14.1 EXAMPLE
The following shows configuration bits being specified using this pragma.
#pragma config WDT=ON, WDTPS = 0x1A
3.6.11 What Devices are Supported by the Compiler?
HTML listings are provided in the compiler’s docs directory. Open these in your favorite web browser. They are called pic_chipinfo.html and pic18_chipinfo.html.
5.3.5 Configuration Bit Access
The settings and values associated with PIC18 devices can be determined from an HTML guide. Open the file pic18_chipinfo.html, which is located in the DOCS directory of your compiler installation. Click on your target device and it will show you the settings and values that are appropriate with this pragma. Check your device data sheet for more information.

Look up this file under "..\Microchip\xc8\v1.11\docs\" Open it and find your chip, click on the chip-link and you will find info about the config bits for your chip and how to correctly configure them.

Read the manual before complaining :- )

Here is an example for PIC181330:
Code:
#pragma config IESO = OFF
#pragma config OSC = INTIO2
#pragma config FCMEN = OFF
#pragma config BOR = BOHW
#pragma config BORV = 2 //2.7 volts
#pragma config PWRT = ON
#pragma config WDTPS = 1
#pragma config WDT = OFF
#pragma config PWMPIN = OFF
#pragma config HPOL = HIGH
#pragma config LPOL = HIGH
#pragma config T1OSCMX = HIGH
#pragma config FLTAMX = RA5
#pragma config MCLRE = OFF
#pragma config DEBUG = ON
#pragma config STVREN = OFF
#pragma config XINST = OFF
#pragma config BBSIZ = BB256
#pragma config CP0 = OFF
#pragma config CP1 = OFF
#pragma config CPD = OFF
#pragma config CPB = OFF
#pragma config WRT0 = OFF
#pragma config WRT1 = OFF
#pragma config WRTB = OFF
#pragma config WRTC = OFF
#pragma config WRTD = OFF
#pragma config EBTR0 = OFF
#pragma config EBTR1 = OFF
#pragma config EBTRB = OFF


Title: Re: XC8 Compilers - Discussion
Post by: dotm on November 01, 2012, 12:56:05 00:56

Read the manual before complaining :- )


Damn. I lower my head in shame. Is Pic16 though but you're right everything is there.


Title: Re: XC8 Compilers - Discussion
Post by: LithiumOverdosE on November 01, 2012, 12:59:18 00:59
Also as of v1.11 it is advisable to use quote marks to avoid preprocessor messing with your code. Check out documentation.


Title: Re: XC8 Compilers - Discussion
Post by: metal on November 01, 2012, 01:23:23 01:23
Damn. I lower my head in shame. Is Pic16 though but you're right everything is there.

No need to lower your head in shame, just read the manual, thu I won't use XC8 for PIC18, especially if I am going to use microchip library, at least not for now, current release of microchip applications library (v2012-10-15) includes support only for XC16 and XC32 compilers, which I think are more important than supporting PIC18. If you look at the manual, you can learn how to support both C18 and XC8, so in future you only need to change a #define to jump among compilers.

Posted on: November 01, 2012, 03:12:18 03:12 - Automerged

Also as of v1.11 it is advisable to use quote marks to avoid preprocessor messing with your code. Check out documentation.
Where is that mentioned in the manual that comes with the compiler?


Title: Re: XC8 Compilers - Discussion
Post by: dotm on November 01, 2012, 01:37:50 01:37
Where is that mentioned in the manual that comes with the compiler?

I think he mentions the conflict that can occur if you have predefined ON or OFF to specific logic levels as mentioned here:
http://www.microchip.com/forums/m672933-p2.aspx
Since the topic is quite complicated for me, I may be wrong but the solution i read out should be either placing #define after #pragma or to use quotation marks.


Title: Re: XC8 Compilers - Discussion
Post by: LithiumOverdosE on November 01, 2012, 04:37:58 04:37
Where is that mentioned in the manual that come with the compiler?

It's mentioned in the release notes that come with the compiler.   ;)

Quote
Specification of config pragmaThe arguments to the #pragma configcan now be quoted.
You may prefer to quote the setting-value pairs to ensure that the preprocessor does not
perform substitution of these tokens, e.g., #pragma config "BOREN=OFF"


Title: Re: XC8 Compilers - Discussion
Post by: metal on November 01, 2012, 03:10:45 15:10
I think he mentions the conflict that can occur if you have predefined ON or OFF to specific logic levels as mentioned here:
http://www.microchip.com/forums/m672933-p2.aspx
Since the topic is quite complicated for me, I may be wrong but the solution i read out should be either placing #define after #pragma or to use quotation marks.


They are confusing people in this thread, better not go in depth ;- )


Title: Re: XC8 Compilers - Discussion
Post by: Ahmad_k on November 07, 2012, 03:58:34 03:58
Does anyone know how to debug XC8 project in PROTEUS i can only load HEX file, but when loading COF debug file i cannot execute step by step through the code.

I have faced this problem with XC16 but there was an option to change the output file format to COFF and that works, but this option is missing from XC8


Title: Re: XC8 Compilers - Discussion
Post by: metal on November 07, 2012, 05:12:34 05:12
Strange, I can debug main.c (single file project) in XC v1.11 without problems for both debug and release builds.


Title: Re: XC8 Compilers - Discussion
Post by: Ahmad_k on November 07, 2012, 09:22:01 09:22
I have tried this on three different PC with mplabx 1.41 and xc8 1.11 without any success for debugging. This is strange.
Can you upload a small project to try on my Pc ?


Title: Re: XC8 Compilers - Discussion
Post by: metal on November 07, 2012, 09:36:55 09:36
I am using MPLAB v8.88 and CX8 v1.11, send me your project and I will try it for you.


Title: Re: XC8 Compilers - Discussion
Post by: marcodassi on December 05, 2012, 11:11:40 23:11
XC8 1.12 has just been released

http://www.microchip.com/pagehandler/en_us/devtools/mplabxc/home.html

("medicine" still seems to work...  :D )


Title: Re: XC8 Compilers - Discussion
Post by: Okada on January 08, 2013, 06:03:24 18:03
Even I am not sure about the medicine but I think they refer to the link in the attached file in the topmost post at this link http://www.sonsivri.to/forum/index.php?topic=44014.0


Title: Re: XC8 Compilers - Discussion
Post by: Okada on January 08, 2013, 07:20:33 19:20
Go here http://www.sonsivri.to/forum/index.php?topic=44014.25

download the xclm.rar which metal has posted or download the xclm.c which is posted by juvaan and compile it to get xclm.exe


Title: Re: XC8 Compilers - Discussion
Post by: metal on January 08, 2013, 10:44:05 22:44
Download IDE and compiler from this link (http://www.codeblocks.org/downloads/binaries). The file you need to download is "codeblocks-12.11mingw-setup.exe". In case you don't have admin privilege on your PC, then you might opt to download this file "codeblocks-12.11mingw-setup_user.exe" instead, if you don't understand what I am talking about it, download the latter setup file.

Once download complete, simply follow the quick tutorial I created. You can also download project files in xclm.rar attachment.


Note: You have to be a member of 4shared.com in order to be able to download.


Title: Re: XC8 Compilers - Discussion
Post by: metal on January 08, 2013, 11:53:56 23:53
attach your project here.  xclm.exe is working for me whatever project I open.. I mean, I am not having any of your errors.


Title: Re: XC8 Compilers - Discussion
Post by: Okada on January 09, 2013, 10:18:14 10:18
If you want to compile yourself then create a new C project in Codeblocks and select MinGW GCC Compiler as the tool. Then add a new emply file to the project and save it as xclm.c. The copy and paste the code from the xclm.c posted in this thread. Then select Release as output type and build the program. xclm.exe will be in the Release/bin folder.

Yes, It can be used with any XC Compiler. Juvann also said that it also enables Pro mode of XC32++ Compiler in XC32 Compiler.


Title: Re: XC8 Compilers - Discussion
Post by: metal on January 09, 2013, 12:08:56 12:08
 there is nothing wrong with my files... I don't understand what you are trying to do okada.. another post counter indian we 've got here..


Title: Re: XC8 Compilers - Discussion
Post by: lcn on January 09, 2013, 01:16:49 13:16
Edit :

Finally, i found the following : ( for XC8 v1.11 and XC8 v1.12 )

Compiled Okada's file is not working for me.
PRO mode can be activated but compilation runs with free mode optimizations.



Title: Re: XC8 Compilers - Discussion
Post by: juvann on January 09, 2013, 08:46:53 20:46
Icn are you sure to replace correctly the xclm.exe? In the last version the path of xclm is changed before there was a common path \program files\microchip\xclm\bin\ now every xc compilers has own version in bin directory, so for XC8 xclm is located in \program files\microchip\xc8\v1.12\bin\. You can replace every xclm.exe with the same fake xclm.

EDIT
PRO mode can be activated but compilation is done with free mode optimizations.
In MPLABX with XC8 compiler, you can choose if compile in Free, Standard or PRO, it's depend also from your license (fake xclm it's your friend).
In project properties: Conf: [name] -> XC8 global options -> XC8 Compiler -> on the rigth first combo Option categories -> Optimizations -> last option Operation mode, there are the three options.


Title: Re: XC8 Compilers - Discussion
Post by: metal on January 09, 2013, 11:21:36 23:21
man... I asked you already to upload something that we can test here. We can't do guessing for you, if you seek help, find some way to allow us help you, this is going to a dead end, can't you see that already!? The same file size is compiling ok here, so, upload something that I or other  can compile to see if you are the only one having this problem, or all of us have it.


Title: Re: XC8 Compilers - Discussion
Post by: LithiumOverdosE on June 28, 2013, 01:11:15 01:11
XC8 v1.20 has been released.

http://www.microchip.com/pagehandler/en_us/devtools/mplabxc/ (http://www.microchip.com/pagehandler/en_us/devtools/mplabxc/)


Yet another update with no major improvements or correction of errors in PLIB.   :-\



Title: Re: XC8 Compilers - Discussion
Post by: metal on June 28, 2013, 12:32:49 12:32
Since microchip has outsourced this support task to indian companies, what do you expect!? There won't be fast major changes any more as Hi-Tech used to do.


Title: Re: XC8 Compilers - Discussion
Post by: LithiumOverdosE on June 28, 2013, 06:59:44 18:59
I didn't know that. I supposed that Hi-Tech was contracted to do updates.


Title: Re: XC8 Compilers - Discussion
Post by: metal on June 28, 2013, 11:19:41 23:19
I hope you are right.


Title: Re: XC8 Compilers - Discussion
Post by: pumper on July 29, 2013, 11:49:14 23:49
no c-r-a-c-k crack for version 1.20 ?


Title: Re: XC8 Compilers - Discussion
Post by: metal on July 30, 2013, 01:57:37 01:57
explain to me, why you are asking for the crack, also why do you write this word this way? This is forbidden here, write words correctly..

BTW, the existing crack is working fine, unless you found sth that is no longer supported by the current fix, read before you post and waste others time.


Title: Re: XC8 Compilers - Discussion
Post by: pumper on July 30, 2013, 11:39:51 11:39
I installed the compiler and crack and compiler works fine but when i compile the code the licence type is : License type: w
sorry for the spell


Title: Re: XC8 Compilers - Discussion
Post by: Ichan on July 30, 2013, 08:19:01 20:19
Read here (http://www.sonsivri.to/forum/index.php?topic=44014.msg148212#msg148212).

-ichan


Title: Re: XC8 Compilers - Discussion
Post by: max on August 02, 2013, 04:04:56 04:04
is there any tutorial how to start with xc8 compiler using mplab ide 8.xx

regards


Title: Re: XC8 Compilers - Discussion
Post by: avrlover on August 02, 2013, 05:00:53 05:00
here you can get xc8 tutorials go to subtopic Mid-range PIC C Programming
http://www.gooligum.com.au/tutorials.html


Title: Re: XC8 Compilers - Discussion
Post by: micropcb on August 09, 2013, 06:44:29 06:44
I know this topic is about xc8 but felt I should share this.
Here I found a nice intro to Creating a new XC16 project in MPLAB X
http://batchloaf.wordpress.com/2012/08/27/creating-a-new-xc16-project-in-mplab-x/


Cheers.


Title: Re: XC8 Compilers - Discussion
Post by: ptr on August 09, 2013, 07:29:20 19:29
I know this topic is about xc8 but felt I should share this.

Why did you not post this here:
http://www.sonsivri.to/forum/index.php?topic=45708.0


Title: Re: XC8 Compilers - Discussion
Post by: micropcb on August 10, 2013, 02:20:31 02:20
Why did you not post this here:
http://www.sonsivri.to/forum/index.php?topic=45708.0
Sorry to have missed that. I was trying to get started with mplabx and xc8 but thought the procedure was very similar to that for xc8.


Title: Re: XC8 Compilers - Discussion
Post by: Manuel on October 07, 2013, 10:49:33 10:49
FYI:
 -> MPLAB® XC8 Compiler v1.21

No Info Still available on update contents...

It still Work!

Manuel.


Title: Re: XC8 Compilers - Discussion
Post by: alichan on December 06, 2013, 07:17:39 19:17
Hello.

File is working with current XC8 version v1.21.

Provided my 'metal' i attach it anyway. I got some strange behaviours with other files i found in this thread (surely due to outdated), but this one worked nicely.


Title: Re: XC8 Compilers - Discussion
Post by: Catcatcat on January 14, 2014, 05:40:02 17:40
update

MPLAB® XC8 Compiler v1.30 (http://www.microchip.com/mplabxc8windows)


Title: Re: XC8 Compilers - Discussion
Post by: alichan on February 05, 2014, 09:19:50 21:19
Hello

I tested the patch with the 1.30 version and:

-the messages about free mode, bla bla, are suppressed as expected.
-generated code (hex) is the same both in free mode as with the patch applied (last one published in this thread, working with 1.21).
 Reports from XC8 are identical. Also i compared both codes manually in a hex editor with no diferences.

Since the code is quite simple (just blinking a led) i can't do any further affirmation, because perhaps there is nothing to optimize so the generated hex files are the same in both cases.

Resuming: i don't know if the patch is still working and the PRO mode is really enabled. Looks it's not enabled.

I'll do more checks.


Title: Re: XC8 Compilers - Discussion
Post by: metal on February 05, 2014, 09:53:12 21:53
this is not true; I compiled few minutes ago a code and it produces the following in free mode:

Memory Summary:
    Program space        used   195h (   405) of  2000h words   (  4.9%)
    Data space           used    23h (    35) of   170h bytes   (  9.5%)
    EEPROM space         used     0h (     0) of   100h bytes   (  0.0%)
    Data stack space     used     0h (     0) of    60h bytes   (  0.0%)
    Configuration bits   used     1h (     1) of     1h word    (100.0%)
    ID Location space    used     0h (     0) of     4h bytes   (  0.0%)

while in PRO mode it produces the following:

Memory Summary:
    Program space        used   13Dh (   317) of  2000h words   (  3.9%)
    Data space           used    20h (    32) of   170h bytes   (  8.7%)
    EEPROM space         used     0h (     0) of   100h bytes   (  0.0%)
    Data stack space     used     0h (     0) of    60h bytes   (  0.0%)
    Configuration bits   used     1h (     1) of     1h word    (100.0%)
    ID Location space    used     0h (     0) of     4h bytes   (  0.0%)

Compiler version is 1.30, actually I tested the PRO code on real HW and it works. I feel like this is a waste of time to test again.


Title: Re: XC8 Compilers - Discussion
Post by: alichan on February 05, 2014, 10:42:23 22:42
Hello

As i said i had to perform more checks.

Result: patch still is working in free, std and pro mode for XC8 v1.30  :D

Checked generated asm files, hex files and compiler output to console.

FREE:
Code:
Memory Summary:
    Program space        used    5Dh (    93) of   800h words   (  4.5%)
    Data space           used     Bh (    11) of    80h bytes   (  8.6%)
    EEPROM space         None available
    Data stack space     used     0h (     0) of    70h bytes   (  0.0%)
    Configuration bits   used     1h (     1) of     2h words   ( 50.0%)
    ID Location space    used     0h (     0) of     4h bytes   (  0.0%)

STD:
Code:
Memory Summary:
    Program space        used    56h (    86) of   800h words   (  4.2%)
    Data space           used     Bh (    11) of    80h bytes   (  8.6%)
    EEPROM space         None available
    Data stack space     used     0h (     0) of    70h bytes   (  0.0%)
    Configuration bits   used     1h (     1) of     2h words   ( 50.0%)
    ID Location space    used     0h (     0) of     4h bytes   (  0.0%)


PRO:
Code:
Memory Summary:
    Program space        used    3Eh (    62) of   800h words   (  3.0%)
    Data space           used     Bh (    11) of    80h bytes   (  8.6%)
    EEPROM space         None available
    Data stack space     used     0h (     0) of    70h bytes   (  0.0%)
    Configuration bits   used     1h (     1) of     2h words   ( 50.0%)
    ID Location space    used     0h (     0) of     4h bytes   (  0.0%)


BTW, surfing the web i found this guy checking the optimizations www.t4f.org/articles/optimization-of-microchip-pic-xc8-compiler-in-free-and-pro-mode/ (http://www.t4f.org/articles/optimization-of-microchip-pic-xc8-compiler-in-free-and-pro-mode/), it's interesting. I have to agree with him after my own checks, the code generated in free mode is.. weird and suspicious.


Regards.




Title: Re: XC8 Compilers - Discussion
Post by: Catcatcat on February 06, 2014, 06:54:49 06:54
Medicine works is 100% tested. A degree of optimization depends on the program and features utilized.


Title: Re: XC8 Compilers - Discussion
Post by: jamesbond on April 01, 2014, 02:25:00 14:25
xc8 Compiler V1.31 available


Title: Re: XC8 Compilers - Discussion
Post by: alichan on April 18, 2014, 02:51:31 14:51
v1.31: path tested, still working

Results:
Code:
free
----
    Program space        used    57h (    87) of   800h words   (  4.2%)
    Data space           used     Eh (    14) of    80h bytes   ( 10.9%)
    EEPROM space         None available
    Data stack space     used     0h (     0) of    70h bytes   (  0.0%)
    Configuration bits   used     1h (     1) of     2h words   ( 50.0%)
    ID Location space    used     0h (     0) of     4h bytes   (  0.0%)

std
---
    Program space        used    4Ch (    76) of   800h words   (  3.7%)
    Data space           used     Eh (    14) of    80h bytes   ( 10.9%)
    EEPROM space         None available
    Data stack space     used     0h (     0) of    70h bytes   (  0.0%)
    Configuration bits   used     1h (     1) of     2h words   ( 50.0%)
    ID Location space    used     0h (     0) of     4h bytes   (  0.0%)

pro
---
    Program space        used    1Ch (    28) of   800h words   (  1.4%)
    Data space           used     Dh (    13) of    80h bytes   ( 10.2%)
    EEPROM space         None available
    Data stack space     used     0h (     0) of    70h bytes   (  0.0%)
    Configuration bits   used     1h (     1) of     2h words   ( 50.0%)
    ID Location space    used     0h (     0) of     4h bytes   (  0.0%)



Title: Re: XC8 Compilers - Discussion
Post by: Manuel on June 10, 2014, 07:53:41 07:53
FYI: released a new version Windows (x86/x64) MPLAB® XC8 Compiler v1.32

CAN NOT 'njoy! :-(

Patch anymore working...

Manuel.


Title: Re: XC8 Compilers - Discussion
Post by: metal on June 10, 2014, 12:01:09 12:01
FYI: released a new version Windows (x86/x64) MPLAB® XC8 Compiler v1.32

CAN NOT 'njoy! :-(

Patch anymore working...

Manuel.

during/after installing, where does it mention that this executable is installing x64 executables?

I am asking because when I use "File for Windows" to check if this application is x64 or not, it reports the following:

Code:
file.exe "C:\Program Files (x86)\Microchip\xc8\v1.32\bin\picc18.exe"
PE32 executable for MS Windows (console) Intel 80386 32-bit

file.exe "C:\Program Files (x86)\Microchip\xc8\v1.32\bin\picc.exe"
PE32 executable for MS Windows (console) Intel 80386 32-bit

file.exe "C:\Program Files (x86)\Microchip\xc8\v1.32\bin\xc8.exe"
PE32 executable for MS Windows (console) Intel 80386 32-bit

am I missing sth here?

Your post sounds as if the patch is not working:

CAN NOT 'njoy! :-(

Patch anymore working...

Manuel.

It's annoying to post this way, what am I supposed to understand from this sentence: Patch anymore working..., you made me uninstall v1.31, download and install v1.32, test some codes to see if the license is working or not, here is what xc8 says about license (last line):

Code:
C:\Program Files (x86)\Microchip\xc8\v1.32\bin>xc8 --help
Microchip MPLAB XC8 C Compiler V1.32
Part Support Version: 1.32 (A)
Copyright (C) 2014 Microchip Technology Inc.
License type: Node Configuration

Please check before posting so you don't waste other members' time, even if you are right, add more lines so we understand what you are trying to say..


Title: Re: XC8 Compilers - Discussion
Post by: Manuel on June 10, 2014, 12:30:45 12:30
Agree. Sorry!

about x32/x64...the same executable is suitable for both OS.

Anyhow, previous version location place: http://www.microchip.com/pagehandler/en-us/devtools/dev-tools-parts.html
direct link: http://ww1.microchip.com/downloads/en/DeviceDoc/xc8-v1.31-win.exe

once installed at compiling time you receive the following...
"Running this compiler in PRO mode, with Omniscient Code Generation enabled,
produces code which is typically 40% smaller than in Free mode.
The MPLAB XC8 PRO compiler output for this code could be 493 words smaller.
See http://microchip.com for more information."

so patch is out of work..

Manuel.


Title: Re: XC8 Compilers - Discussion
Post by: Catcatcat on June 10, 2014, 01:51:48 13:51
Regardless of the option selected compilation v32 works only in Free Mode, the virus mutated :D, you need a new drug :(


Title: Re: XC8 Compilers - Discussion
Post by: petarp on June 16, 2014, 12:23:18 12:23
Hi,
Solution for new release is:
 1. Open "C:\Program Files\Microchip\xc8\v1.32\bin\picc.exe" file with hex editor.
 2. Find these bytes "74 16 83 EC 08 56" and replace first two bytes with "90" ("90 90 83 EC 08 56").
 3. Find these bytes "74 15 83 C3" and replace first byte with "EB" ("EB 15 83 C3").
 4. Do same with "C:\Program Files\Microchip\xc8\v1.32\bin\picc18.exe" file.
 5. And use latest "xclm" file from here.

They check for modified xclm file as is in latest XC32 release.

Regards.
 


Title: Re: XC8 Compilers - Discussion
Post by: Wannabe on June 16, 2014, 01:53:00 13:53
Hi,
Solution for new release is:
 1. Open "C:\Program Files\Microchip\xc8\v1.32\bin\picc.exe" file with hex editor.
 2. Find these bytes "74 16 83 EC 08 56" and replace first two bytes with "90" ("90 90 83 EC 08 56").
 3. Find these bytes "74 15 83 C3" and replace first byte with "EB" ("EB 15 83 C3").
 4. Do same with "C:\Program Files\Microchip\xc8\v1.32\bin\picc18.exe" file.
 5. And use latest "xclm" file from here.

They check for modified xclm file as is in latest XC32 release.

Regards.
 
I took the liberty of making a patch using your findings. All credits go to you, petarp :)
As always, antivirus may say something about the patch. I've included the dup2-project.
Link for patch included in my next message below.


Title: Re: XC8 Compilers - Discussion
Post by: Catcatcat on June 16, 2014, 06:09:01 18:09
Many thanks petarp! It works!


Title: Re: XC8 Compilers - Discussion
Post by: Wannabe on June 18, 2014, 12:19:52 12:19
It seems the file cgpic.exe and cgpic18.exe perform the same checks for xclm.exe .
Unsure if it has an impact on compilation.
I have included a new XC8 Patcher that take care of this, just in case.


Title: Re: XC8 Compilers - Discussion
Post by: microcris on June 18, 2014, 01:13:01 13:13
Hello everyone :)

Hi,
Solution for new release is:
 1. Open "C:\Program Files\Microchip\xc8\v1.32\bin\picc.exe" file with hex editor.
 2. Find these bytes "74 16 83 EC 08 56" and replace first two bytes with "90" ("90 90 83 EC 08 56").
 3. Find these bytes "74 15 83 C3" and replace first byte with "EB" ("EB 15 83 C3").
 4. Do same with "C:\Program Files\Microchip\xc8\v1.32\bin\picc18.exe" file.
 5. And use latest "xclm" file from here.

They check for modified xclm file as is in latest XC32 release.

Regards.
 

How do you found those bytes, the right bytes to change?

I'm on linux and, obviously, the bytes to change are different.  

Like you said, they check for the xclm authenticity. If I make a
Quote
strace ./picc18 --help

among many things I get:
Quote
write(1, "\n", 1)     = 1
open("/opt/microchip/xc8/v1.32/bin/xclm", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\2\0\3\0\1\0\0\0@\245\4\0104\0\0\0"..., 16384) = 16384

then I can make a objdump:
Code:
objdump -D -S -r -j .text ./picc18
and I get this (posting only a small part)
Quote
./picc18:     file format elf32-i386


Disassembly of section .text:

08048130 <.text>:
 8048130:   31 ed                   xor    %ebp,%ebp
 8048132:   5e                      pop    %esi
 8048133:   89 e1                   mov    %esp,%ecx
 8048135:   83 e4 f0                and    $0xfffffff0,%esp
 8048138:   50                      push   %eax
 8048139:   54                      push   %esp
 804813a:   52                      push   %edx
 804813b:   68 90 f2 07 08          push   $0x807f290
 8048140:   68 d0 f2 07 08          push   $0x807f2d0
 8048145:   51                      push   %ecx
 8048146:   56                      push   %esi
 8048147:   68 80 fa 04 08          push   $0x804fa80
 804814c:   e8 af 6b 03 00          call   0x807ed00

But still, I can't find a relation between the bytes in the objdump and the place where the file is opened and where they make a decision if the file is original or not.

Does anyone can help in this ? :D


Title: Re: XC8 Compilers - Discussion
Post by: Top on June 18, 2014, 04:09:06 16:09
Just to let you know I updated my XC License Manager fix.

It patches if necessary and works with XC8, XC16 & XC32 on Windows, Linux & Mac OSX.

http://www.sonsivri.to/forum/index.php?topic=44014.msg129986#msg129986 (http://www.sonsivri.to/forum/index.php?topic=44014.msg129986#msg129986)


Title: Re: XC8 Compilers - Discussion
Post by: microcris on June 18, 2014, 04:29:22 16:29
Just to let you know I updated my XC License Manager fix.

It patches if necessary and works with XC8, XC16 & XC32 on Windows, Linux & Mac OSX.

http://www.sonsivri.to/forum/index.php?topic=44014.msg129986#msg129986 (http://www.sonsivri.to/forum/index.php?topic=44014.msg129986#msg129986)

It's working on Linux
Quote
Microchip MPLAB XC8 C Compiler (PRO Mode) V1.32
Part Support Version: 1.32 (A)

I'm seeing that your xclm is no longer a simple license manager :D it also makes some more magic :)
thanks


Title: Re: XC8 Compilers - Discussion
Post by: waicon on June 19, 2014, 01:12:42 13:12
my not working  >:(
i replace xclm.exe and ran once as admin, not works

see txt


Title: Re: XC8 Compilers - Discussion
Post by: Top on June 19, 2014, 01:22:03 13:22
Open a command prompt, CD to your install folder (CD C:\Program Files (x86)\Microchip\xc8\v1.32\bin\) and type xclm[Enter].

Do you see any output?


Title: Re: XC8 Compilers - Discussion
Post by: microcris on June 19, 2014, 01:23:46 13:23
my not working  >:(
i replace xclm.exe and ran once as admin, not works

see txt

Just to be sure...
Do you made a copy of the original xclm.exe and named it as xclm.old?


Title: Re: XC8 Compilers - Discussion
Post by: waicon on June 19, 2014, 02:06:02 14:06
yes, even , uninstall and install,
PRO mode batch file include here.
show today "dead"
Code:
echo.
echo Creating license file %FILE%
echo This license created by Microchip Web Activation >> %FILE%
echo Please do not edit the contents of this file >> %FILE%
echo Created on 4/19/2014 1:26:57 AM >> %FILE%
echo. >> %FILE%
echo. >> %FILE%
echo LICENSE microchip swxc8-demo 1.0 19-jun-2014 uncounted >> %FILE%
echo   hostid=002622007621 _ck=f432fc0b5a sig=^"60PG453YDGS799T5K9UMW85UMTVR >> %FILE%
echo   M62QPQ9Y1X022M0940JBF2FS5SPFR6NY34NGER67509DDD6G^" >> %FILE%
echo. >> %FILE%
echo. >> %FILE%



Title: Re: XC8 Compilers - Discussion
Post by: Top on June 19, 2014, 02:19:59 14:19
@waicon

Open a command prompt, CD to your install folder (CD C:\Program Files (x86)\Microchip\xc8\v1.32\bin\) and type xclm[Enter].

Do you see any output?


Title: Re: XC8 Compilers - Discussion
Post by: waicon on June 19, 2014, 02:32:02 14:32
yes patched
i'm mis-take rename to xclm.exe.old

********It's works**********


Title: Re: XC8 Compilers - Discussion
Post by: microcris on June 19, 2014, 02:37:34 14:37
In the first time I also forgot to create the xclm.old but the new xclm warned me that it was unable to find the xclm.old.



Title: Re: XC8 Compilers - Discussion
Post by: waicon on June 19, 2014, 02:37:53 14:37
but how come the code size not reduce?


Title: Re: XC8 Compilers - Discussion
Post by: metal on June 19, 2014, 04:46:57 16:46
may be your project setting is still not in PRO mode.

In the project properties: XC8 Global Options > XC8 Compiler > In Options categories select optimizations, you will find operation mode: Free, Standard and PRO


Title: Re: XC8 Compilers - Discussion
Post by: waicon on June 19, 2014, 08:53:33 20:53
works now  ;D. in PRO mode drop 9.7%
Code:
--------
Memory Summary:
    Program space        used   295h (   661) of   800h words   ( 32.3%)
    Data space           used    25h (    37) of    E0h bytes   ( 16.5%)
    EEPROM space         used     0h (     0) of    80h bytes   (  0.0%)
    Data stack space     used     0h (     0) of    50h bytes   (  0.0%)
    Configuration bits   used     1h (     1) of     1h word    (100.0%)
    ID Location space    used     0h (     0) of     4h bytes   (  0.0%)
-------


Title: Re: XC8 Compilers - Discussion
Post by: h0nk on June 20, 2014, 05:56:38 17:56
Hello,

i was not able to customize the hotkeys in XC8 V1.31 together with MPLAB 8.90.
Is this fixed in XC8 V1.32?

Best Regards


Title: Re: XC8 Compilers - Discussion
Post by: juvann on July 13, 2014, 03:30:53 15:30
Now xc8 calculate the sha1sum of file xclm in a wrong way I don't understand yet
For linux version 1.32 with can change 2 byte at offset 0x33899 from 0x75 0xdd to 0x90 0x90 and should be work without problems with xclm compiled from my source code



Title: Re: XC8 Compilers - Discussion
Post by: Wannabe on July 14, 2014, 01:40:37 01:40
Now xc8 calculate the sha1sum of file xclm in a wrong way I don't understand yet
For linux version 1.32 with can change 2 byte at offset 0x33899 from 0x75 0xdd to 0x90 0x90 and should be work without problems with xclm compiled from my source code


I think Top has solved that problem already, it's a SHA0 checksum, not SHA1.


Title: Re: XC8 Compilers - Discussion
Post by: Finzi on July 31, 2014, 03:35:10 03:35
In my case, MAC OS X 10.9.2, it is not working.
First, I've renamed xclm to xclm.old.
Second, I've copied patch to bin folder.
Third, I've executed command "chmod 755 xclm" in order to add the execute attribute to xclm file.
Fourth, I've executed "sudo xclm". Nothing happend. Not even a warning message.

Am I doing something wrong?

Thanks in advance.


Title: Re: XC8 Compilers - Discussion
Post by: Top on July 31, 2014, 09:38:07 09:38
In my case, MAC OS X 10.9.2, it is not working.

Which version of the fix and XC compiler are you using?


Title: Re: XC8 Compilers - Discussion
Post by: Finzi on July 31, 2014, 01:18:06 13:18
Compiler version: 1.32 with the latest fix (19-Jun-2014). Maybe I'm doing something wrong, but o don't know what could be.  ???


Title: Re: XC8 Compilers - Discussion
Post by: Top on July 31, 2014, 09:56:41 21:56
Compiler version: 1.32 with the latest fix (19-Jun-2014). Maybe I'm doing something wrong, but o don't know what could be.  ???

Please double check; open a terminal, change to the directory where xclm is and enter ./xclm


Title: Re: XC8 Compilers - Discussion
Post by: Finzi on July 31, 2014, 11:37:37 23:37
It worked!!!! :D
The problem was related to the way I was trying to run xclm. Using the sintaxe you gave-me "./xclm" solved the problem.

Thanks a lot!!!


Title: Re: XC8 Compilers - Discussion
Post by: Catcatcat on September 06, 2014, 11:13:24 11:13
MPLAB® XC8 Compiler v1.33 (http://www.microchip.com/mplabxc8windows)
 :D


Title: Re: XC8 Compilers - Discussion
Post by: TucoRamirez on September 06, 2014, 04:27:52 16:27
my complaint with the compiler is that it 'decides' what to compile in certain cases.   for no reason, when i was using a variable in a loop and loading values inside and reusing outside the loop and compiler (with and without optimisations enabled)  told me in the log file "variable unused" and did not compiled some lines of code, then i got weird behavior while debugging coff file..  does anybody have experienced that behavior?


Title: Re: XC8 Compilers - Discussion
Post by: dennis78 on September 07, 2014, 02:55:34 02:55
my complaint with the compiler is that it 'decides' what to compile in certain cases.   for no reason, when i was using a variable in a loop and loading values inside and reusing outside the loop and compiler (with and without optimisations enabled)  told me in the log file "variable unused" and did not compiled some lines of code, then i got weird behavior while debugging coff file..  does anybody have experienced that behavior?

I don't have experience with this compiler, but did you try with "volatile" keyword?


Title: Re: XC8 Compilers - Discussion
Post by: microcris on September 07, 2014, 10:41:57 10:41
I don't have experience with this compiler, but did you try with "volatile" keyword?


Long time ago I passed through this and it was, in fact, all about the volatile directive. (And that's how I learned how and when to use the volatile keyword  :))


Title: Re: XC8 Compilers - Discussion
Post by: jcddcjjcd on September 08, 2014, 08:43:12 08:43
What is the perception of XC8 as compared to C18. I waited until recently to change since C18 is no longer supported and so far after a couple of weeks I am finding the amount of changes the need to be made to code is enormouse. Also ccp.exe seems to crash frequently for something as simple as an unneeded hex file being included.
I am thinking of sticking with C18 for a while longer.

Anyone have opinions on XC8 they could share with me.

Regards,
John.


Title: Re: XC8 Compilers - Discussion
Post by: Beltza on September 08, 2014, 10:13:49 10:13
XC8 and C18 are two different beasts. XC8 is derived from HiTech PICC. Microchip adquired HiTech.


Title: Re: XC8 Compilers - Discussion
Post by: jcddcjjcd on September 09, 2014, 06:38:19 06:38
I think my problems arise from not understanding how XC8 does things.
For example in converting my USB HID Bootloader I finally realized I was better using TBLPRT and TABLAT directly instead of using pointers.
When a ROM pointer is passed and the address is outside the normal programming range as when reading and writing userid and config words it changes the upper byte of TBLPTR to 20 from 30. Probably it assumes you would not want to do that.

Another sticky thing was that in my struct that holds the packet data relating to a bootloader operation I used uint24_t to allow for the 3bytes address but XC8 changed that to a 32 bit value even thought there was a union of 3bytes associated with it. That would have been alright if XC8 had shifted the rest of the struct up by one byte but it happily went along and my data[] was out by a byte.
By going back to unsigned short long everything was OK again except for the warning every time an unsigned short long is used.
I have plenty of unsigned short long the for the rest it works.

I have a question though.
Should I be using XC8 in CCI mode or not. Just changing it requires a whole bunch of other code edits.
Do people mainly use CCI?

Regards,
John.


Title: Re: XC8 Compilers - Discussion
Post by: jcddcjjcd on September 12, 2014, 04:06:07 04:06
Well, all sorted now. Managed to make a HID bootloader out of the latest framework, the last one I could shrink to under 0x1000 was v2.1 and now they are up to v2.11 so that was pleasing.
Now that I have converted most of my projects over to XC8 and have more experience with it I do like it a lot more the C18 so it was worth the trouble.

Regards,
John.


Title: Re: XC8 Compilers - Discussion
Post by: jnz on September 26, 2014, 11:14:45 23:14
I'm liking more than C18 for certain.

The trouble I'm having is that exceptionally few RTOS have coded to XC8.


Title: Re: XC8 Compilers - Discussion
Post by: donhamilton on November 10, 2014, 03:03:56 03:03
What is the size of the xclm.old file ?

I think I deleted the wrong file.  :'(


Title: Re: XC8 Compilers - Discussion
Post by: Slasher on November 14, 2014, 07:30:16 07:30
Hi,

xclm.exe delivered with XC8 v1.33B is 924.160 bytes.


Title: Re: XC8 Compilers - Discussion
Post by: Manuel on January 07, 2015, 02:28:27 14:28
Released Update to XC8 part support v1.33D:
http://ww1.microchip.com/downloads/en/DeviceDoc/xc8-v1.33D-part-support-windows-installer.exe

Manuel.


Title: Re: XC8 Compilers - Discussion
Post by: yoda2020 on February 16, 2015, 10:23:16 10:23
my complaint with the compiler is that it 'decides' what to compile in certain cases.   for no reason, when i was using a variable in a loop and loading values inside and reusing outside the loop and compiler (with and without optimisations enabled)  told me in the log file "variable unused" and did not compiled some lines of code, then i got weird behavior while debugging coff file..  does anybody have experienced that behavior?

This can get particularly annoying with routines using SPI where you need to ensure you clear SSPBUF by reading it then discarding the result. XC8 and Hi-Tech PICC both 'optimize' out code that has no further action. I think the suggestion here is to define the variable to we put SSPBUF into as volatile, I'll give that a try.

Thanks for the idea as it's much more elegant than my approach of adding an if(....) type structure after the SSPBUF read to fool the compiler. If anyone has a tried and trusted method for such circumstances I'd really love to hear it.

Dave


Title: Re: XC8 Compilers - Discussion
Post by: Linko on February 16, 2015, 04:14:33 16:14
Dave,
in my code to manage UART I had a similar need: in case of error it becomes necessary to clear the RCREG by reading it.

I've used in the past the volatile variable approach, but I found later I could simply put a "RCREG;" statement, i.e. without any explicit assignment.
XC8 (1.33) compiler generates the correct opcode, a simple assignment to w register.

...
  2858                                   ;rs232.c: 162: RCREG;
  2859  001A36  50AE                  movf   4014,w,c   ;volatile
...



Linko


Title: Re: XC8 Compilers - Discussion
Post by: jnz on February 16, 2015, 04:32:38 16:32
Dave,
in my code to manage UART I had a similar need: in case of error it becomes necessary to clear the RCREG by reading it.

I've used in the past the volatile variable approach, but I found later I could simply put a "RCREG;" statement, i.e. without any explicit assignment.
XC8 (1.33) compiler generates the correct opcode, a simple assignment to w register.

...
  2858                                   ;rs232.c: 162: RCREG;
  2859  001A36  50AE                  movf   4014,w,c   ;volatile
...



Linko

I'm still using volatile if the issue comes up, I just watch for "variable is not used" in the output... But that still doesn't mean this is a good compiler or a good option. Everyday, PIC is pushing me further into ARM's arms.


Title: Re: XC8 Compilers - Discussion
Post by: Manuel on February 27, 2015, 12:32:21 12:32
Released Update to XC8 v1.34.
>>New license manager and installers

and to XC8 part support v1.34.
Released Update to MPLABX v2.35 and Released BETA MPLABX v3.0.

>> TOP, great WORK U DID! <<

I confirm the claimed: Comparison optimizations Code associated with equality and relational comparisons has been improved in many situations.... (in one of my case test the generated moved from 502 to 497...and the generated work :-) )

Manuel


Title: Re: XC8 Compilers - Discussion
Post by: Cybernando on March 03, 2015, 04:08:54 16:08
xc8 v1.34 error USB hid framework !!!


Code:
microchip/mla/v2014_07_22/framework/usb/src/usb_device.c:25039: error: (800) undefined symbol "l11805"
(908) exit status = 1


with v1.33 all ok


Title: Re: XC8 Compilers - Discussion
Post by: Manuel on June 13, 2015, 02:29:52 14:29
UPDATED: XC8 Compiler Part-Support Patch v1.34B

manuel.


Title: Re: XC8 Compilers - Discussion
Post by: Manuel on July 11, 2015, 09:31:07 09:31
Seen XC8 3 compiler "issues"... and related workaround...

1) BIT vars are located on a different BANK for some processors even if there is still space in the main bank. This involve into BANK SWITCHING compiler instruction generation. So code is not optimized. It has been checked in the trial PRO mode.

workaround:
use UNION bits with a char. Then this char (bits) are placed on the same main BANK (if still space is present).
So this avoid unnecessary "buggy" BANK SWITCHING..... so you use less power...power optimized application.

2) condition:
if you use just 1 BANK....without bank switching.....the following sequence

WAIT_VREG:
   NOP();
   if(nDONE) goto WAIT_VREG;

become in generated ASM:

181  126                     l508:   
   182                          
   183                           ;main.c: 195: __nop();
   184  126  000                   nop
   185                          
   186                           ;main.c: 196: if(nDONE) goto WAIT_VREG;
   187  127  4A4                   bcf   4,5   ;FSR5=0, select bank0
   188  128  628                   btfsc   8,1   ;volatile
   189  129  B26                   goto   l508

the BOLD instruction is silly added by the compiler.....and it is generated by using the NOP(); instruction.

workaround:

generate a BIT var,

WAIT_TEMP:   
        BITS.BITs.DUMMY=0;
   if(nDONE) goto WAIT_TEMP;   

become in generated ASM:

181  128                     l506:   
   182                          
   183                           ;main.c: 197: BITS.BITs.DUMMY=0;
   184  128  452                   bcf   _BITS,2
   185                          
   186                           ;main.c: 198: if(nDONE) goto WAIT_VREG;
   187  129  628                   btfsc   8,1   ;volatile
   188  12A  B28                   goto   l506

now it's optimized!

3) xc8 TERRIBLE GENERATED CODE 1 MORE INSTRUCTION USED.
196                           ;main.c: 205: Mean=(TMR0&0x07);
   197  12F  201                   movf   1,w   ;volatile
   198  130  038                   movwf   _Mean
   199  131  C07                   movlw   7
   200  132  178                   andwf   _Mean,f

RIGHT OPTIMIZED GENERATED CODE :

 82                           ;main.c: 190: Mean=(TMR0&0x07);
    83  134  201                   movf   1,w   ;volatile
    84  135  E07                   andlw   7
    85  136  034                   movwf   _Mean

what a terrible compiler.....i PERSONALLY STOP COMPARING....IN A SOURCE I COMPILED THERE ARE SO MANY ISSUES ABOUT OPTIMIZZATION.....

how many further work around should have to find to such optimization issue?

for this reason i prefer always to write my own asm.

manuel.



Title: Re: XC8 Compilers - Discussion
Post by: flo0319 on July 11, 2015, 04:45:28 16:45
Hi manuel, can you please to tell me which xc8 version have you used for those examples? and also if you are using in optimization the option +space. Thanks 


Title: Re: XC8 Compilers - Discussion
Post by: Manuel on July 12, 2015, 07:36:40 07:36
The "issue" is present on both 1.33 and 1.34 compilers.

The second compiler used for comparing....is not important...since the evidence is logically clear, the compiler leak in his management. and it's quite strange from my point of view. Strange is the fact that the compiler developer did not see such silly problems....or better did not tight the proper solutions ....

+space was not used.

Anyhow....just to complete the question, TWO more "ISSUEs"...that make me decide to avoid using XC8, and go on with ASM coding...

all vars are UNSIGNED CHAR !
apart for IO_IMAGE....that is a UNION bit.

XC8 "ISSUE" 1:

520                           ;main.c: 377: if(DB == IntCount) IO_IMAGE.PIN.PIN_B =0;
   521  1DA  217                   movf   _IntCount,w
   522  1DB  02F                   movwf   15
   523  1DC  193                   xorwf   _DB,w
   524  1DD  643                btfsc   3,2
   525  1DE  4B6                   bcf   _IO_IMAGE,5
   526                          
   527                           ;main.c: 378: if(DG == IntCount) IO_IMAGE.PIN.PIN_G=0;
   528  1DF  217                   movf   _IntCount,w
   529  1E0  02F                   movwf   15
   530  1E1  194                   xorwf   _DG,w
   531  1E2  643                   btfsc   3,2
   532  1E3  436                   bcf   _IO_IMAGE,1
   533                          
   534                           ;main.c: 379: if(DR == IntCount) IO_IMAGE.PIN.PIN_R =0;
   535  1E4  217                   movf   _IntCount,w
   536  1E5  02F                   movwf   15
   537  1E6  195                   xorwf   _DR,w
   538  1E7  643                   btfsc   3,2
   539  1E8  496                   bcf   _IO_IMAGE,4

15 instructions.

Right Compiling instead:

;main.c: 361: if(DB == IntCount) IO_IMAGE.PIN.PIN_B =0;
339                           ;main.c: 361: {
   340  1DD  20E                movf   _DB,w
   341  1DE  192                   xorwf   _IntCount,w
   342  1DF  643                   btfsc   3,2
   343  1E0  4B1                   bcf   _IO_IMAGE,5
   344                           ;main.c: 363: if(DG == IntCount) IO_IMAGE.PIN.PIN_G=0;
   345  1E1  20F                   movf   _DG,w
   346  1E2  192                   xorwf   _IntCount,w
   347  1E3  643                   btfsc   3,2
   348  1E4  431                   bcf   _IO_IMAGE,1
   349                           ;main.c: 364: if(DR == IntCount) IO_IMAGE.PIN.PIN_R =0;
   350  1E5  210                   movf   _DR,w
   351  1E6  192                   xorwf   _IntCount,w
   352  1E7  643                   btfsc   3,2
   353  1E8  491                   bcf   _IO_IMAGE,4

12 instructions.

It maybe seems silly 12 vs 15 is really important in optimizzation....

XC8 "ISSUE" 2:
520                           ;main.c: 377: if((DB - IntCount)==0) IO_IMAGE.PIN.PIN_B =0;
   521  1D2  213                   movf   _DB,w
   522  1D3  02A                   movwf   10
   523  1D4  06B                   clrf   11
   524  1D5  20B                   movf   11,w
   525  1D6  02F                   movwf   15
   526  1D7  217                   movf   _IntCount,w
   527  1D8  08A                   subwf   10,w
   528  1D9  02E                   movwf   14
   529  1DA  703                   skipc
   530  1DB  0EF                   decf   15,f
   531  1DC  10F                   iorwf   15,w
   532  1DD  643                   btfsc   3,2
   533  1DE  4B6                   bcf   _IO_IMAGE,5

Can it be possible no one have ever seen this? I can not believe !!!!
essentially a ZERO compare con unsigned bytes can not be converted in a real MATH sequence!!

hope more real improvement will be done on this compiler and not just adding processors....

Now the questions are:
- does XC8 compile same way for XLP processors? if so, why such effort to add XLP family processors if compiler then does not respect the investments done to realize XLP? (terrible)
-who produce a real optimized compiler for the MICROCHIP family processors?
-does both XC16 and XC32 have been developed with same core?

manuel.


Title: Re: XC8 Compilers - Discussion
Post by: flo0319 on July 12, 2015, 12:27:29 12:27
Hi again and many thanks for all those examples, will be very nice for me if you can add the c code for the last 2 issues (more interesting will be how they are declared ).
I am very interested in this compiler optimization problems and I have seen similar problems. I do not understand why it save the previous value of IntCount, are you use a re-entrant model? for which controller are you build this code?
Thanks a lot!


Title: Re: XC8 Compilers - Discussion
Post by: Manuel on July 12, 2015, 02:40:59 14:40
Mchp Man!

Anyhow, NO REENTRANT.

some declares to workaround compiler ISSUES discussed:

pack in BANK0 if there is space....otherwise if vars declared as BITS goes on BANK1

typedef union
{
   struct
   {
         unsigned DID                   : 1;
         unsigned GOT_FIRST_T      : 1;
         unsigned DUMMY                 : 1;
        unsigned                       : 5;

   } BITs;   
   unsigned char BITS_ALL;
} BITS_VAL;

As requested:

unsigned char DB;
unsigned char DG;
unsigned char DB;
unsigned char IntCount;

STRANGE MANAGEMENT see the following with XC8 1.33 and 1.34 for two different COMPAREs:

   554                           ;main.c: 385: if(DB != 63) IO_IMAGE.PIN.PIN_B =1;
   555  1ED  C3F                   movlw   63
   556  1EE  193                   xorwf   _DB,w
   557  1EF  743                   btfss   3,2
   558  1F0  5B6                   bsf   _IO_IMAGE,5

if you compare to the  following you will notice one time not optimed...one time correct....a ZERO compare and  a non zero value compare....

   520                           ;main.c: 377: if(DB == IntCount) IO_IMAGE.PIN.PIN_B =0;
   521  1DA  217                   movf   _IntCount,w
   522  1DB  02F                   movwf   15
   523  1DC  193                   xorwf   _DB,w
   524  1DD  643                btfsc   3,2
   525  1DE  4B6                   bcf   _IO_IMAGE,5

I also checked just for my personal interest many other interesting ISSUES....and till XC8 is not as I would like it could be....I will only go on writing my own ASM.

Anyhow, PIC12F5xx checked....but same issues apply to many other target processor.

Hope can help someone to decide direction when deciding to do investments...fortunately the trial exhist.

manuel.


Title: Re: XC8 Compilers - Discussion
Post by: ptr on July 12, 2015, 09:55:49 21:55
@Manuel

did you do this tests when the compiler is installed as a demo?

If yes please read here:
http://www.t4f.org/articles/optimization-of-microchip-pic-xc8-compiler-in-free-and-pro-mode/ (http://www.t4f.org/articles/optimization-of-microchip-pic-xc8-compiler-in-free-and-pro-mode/)


Title: Re: XC8 Compilers - Discussion
Post by: Manuel on July 13, 2015, 08:11:05 08:11
No, as time limited PRO mode.

I checked even FREE mode in advance just to compare both results...and FREE is FREE and PRO is PRO, but the PRO mode does not satisfy obvious optimizations. This is the question. And consider that it should be so easy to adjust the PRO mode to be really efficient.... I do not understand why noone ever considered or discussed really those questions in deep detail. I would have expected XC8, since the development stared many years ago deriving from HI-TECH compiler, could be more efficient, cosidering even that the old HI-TECH itself is more efficient in general for the supported processors....

Manuel.


Title: Re: XC8 Compilers - Discussion
Post by: Manuel on July 17, 2015, 07:07:42 19:07
Got the question about unoptimized compiler...

At a certain point developers decided to use a resister variable located in BANK0 (I saw) as temporary storage in place of the W register..
This is suitable for processors where INT have to be managed in a "certain way"...but for code where no interrupt are used..this management is a BAD way to get optimized code...

This is mainly the question I think.

Related to BIT question.... an ODD BANKING is present starting from 9.60PL4. Anyhow you have the wayout explained previously.

Hope this can help for further development including compiler developer too.

I know not all is easy to be done but at least managing exceptions can help many developers i think.....so I go on with ASM.

take care,
Manuel.


Title: Re: XC8 Compilers - Discussion
Post by: Manuel on September 17, 2015, 12:21:42 12:21
UPDATED: XC8 Compiler Part-Support Patch v1.35B

manuel.


Title: Re: XC8 Compilers - Discussion
Post by: Catcatcat on January 28, 2016, 03:52:03 15:52
MPLAB® XC8 Compiler v1.36 (http://www.microchip.com/mplabxc8windows)
medicine is working!


Title: Re: XC8 Compilers - Discussion
Post by: nagkiller on January 30, 2016, 02:31:17 14:31
Where is medicine???


Title: Re: XC8 Compilers - Discussion
Post by: Thiru09 on January 30, 2016, 03:21:00 15:21
Quote
Where is medicine???

http://www.sonsivri.to/forum/index.php?topic=44014.0


Title: Re: XC8 Compilers - Discussion
Post by: ferdok9 on March 18, 2016, 10:03:03 22:03
MPLAB® XC8 Compiler v1.37
medicine is working!


Title: Re: XC8 Compilers - Discussion
Post by: koky on March 20, 2016, 12:18:49 12:18
where have you find 1.37 version?


Title: Re: XC8 Compilers - Discussion
Post by: flo0319 on March 20, 2016, 01:38:49 13:38
where have you find 1.37 version?

On microchip website www.microchip.com/mplabxc8windows (http://www.microchip.com/mplabxc8windows) , the page (http://www.microchip.com/mplab/compilers (http://www.microchip.com/mplab/compilers)) still show version 1.36 but if you download it you will get version 1.37


Title: Re: XC8 Compilers - Discussion
Post by: jumulab on June 17, 2016, 09:00:28 09:00
I'm working with the XC8 compiler under MPLAB X IDE V3.30 and  need  the compiler do not initialize to zero
all  RAM registers when restart  or reset the program whitout removing power.

Any user know how I can do this ?.
Thx's


Title: Re: XC8 Compilers - Discussion
Post by: mars01 on June 17, 2016, 11:33:33 11:33
I'm sorry to say but your question needs to be improved otherwise it will not receive a full answer. I bet many saw your question and moved on because the question is not clear.

I understand that you work with XC8 compiler and MPLABX. The rest is just mixed ideas.

Just my 2 cents: if you are after a software reset you can use information's from here:

http://microchip.wikidot.com/8bit:rst

or use a Watchdog timer to perform the reset:
http://microchip.wikidot.com/8bit:wdt



Title: Re: XC8 Compilers - Discussion
Post by: metal on June 17, 2016, 12:47:43 12:47
when I read your answer I thought you fully understood his question.. seems the guy is seeking a way to force the compiler not to reset the variable (all all RAM locations) to zero after reset. the reset part is the easy one : -)


Title: Re: XC8 Compilers - Discussion
Post by: mars01 on June 17, 2016, 03:53:42 15:53
Maybe is something with me today, but I could not understand completely what he wanted. Sorry!

As far as I understand a software reset does not clear RAM in a hardware way (MCLR reset count as a pin-based software reset also).
Indeed XC compiler inserts some code to zero all RAM variables before calling main() function.

This can be overridden by using the __persistent attribute.

Page 63 in XC8 compiler manual, found here: http://ww1.microchip.com/downloads/en/DeviceDoc/MPLAB_XC8_C_Compiler_User_Guide.pdf
says that, and I quote:

"3.5.12 How Can I Stop Variables Being Cleared at Startup?
Use the persistent qualifier (see Section 5.4.8.1 “Persistent Type Qualifier”),
which will place the variables in a different psect that is not cleared by the runtime
startup code."

As for the registers, some will be hardware reset and that cannot be changed (maybe if you write the registers in EEPROM each time you change the registers and then if a reset is detected, some start-up code will restore them) and some will be not.


Title: Re: XC8 Compilers - Discussion
Post by: jumulab on June 18, 2016, 07:21:15 19:21
Hi mars01 and metal,
thank you for your help. As mars01 noted, a good ide ais use the __persistent qualifier.
ASAP I will check this behaviour  in the compiler  work.
I am not too instructed in this compiler, because normally I am using Renesas and some ARM devices under
IAR compilers and Atmel Studio.
Metal has catch the exact sense of my question.
After the reset,  some compilers, XC8 too, call some "lowlevel" function to initialize the processor internal
registers, memory, peripherals , etc. 
In IAR compiler, normally  has a lowlevel_init.c  or similar function to do this.
In the XC8,  you can see in the ..\xc8\v1.36\dat   some *.dat files with informations about the processor configuration
and in the ..\xc8\v1.36\sources\pic\ powerup.as
This file , you can get a copy and insert in your project to do an initializAtion of the processor before the compiler call
to main() function. The bad new : this file are assembler, and if we are working in "C", is a troouble.

A better explanation of my question:
Assumed we have  1K of RAM memory,  after the reset and before main is called, the compiler place some code to
clear ALL ram,  and I need  a block without any changes.
Thing , if I am working and an unexpected RESET, is done ( watch-dog, EMI noise, etc),  I need  some variables
not be touched , to remember some states of the machine.
Of course, if the  reset is done by an power up , or from a switch off/on, these variables , will be set to zero
by code.  ( I maintain some "keys" or  block CRC to  check the health of variables).

I have asked tro Microchip support, expect some answer soor.
Thanks again !     and sorry for my english!


Posted on: June 18, 2016, 08:13:20 20:13 - Automerged

Hi again mars01,
I have found and read the paragraph you mentioned in the XC8 manual, and OOOPS !   that is !.
Is the good answer.

Thanks a lot.


Title: Re: XC8 Compilers - Discussion
Post by: mars01 on June 23, 2016, 10:10:04 22:10
Hi,
By accident I also came upon this setting in MPLABX that manage the RAM clear at runtime, maybe it will help.

(http://i63.tinypic.com/30w5wug.jpg)


Title: Re: XC8 Compilers - Discussion
Post by: jumulab on June 27, 2016, 04:54:20 16:54
Hi mars01,
the selection you mentioned work  as expected.
If you select x-Clear BSS   all variables defined  are cleared before  fisrt call in
main is called , in this compiler  SYSTEM_Initialize()
If you  select x-Initialize data, all,variables  defined like  : uint16_t var1 = 0x1234
when the program reaches main,  var1  value is 0x1234. If this selection is not selected,
when program goes to main, the value of var1 = 0 if the Clear Bss are selected, or
umpredictable is no.

Finally  the solution for the initially question has been solved  placing the group of
variables  into on strcut in the way : ( is an example)

__persistent  _st_NOVOLTIL {

    char rele1:1;
    char rele2:1;
    char rele3:1;
    char rele4:1;
    uint8_t ui8VAR1;
    uint8_t ui8VAR2;
    uint16_t ui16VAR1;

...  and so on ...

} st_NOVOLATIL.




Title: Re: XC8 Compilers - Discussion
Post by: Catcatcat on July 14, 2016, 04:25:32 16:25
MPLAB® XC8 Compiler v1.38 (http://www.microchip.com/mplabxc8windows)
medicine is working!


Title: Re: XC8 Compilers - Discussion
Post by: mars01 on December 14, 2016, 07:53:54 19:53
Just a small report: Mplab XC8 v1.40 is working as PRO with the current medicine.

As improvements, for now I can say that a project that was compiled with v1.38 took 572 RAM bytes and 1130 FLASH bytes, compiled with v1.40 occupy 571 RAM bytes and 1128 FLASH bytes in a 16F1938 microcontroller.


Title: Re: XC8 Compilers - Discussion
Post by: lm317 on December 16, 2016, 08:52:39 08:52
By new version, smaller than 1-2 byte! 
Very high improvement :)


Title: Re: XC8 Compilers - Discussion
Post by: mars01 on December 16, 2016, 07:10:46 19:10
I am sure that there are other changes under the hood. Also, maybe my code was not the best to test whatever changes they made: I have some big arrays of int's. Not much that can be improved there.
I just wanted to say that at least they did "something" to improve things.
Not to mention support for new controllers and maybe some fixes.


Title: Re: XC8 Compilers - Discussion
Post by: lcn on December 27, 2016, 05:51:13 17:51
With XC8 v1.40, i can't get the medecine working .

If i rename or delete original xclm.exe and then replace it by the medecine, compiler stays in FREE mode.

I tried to manually run the new xclm.exe from CMD console window as administrator, but still no chance.

Did i miss something ?


Title: Re: XC8 Compilers - Discussion
Post by: lm317 on December 27, 2016, 06:27:16 18:27
Renamed original xclm.exe  may not original! 

1- uninstall  and clear install folder.
2-Setup again. as free mode. After setup completed you have new original xclm.exe .
3- rename this original xclm.exe  as xclm.old
4-Copy medicine xclm.exe  to folder.
5-Cmd as administrator. Run this command
C:\Program Files (x86)\Microchip\MPLABX\v3.40\mplab_ide\bin>xclm.exe


resut as
.... patched
.... patched
.... patched
...  completed.


Title: Re: XC8 Compilers - Discussion
Post by: mars01 on December 27, 2016, 09:04:22 21:04
With XC8 v1.40, i can't get the medecine working .

If i rename or delete original xclm.exe and then replace it by the medecine, compiler stays in FREE mode.

I tried to manually run the new xclm.exe from CMD console window as administrator, but still no chance.

Did i miss something ?

It did happen to me once and since then what I do is:
1. move the original xclm.exe from the install folder somewhere else, like desktop.
2. rename the original xclm.exe to xclm.old
3. copy the cracked xclm.exe near the xclm.old file, e.g on desktop.
4. move both files at the same time to the XC8 install folder, where the original xclm.exe file use to be before step 1.
5. run xclm.exe as administrator

I don't know if this method is the only one that works, but it works for me.

In your case, before doing what I have wrote above, you need to uninstall the XC8 compiler, delete the XC8 folder and then reinstall the XC8 compiler. I say this, because once you see that the files can't be patched, my method will not work until you actually do the uninstall - reinstall thing.


Title: Re: XC8 Compilers - Optimizations
Post by: FTL on December 29, 2016, 05:09:00 17:09
I re-built my workbench PC last week and re-installed all the Microchip development tools:

 MPLab 3.45
 XC8    1.38 (1.40 is now out. 1.38 was current as of Dec. 03 when I downloaded it)
 XC16  1.30
 XC32  1.42

The medicine appeared to work fine, but to be sure, I created a simple but very useless main.c program and compiled a project on XC8, XC16 and XC32 with various levels of optimization. The program I compiled is the following:

Code:
/* A silly program just to test XC8, XC16, and XC32. */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, char * argv[]) {
  int Counter;
  char dum[100];
  for (Counter=0; Counter < 5000; Counter++) {
    if (argc < Counter) {
      argc++;
      Counter--;
      sprintf(dum,"%4d",Counter);
      Counter += (int)strcmp(dum,argv[0]);
    };
  };
  return 0;
};

I compiled essentially the same program under each compiler with different optimization levels and got the following results:

Code:
Compiler   Device            Version  Optimization     Program Code size (bytes)
XC32       PIC32MX230F256D   V1.42          0                 9508
                                            2                 9464
                                            S                 9448
XC16       PIC24F16KM202     V1.30          0                 2902
                                            2                 2912
                                            S                 2900
XC8        PIC18F25K50       V1.38          Free              1544
                                            STD                948
                                            PRO                838

This is probably not the best test program given that sprint probably makes up most of the compiled code, but it does show that the various optimization levels actually do make a difference so all three compilers are actually optimizing. Also I only tested with one device for each compiler. I can imagine that the optimization could be a lot different with different devices.

The program may be too small to optimize properly. XC16 actually produced larger code in Mode 2, and Mode S was only very slightly better than no optimizations. The purpose of the code was to prove that the optimizations were doing something, and they obviously are. The non-Free optimization with XC8 was the most dramatic.

The thing I have not proven is whether the optimizations will still work in a month. I'm not sure how to tell if the compilers really think they are properly licensed.


Title: Re: XC8 Compilers - Discussion
Post by: bluex on January 08, 2017, 01:55:33 01:55
By new version, smaller than 1-2 byte! 
Very high improvement :)

http://ww1.microchip.com/downloads/en/DeviceDoc/Readme_XC8_140.htm#TOC_WhatsNew


Title: Re: XC8 Compilers - Discussion
Post by: magician on January 13, 2017, 08:18:51 08:18
For reference:

Medium size project for PIC 18F4620, .hex outputs:

C18 in Pro mode: 58KB
XC8 v1.35 in Pro mode: 38KB
XC8 v1.40 in Free mode: 52KB
XC8 v1.40 in Standard mode: 45KB
XC8 v1.40 in Pro mode: 37KB

regards


Title: Re: XC8 Compilers - Discussion
Post by: chicowood on January 18, 2017, 10:58:13 22:58
With XC8 v1.40, i can't get the medecine working .

If i rename or delete original xclm.exe and then replace it by the medecine, compiler stays in FREE mode.

I've been having the same problem. I've got all versions up to 1.34 running in Pro Mode (MPLABX 3.51) but can't get 1.38 or 1.40 to go Pro. Tried all the recommendations in the posts above and more...no luck.

I can live with using 1.34 Pro and 1.40 Free, but I'm challenged to figure out why I can't get the later versions to work.

I see there's another xclm.exe inside the MPLABX bin folder...wonder if that has anything to do with it...anybody have further ideas?


Title: Re: XC8 Compilers - Discussion
Post by: mars01 on January 19, 2017, 12:24:49 00:24
@chicowood

I attach bellow the xclm files (xclm.old and xclm.exe) taken from my own 1.40 XC8 installation folder. Try to uninstall the XC8 compiler, clean the folder if something still remain inside (maybe use CCleaner to clean the registry), install again the XC8 compiler v 1.40,  then delete the original xclm.exe from the bin folder in the XC8 installation directory and lastly, copy the attached files into the bin folder in the XC8 installation directory.

Make sure UAC is disabled (who knows, it might be interfering somehow).
Open an command prompt windows, as administrator, CD to the bin directory of the XC8 installation and run xclm.exe - you should see a few lines saying something like "patching OK" (I don't remember exactly the wording).

My XC8 installation is in this location:
(http://i65.tinypic.com/e0626e.jpg)

If this is still not working then I don't know what will.

LE: Actually there may be another way ... I updated the attached file and added also the picc and pic18 files already patched. Maybe they will help you by replacing them in the installation directory.


Title: Re: XC8 Compilers - Discussion
Post by: chicowood on January 19, 2017, 12:27:32 00:27
Thanks, will try all and report back...


Title: Re: XC8 Compilers - Discussion
Post by: mars01 on January 19, 2017, 12:33:09 00:33
I've updated my previous post. See the edit.


Title: Re: XC8 Compilers - Discussion
Post by: Catcatcat on January 19, 2017, 04:09:45 04:09
Follow the instructions as described in the specification of the medicine. I have everything working, the operating system W10, MPLAB X 3.51. Do not forget to run xclm, as administrator.


Title: Re: XC8 Compilers - Discussion
Post by: Manuel on February 02, 2017, 12:42:48 12:42
Confirm XC8 v1.41 ok!

take care,
Manuel.


Title: Re: XC8 Compilers - Discussion
Post by: PM3295 on February 21, 2017, 04:38:02 16:38
I can't get v1.41 to patch. It keeps telling xclm.old not found when running xclm as admin, although it is there because if I run xclm.old it gives the "XCLM: Bad command line passed to license manager ..". I tried it on two different machines. Any ideas? This was a fresh download and installed from Microchip site yesterday.

Thanks.


Title: Re: XC8 Compilers - Discussion
Post by: h0nk on February 21, 2017, 11:37:43 23:37
Hello PM3295,

just check this:
Code:

>md5sum xclm.old
6f40ab2c41589af127f3fc0918758c15 *xclm.old

>md5sum xclm.exe
10ced13a23a1129ecf040c32556d4b99 *xclm.exe

>dir xclm.old xclm.exe
01/10/2017  18:26         1,149,952 xclm.old
06/19/2014  22:58            26,624 xclm.exe

>xclm
OK


Attached xclm.old.


Best Regards and Good Luck


Title: Re: XC8 Compilers - Discussion
Post by: PM3295 on February 22, 2017, 02:19:43 02:19
With your sample xclm.old it patched like a dream. So something must be different. I will investigate. Thanks


Title: Re: XC8 Compilers - Discussion
Post by: lm317 on February 22, 2017, 05:59:38 05:59
After original  xc  compiler setup  complete,  the xclm.exe (xclm.old) generated depends on your pc. (mainboard serial etc.?)
Another xclm.exe cannot be used in your pc. (not sure)


Title: Re: XC8 Compilers - Discussion
Post by: PM3295 on February 22, 2017, 07:02:13 07:02
It worked on complete two different PCs. One uses a i-7 motherboard and the other an older pentium quad core. I am happy it worked for me!


Title: Re: XC8 Compilers - Discussion
Post by: h0nk on February 22, 2017, 07:07:31 07:07
After original  xc  compiler setup  complete,  the xclm.exe (xclm.old) generated depends on your pc. (mainboard serial etc.?)
Another xclm.exe cannot be used in your pc. (not sure)

The frontend to the XC8-Compiler is xclm.exe. And not xclm.old.
Thats why i included xclm.old in my post.
If Microchip has changed something, who cares...

To my knowledge only the RSA-keys are patched to a known state.
May be that someone can bring more light into this.

Would You please check also this:
Code:

>md5sum xc8-v1.41-full-install-windows-installer.exe
9bb1398796da56463c5f0b5abd370208 *xc8-v1.41-full-install-windows-installer.exe



Best Regards


Title: Re: XC8 Compilers - Discussion
Post by: 2Code on June 02, 2017, 01:11:46 13:11
MPLAB v3.61, XC8 v1.42, Win10, xclm.exe renamed in xclm.old patching done messages but looks like is in free mode.
You have compiled in FREE mode.
Using Omniscient Code Generation that is available in PRO mode,
you could have produced up to 60% smaller and 400% faster code.
See http://www.microchip.com/MPLABXCcompilers for more information.

Best regards.


Title: Re: XC8 Compilers - Discussion
Post by: mars01 on June 02, 2017, 02:30:26 14:30
If you would have read a bit more, eventually you would have found that you need to replace the xclm.exe file in MPLABX BIN folder also (MPLABX\v3.61\mplab_ide\bin). It has been discussed already.


Title: Re: XC8 Compilers - Discussion
Post by: 2Code on June 03, 2017, 02:20:11 02:20
Working like a charm after I copied as advised top's xclm.exe on C:\Program Files (x86)\Microchip\MPLABX\v3.61\mplab_ide\bin. Mea culpa.
Recap:
  rename xclm.exe in xclm.old in C:\Program Files (x86)\Microchip\xc8\v1.42\bin, copy cure and run it as admin
  replace xclm.exe in C:\Program Files (x86)\Microchip\MPLABX\v3.61\mplab_ide\bin with cure


Title: Re: XC8 Compilers - Discussion
Post by: Manuel on August 05, 2017, 07:39:16 19:39
NEW...

Confirm... XC8 v1.43 + MPLABX 3.65 ok.

Take care U All!

Manuel.


Title: Re: XC8 Compilers - Discussion
Post by: odessa on August 06, 2017, 12:24:15 12:24
1.43 you mean ... and yes it works fine  ;)


Title: Re: XC8 Compilers - Discussion
Post by: mars01 on September 23, 2017, 07:37:21 19:37
New XC8 compiler, version 1.44. Patch works. No difference against v1.43 in the compiled size in a certain test scenario.


Title: Re: XC8 Compilers - Discussion
Post by: alichan on December 24, 2017, 11:38:17 11:38
Hello I noticed with xc8 1.44 1.45 only 2 files are patched but cgpic.exe and cgpic18.exe, aren't patched.
It looks the compiler is in PRO mode anyway. Is it ok with those files?


Title: Re: XC8 Compilers - Discussion
Post by: tumbleweed on December 24, 2017, 06:30:43 18:30
All 4 files were patched when I installed v1.44.

btw v1.45 is available


Title: Re: XC8 Compilers - Discussion
Post by: alichan on December 26, 2017, 04:18:10 16:18
Sorry, typo. It is version 1.45.

1.44 is pacthed all the 4 files,  but not 1.45.


Title: Re: XC8 Compilers - Discussion
Post by: mars01 on December 26, 2017, 05:35:56 17:35
You made me curious and I uninstalled the XC8 1.45 compiler and reinstalled it. In my case the only thing that is not showed here is that I overwritten also the xclm.exe from MPIDE/BIN folder with the fixed file. Just from habit, I don't know if it's needed anymore.

The result is in the picture below which shows that all 4 files are patched. Win10 X64 with latest updates.

(https://image.ibb.co/cQo8Uw/xc8_1_45_xclm_action.jpg)


Title: Re: XC8 Compilers - Discussion
Post by: alichan on December 26, 2017, 08:27:52 20:27
You made me curious and I uninstalled the XC8 1.45 compiler and reinstalled it. In my case the only thing that is not showed here is that I overwritten also the xclm.exe from MPIDE/BIN folder with the fixed file. Just from habit, I don't know if it's needed anymore.

The result is in the picture below which shows that all 4 files are patched. Win10 X64 with latest updates.
...


I uninstalled and reinstalled, and used the last xclm i found in the thread,  just in case mine is not updated.... same result:

D:\Microchip\xc8\v1.45\bin>xclm.exe
Patched 40 bytes in file ./picc.exe
Patched 40 bytes in file ./picc18.exe
Patched SHA in 2 of 4 files

The only difference with your image is I'm  not using the default path for installing... but i never had problems until 1.45.
I'm using W7 Home Premium 64b, admin rights, etc... As I said I had no problem with previous versions.

Update: I also tried with 1.44, installed in custom path, same result with only those 2 files patched.
Update: Installed 1.45 in default path, same result... only 2 files patched.

Could you point to the exact post/link of the xclm you are using? or upload yours to some site to download. I'm curious if I'd get the same results than you using the same xlcm (just in case mine is not the same).

Nombre: xclm.exe (26.624 bytes), ‎19‎ Jun 2014
 CRC-32: d3c4a688
 SHA-1: e0570107814a72b7498016f887896703ce814ed1
 SHA-256: b6cdc94545068e30d27c8b880e5b489b29a9ee5eedd52558dff9a986b05d511d
 SHA-512: 1c960685b27d744f4962fd3517d8277beaa1092dd5799a1f5b72a1f382d62e7a58987b8ddf467d3886e23e81a744a5d2dc4ce03f398f32deae2066516c9c9132

This is the xclm i was using, but I also used the xclm in http://www.sonsivri.to/forum/index.php?topic=44014.msg186926#msg186926, after some search. They look the same, at least they have the same hash.

So I don't know what is happening and why the cg---- files aren't being patched.



Title: Re: XC8 Compilers - Discussion
Post by: mars01 on December 26, 2017, 10:01:01 22:01

Could you point to the exact post/link of the xclm you are using? or upload yours to some site to download. I'm curious if I'd get the same results than you using the same xlcm (just in case mine is not the same).


Attached there is a MEGA link with the xclm files.


Title: Re: XC8 Compilers - Discussion
Post by: Top on December 26, 2017, 10:13:04 22:13
If you see "Patched SHA in 2 of 4 files" then 2 files couldn't be written to.

Check file permissions/attributes on cgpic.exe & cgpic18.exe.


Title: Re: XC8 Compilers - Discussion
Post by: alichan on December 28, 2017, 10:50:58 10:50
Alo.

I could patch the files finally, but I'm not still sure what happened. It looks some process was owing those files magically for no apparent reason.

Thanks for helping.


Title: Re: XC8 Compilers - Discussion
Post by: Dadabe on May 23, 2018, 12:44:53 12:44
Hello,
I just understood, using the procedure under DOS indicated by mars01, that it is absolutely essential to patch as Administrator. Everything is done under Win10-64 bits as indicated in the DOS window. Like what, sometimes, a small picture is worth more than a detailed statement. Many thanks to mars01 in may18.
Best Regards.


Title: XC8 v2.00 (includes also compiler for AVRs)
Post by: mitsos on June 13, 2018, 07:19:34 19:19
hi

to download use this direct link:
http://ww1.microchip.com/downloads/en/DeviceDoc/xc8-v2.00-full-install-windows-installer.exe

to patch the PICs compiler:
rename the xclm.exe, in folder C:\Program Files\Microchip\xc8\v2.00\bin, to xclm.old and put the cracked xclm.exe (26624 bytes) in this folder
copy/paste the xclm.old and xclm.exe to folder C:\Program Files\Microchip\xc8\v2.00\pic\bin.
In the last folder run the xclm.exe

regards
mitsos

PS I'm not sure if the AVRs compiler needs a patch



Title: Re: XC8 Compilers - Discussion
Post by: koky on June 18, 2018, 06:16:10 06:16
with Xc8 2.00 the patch don't work


Title: Re: XC8 Compilers - Discussion
Post by: lm317 on June 18, 2018, 03:57:12 15:57
The patch works fine, as mitsos described with Xc8 2.00 . Tested.No problem.

 
to download use this direct link:
http://ww1.microchip.com/downloads/en/DeviceDoc/xc8-v2.00-full-install-windows-installer.exe

to patch the PICs compiler:
rename the xclm.exe, in folder C:\Program Files\Microchip\xc8\v2.00\bin, to xclm.old and put the cracked xclm.exe (26624 bytes) in this folder
copy/paste the xclm.old and xclm.exe to folder C:\Program Files\Microchip\xc8\v2.00\pic\bin.
In the last folder run the xclm.exe



Title: Re: XC8 Compilers - Discussion
Post by: mars01 on June 23, 2018, 02:34:28 14:34
Patch may be working but with the new GCC "look', MPLABX can't see the xc.h therefore I reverted to XC8 1.45 which works fine.


Title: Re: XC8 Compilers - Discussion
Post by: Catcatcat on June 23, 2018, 06:57:41 18:57
comparison of compilers v1.45 (pro) and 2.00 (s)

(https://image.ibb.co/nOMOZo/xc801.png) (https://imgbb.com/)

(https://image.ibb.co/mMrOZo/xc802.png) (https://imgbb.com/)
 ;)




Posted on: June 23, 2018, 11:52:02 11:52 - Automerged

Patch may be working but with the new GCC "look', MPLABX can't see the xc.h therefore I reverted to XC8 1.45 which works fine.
In the beginning, there was a similar problem, re-install the compiler (before removing everything and the installation directory) and as described apply the medicine.


Posted on: June 23, 2018, 11:58:54 11:58 - Automerged


v2.00 C standart C 99

(https://image.ibb.co/hec3jo/xc803.png) (https://imgbb.com/)


Title: Re: XC8 Compilers - Discussion
Post by: mars01 on June 23, 2018, 07:10:39 19:10
I guess we should stay away from v2.0 until they get the hang of it. The developers may have attempted too much for this release.


Title: Re: XC8 Compilers - Discussion
Post by: metal on June 23, 2018, 10:49:47 22:49
what is the "new GCC "look'"? Did they abandon HI-TECH compilers?


Title: Re: XC8 Compilers - Discussion
Post by: mars01 on June 23, 2018, 11:52:50 23:52
what is the "new GCC "look'"? Did they abandon HI-TECH compilers?

I think they use a "wrapper". They still use the old compiler but it's deeper in the structure. They use Clang now and they support C99 and C90 as opposed to only C90(C89) up until v1.45.
It's because of the AVR compilers ...


Title: Re: XC8 Compilers - Discussion
Post by: Manuel on June 27, 2018, 01:05:29 13:05
I confirm you your written.

So I think investigations should follow on 'xc8-cc.exe'..

take care,

Xo!


Title: Re: XC8 Compilers - Discussion
Post by: metal on June 27, 2018, 03:16:37 15:16
I think they use a "wrapper". They still use the old compiler but it's deeper in the structure. They use Clang now and they support C99 and C90 as opposed to only C90(C89) up until v1.45.
It's because of the AVR compilers ...

I hope they don't kill microsoft IDE, it is better than Java crap..


Title: Re: XC8 Compilers - Discussion
Post by: mars01 on June 27, 2018, 04:34:39 16:34
I hope they don't kill microsoft IDE, it is better than Java crap..

I agree, actually I hope they start supporting PIC devices in Atmel Studio since they made the choice to use a GCC-like wrapper.


Title: Re: XC8 Compilers - Discussion
Post by: alichan on August 11, 2018, 09:41:49 21:41
I guess we should stay away from v2.0 until they get the hang of it. The developers may have attempted too much for this release.
Amen... Adding C99 support is a major change and surely a major bug source.


Title: Re: XC8 Compilers - Discussion
Post by: intel on November 17, 2018, 12:52:56 12:52

Hello there;
I could not get a pro mode of xc8 v2.0 version. I've done everything imaginable. After formatting the computer, I installed the xc8 v2.0 version directly. I don't know if anything was v1.45 installed before. I don't know if I'm connected to the internet. One of the masters should be interested.



Title: Re: XC8 Compilers - Discussion
Post by: koky on November 17, 2018, 04:00:03 16:00
You must see the:
« Reply #172 on: June 13, 2018, 01:19:34 13:19 »
attention at the right BIN subdirectory


Title: Re: XC8 Compilers - Discussion
Post by: intel on November 17, 2018, 04:05:30 16:05
You must see the:
« Reply #172 on: June 13, 2018, 01:19:34 13:19 »
attention at the right BIN subdirectory


Thanks koky;
I already made them. I think there is a changing license validation procedure.


Title: Re: XC8 Compilers - Discussion
Post by: Top on November 17, 2018, 04:09:29 16:09
Open a command prompt as admin and run the following commands:
"C:\Program Files (x86)\Microchip\xc8\v2.00\bin\xclm.exe"
"C:\Program Files (x86)\Microchip\xc8\v2.00\pic\bin\xclm.exe"
Report back with results.


Title: Re: XC8 Compilers - Discussion
Post by: intel on November 17, 2018, 04:30:41 16:30

Open a command prompt as admin and run the following commands:
"C:\Program Files (x86)\Microchip\xc8\v2.00\bin\xclm.exe"
"C:\Program Files (x86)\Microchip\xc8\v2.00\pic\bin\xclm.exe"
Report back with results.

"C:\Program Files\Microchip\xc8\v2.00\pic\bin\xclm.exe" did not pay attention to the new file location. Now the program as a result worked. Thank you so much Master Top.


Title: Re: XC8 Compilers - Discussion
Post by: Catcatcat on January 16, 2019, 10:59:16 10:59
Compiler update released

MPLAB® XC8 Compiler v2.05 (https://www.microchip.com/mplabxc8windows)

The microchip changed the principle of treatment, the "dancing with a tambourine" helped.  :D If you copy the missing files in the folder C: \ Program Files (x86) \ Microchip \ xc8 \ v2.05 \ pic \ bin, the compiler started working.

for comparison
v2.05 C standart C 99

(https://i.ibb.co/KydzBZm/205cc99.png)


Title: Re: XC8 Compilers - Discussion
Post by: papy_bidouille on January 17, 2019, 03:43:49 15:43
7264 bytes less for my application I can add additional options
Thanks xclm.exe
And thank you to those who contributed.


Title: Re: XC8 Compilers - Discussion
Post by: HackAndCrack on January 22, 2019, 12:48:29 12:48
What is the cracking procedure for XC8 v2.05 ?

I installed MPLAB X 5.10 and XC8 v2.05 yesterday and applied the crack as mentioned in latest sticky file and changed compiler options to Free, Standard and PRO and compiled but for all modes I get same .hex. I use PIC16F877A for a Blinky project.


Title: Re: XC8 Compilers - Discussion
Post by: mars01 on January 22, 2019, 01:47:04 13:47
What is the cracking procedure for XC8 v2.05 ?

I installed MPLAB X 5.10 and XC8 v2.05 yesterday and applied the crack as mentioned in latest sticky file and changed compiler options to Free, Standard and PRO and compiled but for all modes I get same .hex. I use PIC16F877A for a Blinky project.

Read the Reply #189, here: http://www.sonsivri.to/forum/index.php?topic=45707.msg191433#msg191433 it explain the extra steps.

It's quite simple.
1. Rename xclm file to xclm.old and copy the new xclm.exe file here:
Code:
C:\Program Files (x86)\Microchip\xc8\v2.05\bin
2. Copy both files (xclm.old and xclm.exe) from the previous location to:
Code:
C:\Program Files (x86)\Microchip\xc8\v2.05\pic\bin
and run the xclm.exe here as admin to patch the files.

There are no longer the options: Free, Standard and Pro. There are only different kinds of optimizations in GNU language like: O2, O3, O3 + s, some are available only for the licensed compiler.


Title: Re: XC8 Compilers - Discussion
Post by: Manuel on April 24, 2019, 11:01:49 11:01
Did not investigated digging compiled but 2.05 is anyway bigger than 2.00 in both code and vars generation.

Then in 2.00 or previous the optimizer used to remove unused vars, the 2.05 leave them in.

Quite odd in this.

Those facts noted with Pic15F323 just for your interest...

Does anyone noticed this ?

X!


Title: Re: XC8 Compilers - Discussion
Post by: Catcatcat on April 25, 2019, 07:22:47 07:22
Version 1.45 gives the most efficient optimization by code size.


Title: Re: XC8 Compilers - Discussion
Post by: Manuel on April 25, 2019, 07:37:09 07:37
I will take time to investigate further so, since for the PIC12F510 there is no real difference between 2.00 and 2.05.

I will check 1.45 as well just for curiosity.

take care,
X!


Title: Re: XC8 Compilers - Discussion
Post by: koky on July 28, 2019, 04:39:14 16:39
I have try with 2.09 and seem don't work


Title: Re: XC8 Compilers - Discussion
Post by: Top on July 28, 2019, 05:03:33 17:03
I have try with 2.09 and seem don't work

Open a command prompt as admin and run the following commands:
"C:\Program Files (x86)\Microchip\xc8\v2.09\bin\xclm.exe"
"C:\Program Files (x86)\Microchip\xc8\v2.09\pic\bin\xclm.exe"

Report back with results.


Title: Re: XC8 Compilers - Discussion
Post by: koky on July 28, 2019, 06:50:34 18:50
C:\Program Files (x86)\Microchip\xc8\v2.09\pic\bin>xclm.exe
Patched 40 bytes in file ./aspic.exe
Patched 40 bytes in file ./aspic18.exe
Patched 40 bytes in file ./cgpic.exe
Patched 40 bytes in file ./cgpic18.exe
Patched 40 bytes in file ./picc.exe
Patched 40 bytes in file ./picc18.exe
Patched SHA in 6 of 6 files


Title: Re: XC8 Compilers - Discussion
Post by: Top on July 28, 2019, 08:34:18 20:34
So, does it work now?


Title: Re: XC8 Compilers - Discussion
Post by: koky on July 28, 2019, 08:37:08 20:37
for me not work
::: error: (2052) The current license does not permit the selected optimization level and other levels are not permitted by the NOFALLBACK option
(908) exit status = 1


Title: Re: XC8 Compilers - Discussion
Post by: tumbleweed on July 29, 2019, 11:18:44 11:18
I haven't tried to install it yet, but there may be something different about the new XC '09' versions.

For XC16-
Quote
Release Notes for MPLAB XC16 C Compiler
v1.39
Mar 22 2019

This release of the Microchip MPLAB XC16 C compiler is a functional safety compiler based on MPLAB XC16 v1.36B. This compiler requires a functional safety license in order to operate. Once activated, all optimisation levels and compiler features are available.

Maybe they use a different licensing scheme...


Title: Re: XC8 Compilers - Discussion
Post by: Top on July 29, 2019, 04:25:10 16:25
Maybe they use a different licensing scheme...

Not a different scheme but there are some changes.


Title: Re: XC8 Compilers - Discussion
Post by: tumbleweed on July 30, 2019, 10:45:23 10:45
FYI - from one of the XC developers...

Quote
Just to confirm what it looks like you already know, the XC8 2.09 is a functional safety compiler. It requires a special license, so at this stage you will not be able to run it. It has not actually been officially released yet; however, it made its way onto the list of compilers offered as update by MPLAB X IDE. That issue is being looked into. There will be special functional safety compilers for XC8/16/32 released later in the year.


Title: Re: XC8 Compilers - Discussion
Post by: uCApps on August 17, 2019, 12:48:40 12:48
Hello,
xc8 ver. 2.10 was released and currently medicine does not works anymore.
I checked in xclm binary and it is updated in this version.


Title: Re: XC8 Compilers - Discussion
Post by: Top on August 17, 2019, 01:52:17 13:52
Open a command prompt as admin and run the following commands:
"C:\Program Files (x86)\Microchip\xc8\v2.10\bin\xclm.exe"
"C:\Program Files (x86)\Microchip\xc8\v2.10\pic\bin\xclm.exe"
Report back with results.


Title: Re: XC8 Compilers - Discussion
Post by: uCApps on August 17, 2019, 03:06:32 15:06
Open a command prompt as admin and run the following commands:
"C:\Program Files (x86)\Microchip\xc8\v2.10\bin\xclm.exe"
"C:\Program Files (x86)\Microchip\xc8\v2.10\pic\bin\xclm.exe"
Report back with results.
Dear Top, thanks for kindness, here it is. Successfully it patched binary,but it doesn't work in MPLAB X.
---
C:\Program Files (x86)\Microchip\xc8\v2.10\pic\bin>xclm.exe
Patched 40 bytes in file ./aspic.exe
Patched 40 bytes in file ./aspic18.exe
Patched 40 bytes in file ./cgpic.exe
Patched 40 bytes in file ./cgpic18.exe
Patched 40 bytes in file ./picc.exe
Patched 40 bytes in file ./picc18.exe
Patched SHA in 6 of 6 files

C:\Program Files (x86)\Microchip\xc8\v2.10\pic\bin>

C:\Program Files (x86)\Microchip\xc8\v2.10\bin>xclm.exe
Nothing to do

C:\Program Files (x86)\Microchip\xc8\v2.10\bin>
---


Title: Re: XC8 Compilers - Discussion
Post by: Top on August 17, 2019, 03:12:30 15:12
When you say "doesn't work" be more specific, give an example, what exactly is not working?


Title: Re: XC8 Compilers - Discussion
Post by: uCApps on August 17, 2019, 04:49:57 16:49
When you say "doesn't work" be more specific, give an example, what exactly is not working?

Dear Top,
Sorry for that, I meant optimizations in XC8 ver. 2.10 didn't works in Os, O3 on MPLAB X once,
but it WORKS well now after I deleted cache files.

Many apologizes for my recognization...lots of thanks for nice madecine!

uCApps


Title: Re: XC8 Compilers - Discussion
Post by: Catcatcat on August 17, 2019, 06:31:54 18:31
How I cure version 2.XX.
First, as usual, I do with the files in the folder C:\Program Files (x86)\Microchip\xc8\v2.10\bin
I get two files xclm.exe (26 KB) and xclm.old (1719KB).
Then copy them to the folder
C:\Program Files (x86)\Microchip\xc8\v2.10\pic\bin
and
C:\Program Files (x86)\Microchip\xc8\v2.10\avr\bin
And then in each of these folders I perform the treatment, it seems so far, everything works.


Title: Re: XC8 Compilers - Discussion
Post by: Mr. Spock on August 21, 2019, 07:38:21 07:38
"And then in each of these folders I perform the treatment"

Hi
Do you mean running again xclm.exe ?
Best regards


Title: Re: XC8 Compilers - Discussion
Post by: Catcatcat on August 21, 2019, 11:19:48 11:19
"And then in each of these folders I perform the treatment"

Hi
Do you mean running again xclm.exe ?
Best regards
Yes.


Title: Re: XC8 Compilers - Discussion
Post by: pickit2 on November 10, 2019, 04:07:54 16:07
I had a tough time patching xc8
I had to move the files xclm.exe and xclm.old  up a level to
c:\Program Files\microchip\xc8\v2.10

then it worked.


Title: Re: XC8 Compilers - Discussion
Post by: engiadina on January 31, 2020, 09:02:53 21:02
Hi,

I'm trying to apply the medicine to a Mac with Catalina. Here it does not work, the OS complains about the 32-Bit nature of the medicine. Should be 64-Bit to be able to run. Is there any help available?

Many thanks

engiadina


Title: Re: XC8 Compilers - Discussion
Post by: pki on February 21, 2020, 06:30:27 18:30
Where can i find the medicine for linux version?


Title: Re: XC8 Compilers - Discussion
Post by: MarkWalter on April 18, 2020, 11:12:43 11:12
Hi to everyone, i'm using this xclm method since forever and really thanks for it.
I'm really curious about this, anyone can share the source code of the xclm? or maybe just explain the procedure.
I've always been fascinated with those ''softwares'', thanks


Title: Re: XC8 Compilers - Discussion
Post by: tumbleweed on April 30, 2020, 05:03:30 17:03
xc8 v2.20 was just released.

Part of that package contains a new assembler pic-as.exe (xc8\v2.20\pic-as\bin).
Does anyone know if that program needs to be patched too?


Title: Re: XC8 Compilers - Discussion
Post by: Catcatcat on April 30, 2020, 06:54:20 18:54
The medicine works, treated according to the method of copying files to bin folders. (V2.20)


Title: Re: XC8 Compilers - Discussion
Post by: koky on April 30, 2020, 06:55:23 18:55
the new version is 64 bit and the usually medicine work fine


Title: Re: XC8 Compilers - Discussion
Post by: pickit2 on April 30, 2020, 07:06:34 19:06
Hi to everyone, i'm using this xclm method since forever and really thanks for it.
I'm really curious about this, anyone can share the source code of the xclm? or maybe just explain the procedure.
I've always been fascinated with those ''softwares'', thanks

why this post after only two post in forum.

Both your post after being a member here for over 5 years are like this

Quote by you 'Someone can please release the source code of the medicine ?


Title: Re: XC8 Compilers - Discussion
Post by: tumbleweed on April 30, 2020, 08:07:36 20:07
Quote
The medicine works, treated according to the method of copying files to bin folders. (V2.20)
Yes, I know. The medicine patches all the 'old' XC8 files in v2.20 fine.

v2.20 includes a new standalone assembler pic-as.exe which is intended to replace MPASM.
My question is if the new file pic-as.exe needs to be patched as well.

pic-as.exe may just be a front-end for calling the existing aspic.exe/aspic18.exe (which ARE patched by the medicine),
bit I don't know for sure. Hence the question.


Title: Re: XC8 Compilers - Discussion
Post by: Catcatcat on April 30, 2020, 09:16:13 21:16
Yes, I know. The medicine patches all the 'old' XC8 files in v2.20 fine.

v2.20 includes a new standalone assembler pic-as.exe which is intended to replace MPASM.
My question is if the new file pic-as.exe needs to be patched as well.

pic-as.exe may just be a front-end for calling the existing aspic.exe/aspic18.exe (which ARE patched by the medicine),
bit I don't know for sure. Hence the question.


About 10 years ago I threw the assembler back and I can’t say anything about it, but as far as I remember, assembler has always been free.


Title: Re: XC8 Compilers - Discussion
Post by: tumbleweed on May 01, 2020, 12:25:12 00:25
I don't think everyone is getting what I'm saying.

Yes, the old MPASM was free. The NEW assembler pic-as.exe is part of XC8 v2.20.

Currently the medicine patches the aspic.exe assembler used in XC8 v2.10:
Code:
Patched 40 bytes in file ./aspic.exe
Patched 40 bytes in file ./aspic18.exe

Now, pic-as.exe is meant as a standalone assembler (I think XC8 still calls on aspic to do its work).

The question, yet again, is a similar patch as was done for aspic.exe needed for pic-as.exe?


Title: Re: XC8 Compilers - Discussion
Post by: graywolf on May 01, 2020, 03:02:52 15:02
Hi,

I'm trying to apply the medicine to a Mac with Catalina. Here it does not work, the OS complains about the 32-Bit nature of the medicine. Should be 64-Bit to be able to run. Is there any help available?

Many thanks

engiadina

I have been creating my own patcher for Catalina, it has been tested against XC32 v2.40, XC8 v2.20 and works. I will package and do a release in the next few days. 'pickit2' where or how do I get this live?


Title: Re: XC8 Compilers - Discussion
Post by: Ahmad_k on May 30, 2020, 08:25:51 20:25
I have downloaded the last MLA (Microchip Library v2017) that support PIC18 USB Device also the latest XC8.

All USB samples from MLA compile out of the box without any problem, but non of them are working in Proteus USB simulation. First i thought it was a Proteus problem, i opened usb hid mouse sample provided by proteus and it works, but none of the demo within MLA works. USB analyzer stuck on get device descriptor.

i also tried MikroC simple HID device and it works also in proteus.

The reason i need XC8 and MLA USB stack because it is almost full USB stack and not a light weight stack as provided by MikroC and Proton.

I don't have a real hardware near me to try on real hardware right now.

Please if someone can confirm that USB stacks (XC8 + MLA) (Custom HID sample or mouse sample) is working fine on real hardware or in simulation, if yes then provide the exact version.

Device used : 18F14k50 or 18F45k50




Title: Re: XC8 Compilers - Discussion
Post by: metal on May 30, 2020, 09:54:42 21:54
I don't remember much details since 2014, but you are expert enough not to tell you that I had to change pins to match the MCU for which I am compiling at least, and make sure other MCU specific registers/interrupts are correctly configured as well.


Title: Re: XC8 Compilers - Discussion
Post by: Ahmad_k on May 30, 2020, 10:24:27 22:24
I don't remember much details since 2014, but you are expert enough not to tell you that I had to change pins to match the MCU for which I am compiling at least, and make sure other MCU specific registers/interrupts are correctly configured as well.

Yes of course. As i said i tried a demo from MLA for PICDEM USB board without touching the code (the mouse sample). i didn't change the MCU just in case i missed with some configuration. Everything is correct. That's why i'm confused and that's why i need to know where is the problem. is it the USB stack or proteus.

i hope i can try my code on real hardware when i come back to my lab after 4 days


Title: Re: XC8 Compilers - Discussion
Post by: ron on June 10, 2020, 04:31:36 16:31
I have been creating my own patcher for Catalina, it has been tested against XC32 v2.40, XC8 v2.20 and works. I will package and do a release in the next few days. 'pickit2' where or how do I get this live?

Looking forward to your release. On Win7 X64 installed with free pro licence 60 days. Does it matter what option you pick at the end of the install ?.
Also most of the links on the original medicine link do not work.
http://www.sonsivri.to/forum/index.php?topic=44014.25
I got one exe file but when I try to run it says not a valid win32 app.


Title: Re: XC8 Compilers - Discussion
Post by: Sideshow Bob on June 10, 2020, 05:21:36 17:21
I have pointed you to the newest post regarding this matter in a post today. Read the readme.txt and do as you have been told. It should work. The links work I have checked


Title: Re: XC8 Compilers - Discussion
Post by: ron on June 11, 2020, 09:02:13 09:02
UPDATE:
I got it working. Just followed the instructions posted by pickit2. Ver 2.20 Win 7(64).
Just run it from C:\Program Files\Microchip\xc8\v2.20> as admin. And copy it to all the locations mentioned i.e. avr/pic etc.

You guys rock.
Now to see if this does a better job than my old High Tech C 9.83

================Stuff ===========================
C:\Program Files\Microchip\xc8\v2.20\bin>xc8 --chip=16f1516 --opt=s
C:\Program Files\Microchip\xc8\v2.20\pic\bin\picc --chip=16f1516 --opt=s
(2057) The XC8 compiler installation appears to be corrupted. Please reinstall
nd try again
(908) exit status = 1

Will keep trying will keep reading. But got this far.

C:\Program Files\Microchip\xc8\v2.20\bin>dir
 Volume in drive C is Windows7_OS
 Volume Serial Number is 7AFD-80CE

 Directory of C:\Program Files\Microchip\xc8\v2.20\bin

06/11/2020  01:44 PM    <DIR>          .
06/11/2020  01:44 PM    <DIR>          ..
04/09/2020  06:58 AM           722,832 avr-objcopy.exe
04/09/2020  06:38 AM            48,376 deviceSupport.xml
04/09/2020  06:46 AM               259 roam.lic
04/09/2020  06:58 AM         1,080,984 xc-ccov.exe
04/09/2020  06:58 AM           313,744 xc8-ar.exe
04/09/2020  06:58 AM           375,696 xc8-cc.exe
04/09/2020  06:58 AM           311,184 xc8.exe
06/20/2014  02:28 AM            26,624 xclm.exe
04/09/2020  06:46 AM         2,592,320 xclm.old
               9 File(s)      5,472,019 bytes
               2 Dir(s)   5,852,426,240 bytes free

C:\Program Files\Microchip\xc8\v2.20\bin>xclm -scan
Unknown option

C:\Program Files\Microchip\xc8\v2.20\bin>


Title: Re: XC8 Compilers - Discussion
Post by: metal on August 25, 2020, 10:56:14 10:56
When using mmc, where am I supposed to write the routine for ADC interrupt, for example?

I am looking at the generated code, in the interrupt_manager.c:

Code:
void __interrupt() INTERRUPT_InterruptManager (void)
{
    // interrupt handler
    if(INTCONbits.PEIE == 1)
    {
        if(PIE1bits.ADIE == 1 && PIR1bits.ADIF == 1)
        {
            ADC_ISR();
        }
        else
        {
            //Unhandled Interrupt
        }
    }     
    else
    {
        //Unhandled Interrupt
    }
}

Now it calls ADC_ISR() which in turn calls ADC_interruptHandler(), the declaration for this function is void (*ADC_InterruptHandler)(void)

Where am I supposed to write the definition of this function? I need a quick example to get me started.



Posted on: August 25, 2020, 12:18:11 12:18 - Automerged

seems I found the answer: https://microchipdeveloper.com/mcc:interrupts


Title: Re: XC8 Compilers - Discussion
Post by: Manuel on August 25, 2020, 03:02:49 15:02
void (*ADC_InterruptHandler)(void)

ADC_InterruptHandler is a pointer to a function which returns void and takes a void as an argument.

can help:

#include <stdio.h>
// A normal function with an int parameter
// and void return type
void fun(int a)
{
    printf("Value of a is %d\n", a);
}
 
int main()
{
    // fun_ptr is a pointer to function fun() 
    void (*fun_ptr)(int) = &fun;
 
    /* The above line is equivalent of following two
       void (*fun_ptr)(int);
       fun_ptr = &fun; 
    */
 
    // Invoking fun() using fun_ptr
    (*fun_ptr)(10);
 
    return 0;
}


take care
X!


Title: Re: XC8 Compilers - Discussion
Post by: odessa on September 01, 2020, 10:03:00 22:03
Hi,

Easiest way for me is:

In your code create the function you want to use for interrupt, say:

void myAdcInt(void){

}

Then in your main add your function to the void pointer

ADC_SetInterruptHandler(myAdcInt);

The interrupt will now be directed to your routine


Title: Re: XC8 Compilers - Discussion
Post by: Catcatcat on September 05, 2020, 01:16:52 13:16
When using mmc, where am I supposed to write the routine for ADC interrupt, for example?

I am looking at the generated code, in the interrupt_manager.c:

Code:
void __interrupt() INTERRUPT_InterruptManager (void)
{
    // interrupt handler
    if(INTCONbits.PEIE == 1)
    {
        if(PIE1bits.ADIE == 1 && PIR1bits.ADIF == 1)
        {
            ADC_ISR();
        }
        else
        {
            //Unhandled Interrupt
        }
    }     
    else
    {
        //Unhandled Interrupt
    }
}

Now it calls ADC_ISR() which in turn calls ADC_interruptHandler(), the declaration for this function is void (*ADC_InterruptHandler)(void)

Where am I supposed to write the definition of this function? I need a quick example to get me started.



Posted on: August 25, 2020, 12:18:11 12:18 - Automerged

seems I found the answer: https://microchipdeveloper.com/mcc:interrupts


These are called callback functions.
1. You need to create your own function, which should perform data processing at your request, for example:
Code:
void ADSirc (void)// ADC processing
{
    int16_t audio_data; // audio data
    /* Return the result
    audio_data = ADCC_GetConversionResult();*/
//*************************
    // Start the conversion
    // ADCC_StartConversion(Audio);
    ADCON0bits.ADGO = 1;
}//-----------------------------------------------------------------------------

2. Then you need to tell the compiler how to use it when the ADC is interrupting.

Code:
void main (void)
{
    // Initialize the device
    SYSTEM_Initialize ();
     ClrWdt (); // reset watchdog timer
     //--------------------------------------------------------------------------
     // connection options ADSirc
     ADCC_SetADIInterruptHandler (ADSirc); //
     //    ADCC_SetADIInterruptHandler (&ADSirc); //
     //--------------------------------------------------------------------------
    //******************

    //--------------------------------------------------------------------------
    ADCC_StartConversion (AudioL);//to trigger an ADC interrupt
    //--------------------------------------------------------------------------

    while (1)
    {

        ClrWdt (); // reset watchdog timer
        //***************************

    }
}
//==============================================================================



Title: Re: XC8 Compilers - Discussion
Post by: Catcatcat on September 06, 2020, 08:50:11 20:50
MPLAB® XC8 Compiler v2.30 (https://www.microchip.com/mplabxc8windows)
Updated today, works  :D


Title: Re: XC8 Compilers - Discussion
Post by: Jagi on October 01, 2020, 08:33:20 08:33
Finally, I managed to get the latest version of XC8 2.30 up and running after an hour of trial and error.

To help all those who have been struggling with the process of patching, I have herewith made a document with the detailed steps that I followed to make the patching successfully.  Hope this document is helpful. Should you find any mistakes please let me know, I'll make the corrections and repost the update.

P.S: For those asking for the XCLM patcher, please search this forum the links to download it are available on this forum.


Title: Re: XC8 Compilers - Discussion
Post by: Catcatcat on October 01, 2020, 03:09:14 15:09
I already described my steps:
There are three xc8v2xx folders:
C:\Program Files\Microchip\xc8\v2.30\bin
C:\Program Files\Microchip\xc8\v2.30\avr\bin
C:\Program Files\Microchip\xc8\v2.30\pic\bin
In these packs you need to place our two cherished files and execute a magic command. Then comes general prosperity. :o :D


Title: Re: XC8 Compilers - Discussion
Post by: karmi on October 05, 2020, 05:14:28 05:14
Where is the link to download xclm.exe, please ?


Title: Re: XC8 Compilers - Discussion
Post by: Unhappy on October 05, 2020, 08:53:46 08:53
Where is the link to download xclm.exe, please ?

You need to check and use search the forum Dear

http://www.sonsivri.to/forum/index.php?topic=44014.0


Title: Re: XC8 Compilers - Discussion
Post by: karmi on October 05, 2020, 03:13:07 15:13
Thanks, of course I did. I could not find it!. the link you provided for the old version. I need the one that supports xc8 ver 2.20. The guys say in their comments it worked for them, but they do not provide the link for download.


Title: Re: XC8 Compilers - Discussion
Post by: Manuel on October 05, 2020, 03:27:24 15:27
Please, the given link is correct !

Check TOP post and get the "txt" .....

take care,

X!


Title: Re: XC8 Compilers - Discussion
Post by: metal on October 05, 2020, 03:29:38 15:29
read this http://www.sonsivri.to/forum/index.php?topic=44014.msg197545#msg197545


Title: Re: XC8 Compilers - Discussion
Post by: karmi on October 05, 2020, 03:47:43 15:47
The top post dl.txt leads to file not found, the next one for graywolf does not have the windows version. I do not see any link to download the xclm.exe for windows that supports the new versions of xc8 2.20 and 2.30, the post in the link says it worked for him, but where to get it downloads ?

thanks again for your efforts guys


Title: Re: XC8 Compilers - Discussion
Post by: pickit2 on October 05, 2020, 07:26:51 19:26
The top post dl.txt leads to file not found, the next one for graywolf does not have the windows version. I do not see any link to download the xclm.exe for windows that supports the new versions of xc8 2.20 and 2.30, the post in the link says it worked for him, but where to get it downloads ?

thanks again for your efforts guys

I already reposted the file in this post from 2017:
http://www.sonsivri.to/forum/index.php?topic=44014.msg186926#msg186926
It's still up and working with the latest compilers.
this Link still working


Title: Re: XC8 Compilers - Discussion
Post by: karmi on October 06, 2020, 02:32:31 02:32
this Link still working
This message is not there! 186926.
Could you  please post the link here again.


Title: Re: XC8 Compilers - Discussion
Post by: wild on October 06, 2020, 03:35:23 03:35
@karmi:
please do not complain if it is a fault of yours!
The link posted by pickit2 is sound and still valid !!!

Posted on: October 06, 2020, 03:23:35 03:23 - Automerged

otherwise, if you still are not able to find the working link, please take a look at:
https://github.com/cv007/XC3216

P.S.: I have not tested if it is working


Title: Re: XC8 Compilers - Discussion
Post by: karmi on October 07, 2020, 02:18:14 14:18
this Link still working
This is for 32bit, I am looking for 64bit one


Title: Re: XC8 Compilers - Discussion
Post by: pickit2 on October 07, 2020, 03:05:06 15:05
This is for 32bit, I am looking for 64bit one
The link is for all versions... or are you looking for what is not there?



Title: Re: XC8 Compilers - Discussion
Post by: tumbleweed on October 31, 2020, 11:55:28 11:55
xc8 v2.31 is available

patching method tested...still works


Title: Re: XC8 Compilers - Discussion
Post by: chicowood on November 16, 2020, 01:32:40 01:32
I recently needed to revive an old project in MPLAB 8.92 that was on a virtual disk image. The project was still pointing to xc8 v1.43 and it compiled ok. (And it compiled in PRO mode thanks to xlcm medicine installed years ago...)

Then I updated xc8 to to v2.31 and applied medicine. Medicine worked. MPLABX sees the v2.31 compiler and compiles correctly.

But I can't get MPLAB 8 to see v2.31.

In MPLAB 8, under "Select Language Toolsuite" and "Set Language Tool Locations", I set the location to "C:\Program Files (x86)\Microchip\xc8\v2.31\bin\xc8.exe" (also tried "C:\Program Files (x86)\Microchip\xc8\v2.31\pic\bin\xc8.exe").

But after I press Apply and OK it doesn't stick. It still compiles with v1.43, and the locations I set above have reverted from v2.31 to v1.43.

Then I go to "Build Options -> Project: Driver". It shows "MPLAB XC8 C Compiler V1.43". V2.31 is not listed, and there's no obvious way to add it. I don't know how to get v2.31 to register with MPLAB 8.

Does anybody remember MPLAB 8 well enough to advise on how to get MPLAB 8 to see 2.31? Or perhaps MPLAB 8 is so old that xc8 v2.31 is incompatible with MPLAB 8?


Title: Re: XC8 Compilers - Discussion
Post by: Manuel on November 16, 2020, 07:57:54 07:57
No more support.

I still use 8.92 to let ICD2 work ... it's faster in programming some controllers...but it's not supported in Win10. Use it in virtualbox.

take care,
X!


Title: Re: XC8 Compilers - Discussion
Post by: chicowood on November 16, 2020, 07:07:44 19:07
Thanks....however, for me MPLAB 8 has been working fine with Windows 10 (both 32 and 64 bit) for a long time without problems.

But you're probably right about xc8 v2.31 not being supported for use with MPLAB 8...as I recall, in the old days just installing a new xc8 version made it appear in MPLAB 8 as a Toolsuite option...it didn't this time...

I still prefer MPLAB 8 to MPLAB X after all these years, even though it's long outdated...I spend a lot of time fussing with MPLAB X and all its little ongoing issues.


Title: Re: XC8 Compilers - Discussion
Post by: metal on November 16, 2020, 07:13:18 19:13
may be it is time to move to mplabx..


Title: Re: XC8 Compilers - Discussion
Post by: Manuel on November 16, 2020, 08:16:11 20:16
Exactly,

move to MPLABX , u will have just advantages...

The only limit I had is the fact that MPLABX do not support ICD2 anymore...

Take care
X!


Title: Re: XC8 Compilers - Discussion
Post by: chicowood on November 17, 2020, 01:17:46 01:17
Well, indeed, I've been using MPLABX since it first came out.

I'm just not a fan. Of all the IDEs I use, it's by far my least favorite.

When I fired up MPLAB 8 for this old project, it brought back some fond memories of the earlier PIC days.


Title: Re: XC8 Compilers - Discussion
Post by: tumbleweed on November 17, 2020, 06:34:42 18:34
Quote
I don't know how to get v2.31 to register with MPLAB 8
As others have pointed out, AKAIK there's no way to get any of the XC8 v2.xx versions running in MPLAB 8.92.

They stopped including the files you need to get it registered into MPLAB right around the version you have installed that works (v1.43),
although I seem to remember being able to get v1.45 working as well.

I'm with you... even though MPLAB 8 is old, at least it works. I've had nothing but problems with MPLABX, and I've tried them all.
It has SERIOUS problems connecting reliably to the ICD tools and that's across a number of different PC's, OS's and debug tools.




Title: Re: XC8 Compilers - Discussion
Post by: chicowood on November 17, 2020, 07:22:12 19:22
Yes, I have found the Netbeans IDE structure to be clumsy and difficult to keep running as a problem-free tool.

While not usually a fan of Microsoft products, I like Visual Studio. It has a couple of Arduino plugins that are impressive, much better than the basic Arduino IDE. I also use Visual Studio for .NET work (Visual Basic, mostly).

I haven't used Eclipse but friends tell me it's pretty good, too.

Would love to see a PIC plugin for Visual Studio...(dream on...;) )



Title: Re: XC8 Compilers - Discussion
Post by: Jagi on December 30, 2020, 04:21:43 16:21
Yes, I have found the Netbeans IDE structure to be clumsy and difficult to keep running as a problem-free tool.

Well, someone is seeing from my side. I have had enough problems with the IDE, especially when opening large projects. The background scanning is a mess resulting in the code parser failing to work. Connection to the ICD is another problem area and I don't see much hope from Microchip.

As of now we are continuing our development using MPLAB 8.x and we have created some scripts (actually batch files) which invoke the latest 2.xx version compiler. I will check with my Engg dept if they can allow us to share those scripts publicly, once I get the confirmation, I may be able to share the same with you folks.


Title: Re: XC8 Compilers - Discussion
Post by: metal on December 30, 2020, 10:03:31 22:03
Jagi,

As long as your company is using MPLAB 8.x, why don't they just use Eclipse for an IDE? it offers superior features compared to those offered by outdated MPLAB 8.x, does it offer auto-complete feature as in modern IDEs?

Also, MPLAB X offers MCC which is handy most of the time, regardless of how buggy it is, you must review the code before using it anyway (this is doable for simple projects). However, this is not applicable in the case of STM32 HAL because the library is huge!

So, Netbeans vs. Eclipse, Eclipse wins, why Microchip did not use it, another bad decision..

chicowood, no body is a fan of MPLAB X, thu it is the only solution currently available.


Title: Re: XC8 Compilers - Discussion
Post by: chicowood on December 31, 2020, 12:37:44 00:37
As long as your company is using MPLAB 8.x, why don't they just use Eclipse for an IDE? it offers superior features compared to those offered by outdated MPLAB 8.x, does it offer auto-complete feature as in modern IDEs?
<snip>
chicowood, no body is a fan of MPLAB X, thu it is the only solution currently available.

Metal, are you saying that Eclipse could be configured to offer basic PIC debugging, or suggesting it as just a code editor?


Title: Re: XC8 Compilers - Discussion
Post by: metal on December 31, 2020, 12:56:35 00:56
What makes you think I am suggesting such insane idea, I would not even bother thinking about that :) I just use MPLAB X and live with the issues it has, that's it.


Title: Re: XC8 Compilers - Discussion
Post by: chicowood on December 31, 2020, 12:59:45 00:59
lol, got it. I agree, I use MPLABX too, but it sure can drive you nuts sometimes...


Title: Re: XC8 Compilers - Discussion
Post by: metal on December 31, 2020, 01:15:50 01:15
It did that yesterday when it kept complaining about missing shortcuts somewhere on the PC :D


Title: Re: XC8 Compilers - Discussion
Post by: Jagi on December 31, 2020, 04:30:48 04:30
As long as your company is using MPLAB 8.x, why don't they just use Eclipse for an IDE? it offers superior features compared to those offered by outdated MPLAB 8.x, does it offer auto-complete feature as in modern IDEs?

Metal,
Thanks for the recommendation, we will look into it for future product development.


Title: Re: XC8 Compilers - Discussion
Post by: Ahmad_k on March 08, 2021, 06:24:59 18:24
Does anyone know how to debug ELF file generated by XC8 in proteus ? I upgraded an old project from Atmel studio GCC to XC8, but ELF file cannot be debugged.

If i switch from ELF to COFF in settings then the project cannot be compiled.


Title: Re: XC8 Compilers - Discussion
Post by: metal on March 08, 2021, 10:03:01 22:03
If I remember correctly, I had to use AVR GNU toolchain to be able to produce COFF files.


Title: Re: XC8 Compilers - Discussion
Post by: Ahmad_k on March 09, 2021, 04:42:56 04:42
If I remember correctly, I had to use AVR GNU toolchain to be able to produce COFF files.

AVR GNU toolchain has serious problem when debugging also. I cannot monitor variable inside a subroutine until it is a global variable, that's why i'm trying to switch to XC8


Title: Re: XC8 Compilers - Discussion
Post by: pickit2 on March 09, 2021, 09:57:31 09:57
AVR GNU toolchain has serious problem when debugging also. I cannot monitor variable inside a subroutine until it is a global variable, that's why i'm trying to switch to XC8
just a thought have you tried compiling with the tools in proteus. I remember it could not use coff files as the program in a project, until built in tools was used.



Title: Re: XC8 Compilers - Discussion
Post by: Jagi on April 28, 2021, 04:27:20 16:27
just a thought have you tried compiling with the tools in proteus. I remember it could not use coff files as the program in a project, until built in tools was used.

As far as I remember, COFF files are fully used by Proteus and it can be used for debugging at source level. The problem that I have experienced is with the ELF file format. Proteus loads the ELF file and runs the program but there is no source code. This happens only with the XC8 / AVR GNU compilers. However, when using Arduino IDE generated ELF file, it is possible to debug at source code level.
By the way, what built in tools in Proteus are you referring to?


Title: Re: XC8 Compilers - Discussion
Post by: pickit2 on June 06, 2021, 02:57:00 14:57
By the way, what built in tools in Proteus are you referring to?
 
just seen this. The tools are the compliers that come with Proteus, when importing code it would not work with Proteus, but if you compile the same code within Proteus it did.


Title: Re: XC8 Compilers - Discussion
Post by: intel on September 19, 2022, 08:06:50 20:06
Hello friends;
Whenever I need this topic, I make mistakes and omissions. I have prepared a small tool to make the job easier for myself. There may be errors. Please do not interfere or modify. If you can let me know, I'll fix it. Goodbye.


Title: Re: XC8 Compilers - Discussion
Post by: Catcatcat on September 20, 2022, 04:33:54 04:33
An interesting solution, a new compiler will be released, I will definitely test it. ;)


Title: Re: XC8 Compilers - Discussion
Post by: Manuel on September 06, 2023, 11:28:21 11:28
xc8 v2.45 ready and working...

Notes:

>> legacy C90 library is deprecated and will be discontinued in a future release
>> legacy HI-TECH support is deprecated and will be discontinued in a future release

take care,

X!


Title: Re: XC8 Compilers - Discussion
Post by: Manuel on February 01, 2024, 02:14:27 14:14
xc8 v2.46 ready and working...

take care,

X!


Title: Re: XC8 compiler for ATTiny412, Getting error
Post by: jaikumar on March 02, 2024, 06:37:10 06:37
Hi,

Getting error when trying to compile for AVR ATTiny412 controller:

Code:

make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'H:/Microchip/Projects/attiny412/proj1.X'
make  -f nbproject/Makefile-default.mk dist/default/production/proj1.X.production.hex
make[2]: Entering directory 'H:/Microchip/Projects/attiny412/proj1.X'
"H:\Microchip\MPLABX\v6.15\xc8\v2.46\bin\xc8-cc.exe"  -mcpu=ATtiny412 -c  -x c -D__ATtiny412__   -mdfp="C:/Users/jaikumar/.mchp_packs/Microchip/ATtiny_DFP/3.1.260/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -Wall -DXPRJ_default=default    -gdwarf-3 -mconst-data-in-progmem -mno-const-data-in-config-mapped-progmem     -MD -MP -MF "build/default/production/newavr-main.o.d" -MT "build/default/production/newavr-main.o.d" -MT build/default/production/newavr-main.o -o build/default/production/newavr-main.o newavr-main.c
newavr-main.c:1:0: warning: Detected corrupt executable file
 /*
 ^
newavr-main.c:1:0: note: Please reinstall the compiler
newavr-main.c:1:0: warning: Detected corrupt executable file
newavr-main.c:1:0: note: Please reinstall the compiler
"H:\Microchip\MPLABX\v6.15\xc8\v2.46\bin\xc8-cc.exe"  -mcpu=ATtiny412 -Wl,-Map=dist/default/production/proj1.X.production.map  -DXPRJ_default=default  -Wl,--defsym=__MPLAB_BUILD=1   -mdfp="C:/Users/jaikumar/.mchp_packs/Microchip/ATtiny_DFP/3.1.260/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -Wall -gdwarf-3 -mconst-data-in-progmem -mno-const-data-in-config-mapped-progmem      -Wl,--memorysummary,dist/default/production/memoryfile.xml -o dist/default/production/proj1.X.production.elf  -o dist/default/production/proj1.X.production.elf  build/default/production/newavr-main.o      -Wl,--start-group  -Wl,-lm -Wl,--end-group
Info: Loading file: h:\microchip\mplabx\v6.15\xc8\v2.46\avr\avr\bin\../lib\ldscripts/avrxmega3.xn
"H:\Microchip\MPLABX\v6.15\xc8\v2.46\bin"\\avr-objcopy -O ihex "dist/default/production/proj1.X.production.elf" "dist/default/production/proj1.X.production.hex"
make[2]: Leaving directory 'H:/Microchip/Projects/attiny412/proj1.X'
make[1]: Leaving directory 'H:/Microchip/Projects/attiny412/proj1.X'


Title: Re: XC8 Compilers - Discussion
Post by: Manuel on March 02, 2024, 10:13:28 10:13
I Just checked the PICC side to be honest.

Can you share the "corrupted" file to ... check ?

or share the project so that can try same checking...

take care

X!


Title: Re: XC8 Compilers - Discussion
Post by: jaikumar on March 04, 2024, 05:29:55 05:29
Hi,

I have attached the AVR ATTiny412 project.
The source file is simple generated file.


Title: Re: XC8 Compilers - Discussion
Post by: Manuel on March 04, 2024, 10:02:41 10:02
It get compiled with just one warning on Xide 6.20.

There should be some issue on your side i think.


take care,
X!


Title: Re: XC8 Compilers - Discussion
Post by: jaikumar on March 05, 2024, 05:06:07 05:06
Hi,

I installed version 6.20 MPLABX.
Getting this error below:
Keep getting
note: Please reinstall the compiler

Could it be because files are not patched properly.
Could you please reply with steps required to patch properly.

Code:

make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make  -f nbproject/Makefile-default.mk dist/default/production/MPLABXProjects.production.hex
make[2]: Entering directory 'C:/Users/jaikumar/MPLABXProjects'
"H:\Microchip\MPLABX\v6.15\xc8\v2.46\bin\xc8-cc.exe"  -mcpu=ATtiny412 -c  -x c -D__ATtiny412__   -mdfp="D:/Microchip/MPLABX/v6.20/packs/Microchip/ATtiny_DFP/3.1.260/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -Wall -DXPRJ_default=default    -gdwarf-3 -mno-const-data-in-progmem     -MD -MP -MF "build/default/production/main.o.d" -MT "build/default/production/main.o.d" -MT build/default/production/main.o -o build/default/production/main.o main.c
make[2]: Leaving directory 'C:/Users/jaikumar/MPLABXProjects'
main.c:1:0: warning: Detected corrupt executable file
  /*
 ^
main.c:1:0: note: Please reinstall the compiler
main.c:1:0: warning: Detected corrupt executable file
main.c:1:0: note: Please reinstall the compiler
main.c: In function 'main':
main.c:42:5: error: 'sdfsf' undeclared (first use in this function)
     sdfsf
     ^
main.c:42:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:44:5: error: expected ';' before 'while'
     while(1)
     ^
make[2]: *** [nbproject/Makefile-default.mk:162: build/default/production/main.o] Error 1
make[2]: *** Waiting for unfinished jobs....
mcc_generated_files/system/src/protected_io.S:1:0: warning: Detected corrupt executable file
 /**
 ^
mcc_generated_files/system/src/protected_io.S:1:0: note: Please reinstall the compiler
mcc_generated_files/system/src/protected_io.S:1:0: warning: Detected corrupt executable file
mcc_generated_files/system/src/protected_io.S:1:0: note: Please reinstall the compiler
mcc_generated_files/system/src/config_bits.c:1:0: warning: Detected corrupt executable file
 /**
 ^
mcc_generated_files/system/src/config_bits.c:1:0: note: Please reinstall the compiler
mcc_generated_files/system/src/config_bits.c:1:0: warning: Detected corrupt executable file
mcc_generated_files/system/src/config_bits.c:1:0: note: Please reinstall the compiler
make[2]: Entering directory 'C:/Users/jaikumar/MPLABXProjects'
"H:\Microchip\MPLABX\v6.15\xc8\v2.46\bin\xc8-cc.exe" -c  -mcpu=ATtiny412  -x assembler-with-cpp -D__ATtiny412__   -mdfp="D:/Microchip/MPLABX/v6.20/packs/Microchip/ATtiny_DFP/3.1.260/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -Wall -DXPRJ_default=default  -gdwarf-3 -mno-const-data-in-progmem -Wa,--defsym=__MPLAB_BUILD=1   -MD -MP -MF "build/default/production/mcc_generated_files/system/src/protected_io.o.d" -MT "build/default/production/mcc_generated_files/system/src/protected_io.o.d" -MT build/default/production/mcc_generated_files/system/src/protected_io.o -o build/default/production/mcc_generated_files/system/src/protected_io.o  mcc_generated_files/system/src/protected_io.S
make[2]: Leaving directory 'C:/Users/jaikumar/MPLABXProjects'
make[2]: Entering directory 'C:/Users/jaikumar/MPLABXProjects'
"H:\Microchip\MPLABX\v6.15\xc8\v2.46\bin\xc8-cc.exe"  -mcpu=ATtiny412 -c  -x c -D__ATtiny412__   -mdfp="D:/Microchip/MPLABX/v6.20/packs/Microchip/ATtiny_DFP/3.1.260/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -Wall -DXPRJ_default=default    -gdwarf-3 -mno-const-data-in-progmem     -MD -MP -MF "build/default/production/mcc_generated_files/system/src/config_bits.o.d" -MT "build/default/production/mcc_generated_files/system/src/config_bits.o.d" -MT build/default/production/mcc_generated_files/system/src/config_bits.o -o build/default/production/mcc_generated_files/system/src/config_bits.o mcc_generated_files/system/src/config_bits.c
make[2]: Leaving directory 'C:/Users/jaikumar/MPLABXProjects'
mcc_generated_files/system/src/system.c:1:0: warning: Detected corrupt executable file
 /**
 ^
mcc_generated_files/system/src/system.c:1:0: note: Please reinstall the compiler
mcc_generated_files/system/src/system.c:1:0: warning: Detected corrupt executable file
mcc_generated_files/system/src/system.c:1:0: note: Please reinstall the compiler
mcc_generated_files/system/src/clock.c:1:0: warning: Detected corrupt executable file
 /**
 ^
mcc_generated_files/system/src/clock.c:1:0: note: Please reinstall the compiler
mcc_generated_files/system/src/clock.c:1:0: warning: Detected corrupt executable file
mcc_generated_files/system/src/clock.c:1:0: note: Please reinstall the compiler
make[2]: Entering directory 'C:/Users/jaikumar/MPLABXProjects'
"H:\Microchip\MPLABX\v6.15\xc8\v2.46\bin\xc8-cc.exe"  -mcpu=ATtiny412 -c  -x c -D__ATtiny412__   -mdfp="D:/Microchip/MPLABX/v6.20/packs/Microchip/ATtiny_DFP/3.1.260/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -Wall -DXPRJ_default=default    -gdwarf-3 -mno-const-data-in-progmem     -MD -MP -MF "build/default/production/mcc_generated_files/system/src/system.o.d" -MT "build/default/production/mcc_generated_files/system/src/system.o.d" -MT build/default/production/mcc_generated_files/system/src/system.o -o build/default/production/mcc_generated_files/system/src/system.o mcc_generated_files/system/src/system.c
make[2]: Leaving directory 'C:/Users/jaikumar/MPLABXProjects'
make[2]: Entering directory 'C:/Users/jaikumar/MPLABXProjects'
"H:\Microchip\MPLABX\v6.15\xc8\v2.46\bin\xc8-cc.exe"  -mcpu=ATtiny412 -c  -x c -D__ATtiny412__   -mdfp="D:/Microchip/MPLABX/v6.20/packs/Microchip/ATtiny_DFP/3.1.260/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -Wall -DXPRJ_default=default    -gdwarf-3 -mno-const-data-in-progmem     -MD -MP -MF "build/default/production/mcc_generated_files/system/src/clock.o.d" -MT "build/default/production/mcc_generated_files/system/src/clock.o.d" -MT build/default/production/mcc_generated_files/system/src/clock.o -o build/default/production/mcc_generated_files/system/src/clock.o mcc_generated_files/system/src/clock.c
make[2]: Leaving directory 'C:/Users/jaikumar/MPLABXProjects'
mcc_generated_files/system/src/interrupt.c:1:0: warning: Detected corrupt executable file
 /**
 ^
mcc_generated_files/system/src/interrupt.c:1:0: note: Please reinstall the compiler
mcc_generated_files/system/src/interrupt.c:1:0: warning: Detected corrupt executable file
mcc_generated_files/system/src/interrupt.c:1:0: note: Please reinstall the compiler
mcc_generated_files/system/src/pins.c:1:0: warning: Detected corrupt executable file
 /**
 ^
mcc_generated_files/system/src/pins.c:1:0: note: Please reinstall the compiler
mcc_generated_files/system/src/pins.c:1:0: warning: Detected corrupt executable file
mcc_generated_files/system/src/pins.c:1:0: note: Please reinstall the compiler
make[1]: *** [nbproject/Makefile-default.mk:85: .build-conf] Error 2
make[2]: Entering directory 'C:/Users/jaikumar/MPLABXProjects'
make: *** [nbproject/Makefile-impl.mk:39: .build-impl] Error 2
"H:\Microchip\MPLABX\v6.15\xc8\v2.46\bin\xc8-cc.exe"  -mcpu=ATtiny412 -c  -x c -D__ATtiny412__   -mdfp="D:/Microchip/MPLABX/v6.20/packs/Microchip/ATtiny_DFP/3.1.260/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -Wall -DXPRJ_default=default    -gdwarf-3 -mno-const-data-in-progmem     -MD -MP -MF "build/default/production/mcc_generated_files/system/src/interrupt.o.d" -MT "build/default/production/mcc_generated_files/system/src/interrupt.o.d" -MT build/default/production/mcc_generated_files/system/src/interrupt.o -o build/default/production/mcc_generated_files/system/src/interrupt.o mcc_generated_files/system/src/interrupt.c
make[2]: Leaving directory 'C:/Users/jaikumar/MPLABXProjects'
make[2]: Entering directory 'C:/Users/jaikumar/MPLABXProjects'
"H:\Microchip\MPLABX\v6.15\xc8\v2.46\bin\xc8-cc.exe"  -mcpu=ATtiny412 -c  -x c -D__ATtiny412__   -mdfp="D:/Microchip/MPLABX/v6.20/packs/Microchip/ATtiny_DFP/3.1.260/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -Wall -DXPRJ_default=default    -gdwarf-3 -mno-const-data-in-progmem     -MD -MP -MF "build/default/production/mcc_generated_files/system/src/pins.o.d" -MT "build/default/production/mcc_generated_files/system/src/pins.o.d" -MT build/default/production/mcc_generated_files/system/src/pins.o -o build/default/production/mcc_generated_files/system/src/pins.o mcc_generated_files/system/src/pins.c
make[2]: Leaving directory 'C:/Users/jaikumar/MPLABXProjects'

BUILD FAILED (exit value 2, total time: 2s)




Title: Re: XC8 Compilers - Discussion
Post by: Manuel on March 05, 2024, 07:58:46 07:58
Check Reply #141.

.... "the renamed file can stay in the same directly" before apply the "final solution".

take care,
X!