• AVR Freaks

Helpful Replyinterrupt_manager.h does not compile with XC 2.0

Page: 12 > Showing page 1 of 2
Author
pavel.cernohorsky
New Member
  • Total Posts : 15
  • Reward points : 0
  • Joined: 2016/08/20 01:08:16
  • Location: 0
  • Status: offline
2018/06/30 11:01:18 (permalink)
4 (1)

interrupt_manager.h does not compile with XC 2.0

Hi, I have newly started project with PIC18F25K50, MCC version 3.55.1, MPLABX version 4.20. In MCC, I have set up only oscillator frequency, I added MLA USB Device Lite, I used workaround described in https://www.microchip.com/forums/m1049605.aspx and resulting generated interrupt_manager.h fails to compile on the following line:
 
void interrupt INTERRUPT_InterruptManager(void);
 
I can reproduce the same problem just by starting a new project in MPLABX, using "Samples/Microchip Embedded/PIC18 C Template" as a base and I get to the same error. The workaround is to manually edit the line to:
 
void __interrupt() INTERRUPT_InterruptManager(void);
 
My question is, don't you guys have some automated tests? How can you release products, which just do not fit together at all? Is there some table of versions of your products I can safely use together, which actually work? I kind of blindly assumed, that if I just duwnload "the latest" of everything, I will not have any problems, but I even had to apply the earlier mentioned workaround. When will these bugs be fixed?
#1
NKurzman
A Guy on the Net
  • Total Posts : 18914
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: online
Re: interrupt_manager.h does not compile with XC 2.0 2018/06/30 11:30:56 (permalink)
5 (1)
Read the release notes for your Version of MCC. See what compiler they certified it with.
If you want to use 2.XX read its release notes. They have moved to a newer version of the C specification. It has some differences.
#2
pavel.cernohorsky
New Member
  • Total Posts : 15
  • Reward points : 0
  • Joined: 2016/08/20 01:08:16
  • Location: 0
  • Status: offline
Re: interrupt_manager.h does not compile with XC 2.0 2018/06/30 12:06:19 (permalink)
0
Hello NKurzman,
I am looking at the release notes: http://ww1.microchip.com/downloads/en/DeviceDoc/release_notes_mcc_3_55.pdf , but unfortunately, I cannot find any versions of compilers this MCC is supposed to work with? Can you please show me what you had in mind?
#3
1and0
Access is Denied
  • Total Posts : 11155
  • Reward points : 0
  • Joined: 2007/05/06 12:03:20
  • Location: Harry's Gray Matter
  • Status: offline
Re: interrupt_manager.h does not compile with XC 2.0 2018/06/30 13:00:48 (permalink)
0
Did you by chance enable the C99 standard with --std=c99?
#4
pavel.cernohorsky
New Member
  • Total Posts : 15
  • Reward points : 0
  • Joined: 2016/08/20 01:08:16
  • Location: 0
  • Status: offline
Re: interrupt_manager.h does not compile with XC 2.0 2018/06/30 13:31:57 (permalink)
0
Hello 1and0, no, I haven't (at least not manually). If it hasn't been enabled by default in a new project in the MPLABX version I mentioned earlier, or if it hasn't been enabled by the MCC version I mentioned earlier, it is not enabled... double checking on the command line...
 
"C:\Program Files (x86)\Microchip\xc8\v2.00\bin\xc8-cc.exe"  -mcpu=18F25K50 -c  -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_default=default  -msummary=-psect,-class,+mem,-hex,-file  -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits   -std=c99 -gdwarf-3 -mstack=compiled:auto:auto:auto     -o build/default/production/mcc_generated_files/interrupt_manager.p1 mcc_generated_files/interrupt_manager.c
 
... yes, it is enabled... I have tried to create new empty project with the same device and add empty main.c, this time no MCC involved...
 
"C:\Program Files (x86)\Microchip\xc8\v2.00\bin\xc8-cc.exe" -mcpu=18F25K50 -c -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c99 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/default/production/main.p1 main.c
 
Seems like the option is there by default. Not sure, whether it's MPLABXs work, or whether it only asks the compiler for some default flags. Anyway, it is on by default in a empty new project.
#5
1and0
Access is Denied
  • Total Posts : 11155
  • Reward points : 0
  • Joined: 2007/05/06 12:03:20
  • Location: Harry's Gray Matter
  • Status: offline
Re: interrupt_manager.h does not compile with XC 2.0 2018/06/30 13:40:26 (permalink)
4 (2)
pavel.cernohorsky
Seems like the option is there by default. Not sure, whether it's MPLABXs work, or whether it only asks the compiler for some default flags. Anyway, it is on by default in a empty new project.

According to the release notes, xc8-cc.exe by default will compile for C99 conformance. So either use option -std=c90 or use the previous xc8.exe.
post edited by 1and0 - 2018/06/30 13:42:29
#6
pavel.cernohorsky
New Member
  • Total Posts : 15
  • Reward points : 0
  • Joined: 2016/08/20 01:08:16
  • Location: 0
  • Status: offline
