Page 1 of 1

Using XC8 V2.00 or greater with Flowcode 8

Posted: Tue Jun 04, 2019 12:09 pm
by medelec35
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.

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

Posted: Thu Jun 06, 2019 9:10 am
by Benj
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?

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

Posted: Thu Jun 06, 2019 4:56 pm
by medelec35
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.