Page 1 of 1
UART Macro wont compile after update.
Posted: Tue Apr 29, 2025 9:45 am
by jay_dee
Hi,
If I enable a certain user macro, it wont compile. This macro uses UART and has run without fault for many years.
Fault exists in both software and hardware mode.
Code: Select all
C:\Users\jdwed\Desktop\FlowCode>"C:\Program Files (x86)\Flowcode\Common\Compilers\picv2\bin\xc8-cc.exe" -mcpu=18F4680 "VT100_Test.c" -w=359,1273,1388 -fno-short-float -fno-short-double -std=c90 -Os
C:\ProgramData\MatrixTSL\FlowcodeV10\CAL\PIC\PIC_CAL_String.c:871:: error: (712) can't generate code for this expression
(908) exit status = 1
Error returned from [xc8.exe]
C:\ProgramData\MatrixTSL\FlowcodeV10\FCD\PIC\batch\pic_xc8_comp.bat reported error code 0x1
I have thinned the entire FC and Macro down to just a few lines and single call. Still wont compile. example below.
I've run latest updates and restarted FC. thanks, J.
FC 10.1.2.40
Re: UART Macro wont compile after update.
Posted: Tue Apr 29, 2025 10:17 am
by Sasi
Hi jay_dee,
Change the compiler to XC8 v2.50. This will make the compilation work and hopefully the UART as well.
Regards, Sasi
Re: UART Macro wont compile after update.
Posted: Tue Apr 29, 2025 11:01 am
by jay_dee
Hi, Thanks.
Latest version on Microchip website if Ver 3.00. Is the recomendation to roll back to v2.50? or is 3.00 good?
If I installed the latest 3.00 XC8 compiler directly would I need to re-direct the FC complier settings?
Global Settings / Locations / PIC - change path to new compiler install location.
It was: C:\Program Files (x86)\Flowcode\Common\Compilers\picv2\
change to: C:\Program Files\Microchip\xc8\v3.00\pic\
having done this I still get the same error.
thanks, J.
Re: UART Macro wont compile after update.
Posted: Tue Apr 29, 2025 11:26 am
by Sasi
Hi,
Flowcode is currently not compatible with v3.00.
It only compiles with v2.50, which you can find in the compiler archives on the Microchip website. Your procedure for replacing the compiler is correct.
I have a similar problem with a PIC18F46K80 MCU.
viewtopic.php?t=3097
If the UART works, please check if the input ports work on yours. Because I have problems with them.
Regards,
Sasi
Re: UART Macro wont compile after update.
Posted: Tue Apr 29, 2025 1:55 pm
by jay_dee
Sasi, Thanks. I installed and linked to V2.50 and the program now compiles without issue.
Unfortunatly I dont have any AV inputs to check for you. I'm doing everything through I2C and a Single UART Tx pin.
I run the comms to the PC using Hardware UART @57600.
I would be interested in any thoughts from the FC team, as I'm keen to keep my install as standard as possible to avoid issues with new FC upgrades.
J.
Re: UART Macro wont compile after update.
Posted: Tue Apr 29, 2025 2:13 pm
by medelec35
Hello.
I have noticed that it's the 18F series that has the problem, and not the 16F series.
As an alternative, can you try the following to fix using compiler that is on the Flowcode's download page.
You will either need to copy or edit pic_xc8_comp.bat found within
Code: Select all
%ProgramData%\MatrixTSL\FlowcodeV10\FCD\PIC\batch\
Within pic_xc8_comp.bat
Change the
at the end of
Code: Select all
"%MX_COMPILER%bin\xc8-cc.exe" -mcpu=%MX_CHIP% "%MX_PROJECT%.c" -w=359,1273,1388 -fno-short-float -fno-short-double -std=c90
So you should have
Code: Select all
"%MX_COMPILER%bin\xc8-cc.exe" -mcpu=%MX_CHIP% "%MX_PROJECT%.c" -w=359,1273,1388 -fno-short-float -fno-short-double -std=c90 -O1
Save then recompile.
Or
If you want to keep the original pic_xc8_comp.bat
Copy the original pic_xc8_comp.bat, rename it to something like pic_xc8_comp_18F_Only.bat
Make the required change, then save it.
Within
Build >
Compiler Options...
Click on the
Save Icon
Enter the name you would like for the modified pic_xc8_comp_18F_Only.bat
Scroll down and select the new compiler name, then make sure the
Default compiler for the platform C for PIC is ticked.
Select OK
Niote, you will probably find that the size of generated code is a bit larger since the new settings change Optimisation from
-Os (Optimize for Size): Focuses on reducing code size as much as possible.
to
-O1 (Basic Optimization): Balances speed and size, providing moderate optimizations without overly aggressive changes.
@Sasi I wonder if the above will sort your issues out?
Re: UART Macro wont compile after update.
Posted: Tue Apr 29, 2025 7:03 pm
by Sasi
Hi Martin,
I tried what you suggested. This modification seems to help.
The digital input portbit now works with the XC8 v2.50 compiler.
viewtopic.php?t=3102
The "SendString" UART Component Command still only works with the v2.50 Compiler.
viewtopic.php?t=3097
I'm moving to the v2.50 compiler and hope everything will be fine.
Thank you very much.
Regards,
Sasi
Re: UART Macro wont compile after update.
Posted: Tue Apr 29, 2025 7:15 pm
by medelec35
You're welcome, and lets hope so.
The compiler seems to be a pit of a pain when it comes to 18F series.
I'm glad the inputs now work for you.
Thanks for letting me know.