Re: interrupt_manager.h does not compile with XC 2.0 2018/06/30 14:21:54 (permalink)
0
Well, of course, I can download older compiler or I can manually edit the code as described earlier, but from my point of view, Microchip should start paying attention to making their products which are supposed to work together, actually work together. MCC should be fixed. If it is the default latest thing to download and if you don't manually change any options, it should just work. And I am still wondering, how could have they not noticed this. This means that they really do not do any real automated pre-release tests? Seriosly?... ouch!
#7
1and0
Access is Denied
  • Total Posts : 11155
  • Reward points : 0
  • Joined: 2007/05/06 12:03:20
  • Location: Harry's Gray Matter
  • Status: offline
Re: interrupt_manager.h does not compile with XC 2.0 2018/06/30 14:43:23 (permalink)
0
Yeah, MCC needs to catch up with the latest XC8 v2.00. ;)
 
#8
1and0
Access is Denied
  • Total Posts : 11155
  • Reward points : 0
  • Joined: 2007/05/06 12:03:20
  • Location: Harry's Gray Matter
  • Status: offline
Re: interrupt_manager.h does not compile with XC 2.0 2018/06/30 14:50:54 (permalink)
3 (1)
pavel.cernohorsky
Well, of course, I can download older compiler ...

There are two XC8 .exe files for version 2.00:  xc8-cc.exe and xc8.exe.
 
#9
NKurzman
A Guy on the Net
  • Total Posts : 18914
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: online
Re: interrupt_manager.h does not compile with XC 2.0 2018/06/30 15:13:32 (permalink)
3 (1)
If it is holding you up, get the last 1.XX compiler. You can work on 2.0 later.
It appears the jump to 2 will be a big step.
It is upto you if you want to be the trail breaker. It is Saturday you are unlikely to hear from Microchip till Monday in the US for MCC or Australia for XC8
#10
qɥb
Monolothic Member
  • Total Posts : 3332
  • Reward points : 0
  • Joined: 2017/09/09 05:07:30
  • Location: Jupiter
  • Status: offline
Re: interrupt_manager.h does not compile with XC 2.0 2018/06/30 15:20:24 (permalink)
4 (2)
I believe the XC8 team were relocated to the US when Microchip bought them.
Pavel, you've been a member since 2016, so you should know that you are NOT talking to Microchip on this board.
"You guys" is us, other users of the products.
Yes, Microchip employees sometimes look in, but a Support Ticket is the way to get their attention.
 

This forum is mis-configured so it only works correctly if you access it via https protocol.
The Microchip website links to it using http protocol. Will they ever catch on?
PicForum "it just works"
#11
RISC
Super Member
  • Total Posts : 5776
  • Reward points : 0
  • Status: offline
Re: interrupt_manager.h does not compile with XC 2.0 2018/06/30 15:28:05 (permalink)
0
Hi,
Xc8 v2.00 operates perfectly with MCC....if you read the documentation... :
https://www.microchip.com/forums/m1056620.aspx
Regards
 
#12
1and0
Access is Denied
  • Total Posts : 11155
  • Reward points : 0
  • Joined: 2007/05/06 12:03:20
  • Location: Harry's Gray Matter
  • Status: offline
Re: interrupt_manager.h does not compile with XC 2.0 2018/06/30 19:44:30 (permalink)
3 (1)
An article from that thread states:
 
Absolute Addressing
 
If you are using C99, variables and functions that were placed at a specific address using the @ address construct must use __at(address) to indicate the address at which the object or function should be located.
 
Interrupt Functions
 
Interrupt functions when building with C99 must be defined using the __interrupt() specifier and appropriate arguments.
#13
NKurzman
A Guy on the Net
  • Total Posts : 18914
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: online
Re: interrupt_manager.h does not compile with XC 2.0 2018/06/30 22:04:46 (permalink)
0
As far as I know jeff(mad c) is still down under , where microchip does what is beyond me.
#14
VS89
Starting Member
  • Total Posts : 29
  • Reward points : 0
  • Joined: 2012/08/06 02:50:22
  • Location: 0
  • Status: offline
Re: interrupt_manager.h does not compile with XC 2.0 2018/07/04 03:38:33 (permalink)
0
I believe this problem only occurs when we are using MPLAB X 4.20
In this version, it selects c99 as the default C standard.
This can be changes by going to the properties(of project)>XC8 global options> C standard combo box. Change it to C90... The MCC code will work as expected.
 
If you are using MPLAB X 4.15 or less, using the XC8 2.00 wont cause any issues.
post edited by VS89 - 2018/07/04 03:42:26

Attached Image(s)

#15
mlp
boots too small
  • Total Posts : 966
  • Reward points : 0
  • Joined: 2012/09/10 15:12:07
  • Location: previously Microchip XC8 team
  • Status: offline
Re: interrupt_manager.h does not compile with XC 2.0 2018/07/05 12:47:04 (permalink)
3 (1)
qɥb
I believe the XC8 team were relocated to the US when Microchip bought them.

