Compiling w/ HiTech C and xc8: SUCCESS + minor issues

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
chicoDaMan
Posts: 10
Joined: Sun Apr 24, 2016 1:18 am
Has thanked: 2 times
Been thanked: 4 times
Contact:

Compiling w/ HiTech C and xc8: SUCCESS + minor issues

Post by chicoDaMan »

Hi - I recently purchased Flowcode 6.

I was disappointed to find that, unlike Flowcode 5, FC6 does not compile with Microchip's High-Tech or xc8 compilers, despite Flowcode's statements that it supports the High-Tech C compiler. (Flowcode 6 wiki): http://www.matrixtsl.com/wiki/index.php ... (PICmicro)

It appears from examining the FC6 files that FC6 support was attempted but abandoned, leaving HTC compilation in a broken state.

The good news: I was able to modify the necessary files in the Flowcode 6 folders and can now successfully compile with the High-Tech C and xc8 compilers. This allows me to use Flowcode in my workflow, using Microchip tools such as MPLAB 8, MPLABX, ICD3, etc. Nice!

However, there are a couple of minor issues with the Flowcode application that I cannot repair, because these issues are generated by the Flowcode application itself, and cannot be fixed by modifying the Flowcode C files.

(Issue #1) For High-Tech C and xc8, Flowcode 6 incorrectly places the "__CONFIG" byte macro in the generated .c file. The generated code:

Code: Select all

#ifdef _BOOSTC
#pragma DATA 0x2007, 0x30D4
#endif
#ifdef HI_TECH_C
__CONFIG(0x30D4);
#endif

/*========================================================================*\
   Use :Include the type definitions
\*========================================================================*/
#include "C:\Program Files\Flowcode 6\CAL\internals.c"
The above code is broken because "internals.c" (which includes <htc.c>) MUST be included BEFORE before the config macro, because "__CONFIG()" is defined in <htc.c>.

As explained in the High-Tech C and xc8 compiler manuals:

Code: Select all

3.2.2 Configuration Fuses 

The PIC device processor’s configuration fuses (or configuration bits) may be set using the __CONFIG() macro as follows: 

__CONFIG(x);


Note there are two leading underscore characters. 
The macro is defined in <htc.h> header file, so be sure to include this into the files that uses this macro.
...For example: 
                 #include <htc.h>
                 __CONFIG(WDTDIS & HS & UNPROTECT);
Flowcode includes <htc.h> inside its "internals.c" file. So every time I compile a Flowcode project I must either (a) manually move the "__CONFIG" statement down below the "#include internals.c" statement, OR (b) uncheck the "Build>Project Options>Configure>"Write Config on Download" box (which is NOT sticky and must be unchecked every time the file is loaded).

Is there any way this could be repaired in Flowcode 6? (i.e., place the config macro below "include internals.c")...


(Issue #2) In general, the Flowcode 6 app terminates all lines with a CR/LF pair. Unfortunately, the FC6 app adds four lines that terminate only with a CR but no LF. This creates issues with the Microchip IDE software and other debugging tools. Breakpoints and single-stepping don't work properly without CR/LF pairs, and are offset by several lines in the IDE source code window.

Note the four lines with missing line feeds:

Image

...so this is broken in the FC6 generated code file when trying to use Microchip tools. The manual fix is to delete the CRs that terminate the above lines and replace them with CR/LF pairs using a text editor. This must be done every time I compile a Flowcode project and is an impediment to a smoothly functioning workflow.

Is there any way this could be repaired in Flowcode 6? (i.e., place CR/LF pairs at the end of the statements listed above)...


Not sure how to handle this...should I file a bug report (or "feature request" :wink: ) regarding these two issues?

Thanks.....

btw, if anybody is interested in using Flowcode 6 with the High-Tech or xc8 compilers, I'd be happy to explain how to do so. Interesting that the FC7 advance info indicates that xc8 will be supported...

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: Compiling w/ HiTech C and xc8: SUCCESS + minor issues

Post by dazz »

Hi
If you want to ask a question about v7 and xc8 click on the link as its a v7 thread.

Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

Post Reply