Using XC8 V2.00 or greater with Flowcode 8

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8236
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2358 times
Been thanked: 3346 times
Contact:

Using XC8 V2.00 or greater with Flowcode 8

Postby medelec35 » Tue Jun 04, 2019 12:09 pm

Microchip have changed the way XC8 compiler works from V2.00
Pre V2.0 the default was to use C90 as standard.
From V2.0 the default is C99 as standard.
This will mean you will not get expected results if you start using XC8 V2.00 or above, especially if using pro version of compiler.
One typical example, Compiled a large flowchart with target = 18F47K40 & pro version XC8 V1.45 (default Flowcode V8 Compiler) I was getting 78% used (in V1.45 there is a bug which means the used value is a few % higher than it should be)
Tried with V2.05 (only changing path and not parameters) I was getting 93.2 % used. :(

After contacting microchip support, A new batch file was created for me and I thought I would share it for anyone who wants to use XC8 V2.0 or above:

Code: Select all

@REM $(chip) "$(outdir)" "$(target)"
@PUSHD %~2
"C:\Program Files (x86)\Microchip\xc8\v2.00\bin\xc8-cc.exe" -mcpu=%~1 "%~3.c" -w=359,1273,1388 -fshort-float -fshort-double -std=c90 -Os
@POPD
@IF %ERRORLEVEL% NEQ 0 GOTO Error
@ECHO.
@ECHO Compilation successful!
@EXIT 0
:Error
@ECHO.
@ECHO Error returned from [xc8.exe]
@EXIT 1

After compiling with new batch file, the result is 73% used, much better than 93.2 used!

The batch files can be found within 64 bit windows:

Code: Select all

C:\Program Files (x86)\Flowcode\Compilers\pic\batch\

32 bit windows:

Code: Select all

C:\Program Files\Flowcode\Compilers\pic\batch\

I would recommend keeping original batch files and just create a new batch file for each compiler version.
These users thanked the author medelec35 for the post (total 2):
kersing (Tue Jun 04, 2019 9:55 pm) • Benj (Thu Jun 06, 2019 9:09 am)
Rating: 11.76%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
Benj
Matrix Staff
Posts: 13980
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4244 times
Been thanked: 4006 times
Contact:

Re: Using XC8 V2.00 or greater with Flowcode 8

Postby Benj » Thu Jun 06, 2019 9:10 am

Thanks Martin,

Some good info there! wow that memory usage jumped a lot. Not too up on the C standards so I wonder what C99 brings to the table that C90 cannot do?

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8236
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2358 times
Been thanked: 3346 times
Contact:

Re: Using XC8 V2.00 or greater with Flowcode 8

Postby medelec35 » Thu Jun 06, 2019 4:56 pm

Hi Ben,
This is the full information from micorochip:
Martin,

So, today I installed flowcode on my machine and created a sample project. And Now I understood the situation.

I think there is no real issue of PRO vs Free compiler here. Your license is working fine and it is evident from xclm -status.

The issue it that , with xc8 v2.00, we had major changes , we have introduced XC8-CC drivers which act as wrapper for XC8 , we have also introduced AVR devices with XC8.

So, to stream line process , compiler option were also changed. So any warning about " option didn't recognised" relate to this.

Second thing , XC8v2.00 default compiles with C99 standard . C99 do not allow to use custom keyword to use. so instead 'interrupt' you need to use '__interrupt()'.

However , you can switch back to C90 standard.


Given all these, I want you use my attached .bat file and compile the project with XC8v2.0.

Also, I believe flowcode ( Matrix ) should also note about this and update their code base , if you can inform them it will be great.

Let me know if it works.


Regards,

Parth

Left the name in case more information was required.
If it is then I can PM you the case number?
As you can see, Matrix is mentioned.
These users thanked the author medelec35 for the post:
Benj (Mon Jun 10, 2019 3:48 pm)
Rating: 5.88%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.