Nope. The ex-HI-TECH blokes are still in Brisbane, but their ("new" ... it has been 9-ish years now) managers are in Arizona.
 
[Background: I was with HI-TECH in Oz, did other things for some years, rejoined the post-acquisition XC8 team, moved to the States for personal reasons but remained part of the same team, and am now Not Microchip Any More.]

Mark (this opinion available for hire)
#16
qɥb
Monolothic Member
  • Total Posts : 3332
  • Reward points : 0
  • Joined: 2017/09/09 05:07:30
  • Location: Jupiter
  • Status: offline
Re: interrupt_manager.h does not compile with XC 2.0 2018/07/05 13:51:00 (permalink)
0
Thanks for the background Mark. Maybe it was your move that fooled me :)
 

This forum is mis-configured so it only works correctly if you access it via https protocol.
The Microchip website links to it using http protocol. Will they ever catch on?
PicForum "it just works"
#17
cobusve
Super Member
  • Total Posts : 495
  • Reward points : 0
  • Joined: 2012/04/02 16:15:40
  • Location: Chandler
  • Status: offline
Re: interrupt_manager.h does not compile with XC 2.0 2018/09/05 19:38:31 (permalink) ☄ Helpfulby jswanson 2018/09/12 08:45:04
5 (3)
Hi Guys here is the full story:


With XC8 2.0 we are very excited that we get an improved compiler front-end, which brings things like C99 features to us which we are very happy to have.
 
Unfortunately pre-XC8 2.0 we had some keywords in the compiler which were not strictly conforming to the C standard. 
 
Keywords like these:
  1. Using "bit" as a variable type
  2. Using "interrupt" to mark interrupt functions
  3. Using "int i @0x88" to hard locate a variable at a ram location
  4. Using "#asm" to create inline assembly.
Together with the wonders we get with the new front-end we have also lost support for the "old" way of doing these things which was not strictly standards compliant. XC8 has for a while allowed the corrected syntax but with 2.0, due to the improved front-end implementation, these non-standard keywords are no longer available.
 
Unfortunately MCC has been using too many of this pre-XC8 2.0 syntax and this can now cause some compatibility issues.
 
To minimize problems the IDE will default any "old project" you open (and change the compiler to XC8 2.0) to pass in "C Standard = C90" which can be set under "XC8 Global Options". This will tell the compiler to use the pre-XC8v2.0  front-end to compile your code which should give you the same behavior you got before with XC8 v1.45 and earlier. If you use MCC with this project you should experience no problems.
 
When you make a new project it will default to "=C99" which means the deprecated syntax will cause compilation errors where the above syntax was used. You can get these projects to work easily by either fixing the code to use the standards-compliant CCI syntax - or changing the define to C90 and leave the code unchanged (leaving the problem for later so to speak)
 
The correct syntax is (the underscores are all double-underscores btw.):
  1. "__bit" for the "bit" type
  2. "__interrupt()" instead of just "interrupt" - yes the brackets are required.
  3. To hard locate a variable use e.g. "int i __at(0x88)"
  4. For inline asm use "asm()"
There are also a couple of small issues which should be resolved in the next compiler release. These are:
  1. The int24_t type define in stdint.h is not present for C99 mode, it will be there soon.
  2. There is a change in the Vectored Interrupt vector names which we are still looking into, contact me if you run into this one and I can help.
We have released a new version of the MCC 8-bit libraries which will addresses these issues by converting the code to CCI compatible syntax which will make it work on all modes and versions of the XC8 compiler. This can be downloaded from microchip.com/mcc.

The first version of the libraries with the update is v1.75 

 
 
#18
cobusve
Super Member
  • Total Posts : 495
  • Reward points : 0
  • Joined: 2012/04/02 16:15:40
  • Location: Chandler
  • Status: offline
Re: interrupt_manager.h does not compile with XC 2.0 2018/09/05 19:39:33 (permalink)
0
duplicate post removed
post edited by cobusve - 2018/09/05 19:44:53
#19
qhb
Superb Member
  • Total Posts : 9999
  • Reward points : 0
  • Joined: 2016/06/05 14:55:32
  • Location: One step ahead...
  • Status: offline
Re: interrupt_manager.h does not compile with XC 2.0 2018/09/05 21:10:00 (permalink)
0
Thanks for the background Cobus.
From some of the questions posted on this forum recently, it would appear that THIS step isn't always working:
cobusve
To minimize problems the IDE will default any "old project" you open (and change the compiler to XC8 2.0) to pass in "C Standard = C90" which can be set under "XC8 Global Options". This will tell the compiler to use the pre-XC8v2.0  front-end to compile your code which should give you the same behavior you got before with XC8 v1.45 and earlier. If you use MCC with this project you should experience no problems.

I don't use MCC, so I have no experience of this.
 

Nearly there...
#20
Page: 12 > Showing page 1 of 2
Jump to:
© 2020 APG vNext Commercial Version 4.5