Flowcode + MPLAB compile errors

Moderator: Benj

Post Reply
chico
Posts: 34
Joined: Fri Dec 26, 2008 11:30 pm
Has thanked: 12 times
Been thanked: 10 times
Contact:

Flowcode + MPLAB compile errors

Post by chico »

Hello -

There is something I don't understand about Flowcode. If I try to compile my Flowcode C source in MPLAB, some of the variables that Flowcode generates are too long for the Hi-Tech compiler to handle.

In the code below, the compiler gives "Conflicting Declaration" errors for different variables generated by Flowcode. For example, "//ADC(0): //Macro function declarations" contains:

Code: Select all

void FCD_ADC0_SampleADC();
MX_UINT8 FCD_ADC0_ReadAsByte();
MX_UINT16 FCD_ADC0_ReadAsInt();
MX_FLOAT FCD_ADC0_ReadAsVoltage();
void FCD_ADC0_ReadAsString(MX_CHAR* FCR_RETVAL, MX_UINT8 FCR_RETVAL_SIZE);
void FCD_ADC0_ADC_RAW_Configure_Channel();
MX_UINT8 FCD_ADC0_ADC_RAW_Sample_Channel_Byte();
MX_UINT16 FCD_ADC0_ADC_RAW_Sample_Channel_Int();
MX_UINT8 FCD_ADC0_ADC_RAW_Average_Channel_Byte(MX_UINT8 NumSamples, MX_UINT8 DelayUs);
MX_UINT16 FCD_ADC0_ADC_RAW_Average_Channel_Int(MX_UINT8 NumSamples, MX_UINT8 DelayUs);
void FCD_ADC0_ADC_RAW_Disable_Channel();
…which causes the compiler to generate the following errors:

Code: Select all

Build C:\MPLAB_Projects\Example_V5\Example_FCv5 for device 18F4431
Using driver C:\Program Files\HI-TECH Software\PICC-18\PRO\9.63\bin\picc18.exe

Make: The target "C:\MPLAB_Projects\Example_V5\Example_4431_V5.p1" is out of date.
Executing: "C:\Program Files\HI-TECH Software\PICC-18\PRO\9.63\bin\picc18.exe" --pass1 C:\MPLAB_Projects\Example_V5\Example_4431_V5.c -q --chip=18F4431 -P --runtime=default --opt=default,+asm,-speed,+space,9 --warn=0 -D__DEBUG=1 -g --asmlist "--errformat=Error   [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s" 

Error   [984] C:\MPLAB_Projects\Example_V5\Example_4431_V5.c; 335.44 type redeclared
Error   [1098] C:\MPLAB_Projects\Example_V5\Example_4431_V5.c; 335.44 conflicting declarations for variable "FCD_ADC0_ADC_RAW_Sample_Channel" (C:\MPLAB_Projects\Example_V5\Example_4431_V5.c:334)
Error   [984] C:\MPLAB_Projects\Example_V5\Example_4431_V5.c; 337.81 type redeclared
Error   [1098] C:\MPLAB_Projects\Example_V5\Example_4431_V5.c; 337.81 conflicting declarations for variable "FCD_ADC0_ADC_RAW_Average_Channe" (C:\MPLAB_Projects\Example_V5\Example_4431_V5.c:336)
Error   [984] C:\MPLAB_Projects\Example_V5\Example_4431_V5.c; 557.1 type redeclared
Error   [1098] C:\MPLAB_Projects\Example_V5\Example_4431_V5.c; 557.1 conflicting declarations for variable "FCD_ADC0_ADC_RAW_Sample_Channel" (C:\MPLAB_Projects\Example_V5\Example_4431_V5.c:550)
Error   [1098] C:\MPLAB_Projects\Example_V5\Example_4431_V5.c; 557.1 conflicting declarations for variable "FCD_ADC0_ADC_RAW_Sample_Channel" (C:\MPLAB_Projects\Example_V5\Example_4431_V5.c:557)
Error   [984] C:\MPLAB_Projects\Example_V5\Example_4431_V5.c; 583.1 type redeclared
Error   [1098] C:\MPLAB_Projects\Example_V5\Example_4431_V5.c; 583.1 conflicting declarations for variable "FCD_ADC0_ADC_RAW_Average_Channe" (C:\MPLAB_Projects\Example_V5\Example_4431_V5.c:564)
Error   [1098] C:\MPLAB_Projects\Example_V5\Example_4431_V5.c; 583.1 conflicting declarations for variable "FCD_ADC0_ADC_RAW_Average_Channe" (C:\MPLAB_Projects\Example_V5\Example_4431_V5.c:583)
Warning [359] C:\Program Files\Flowcode\v5\CAL\PIC\PIC_CAL_ADC.c; 1481.18 illegal conversion between pointer types
Warning [359] C:\MPLAB_Projects\Example_V5\Example_4431_V5.c; 1145.40 illegal conversion between pointer types
Warning [359] C:\MPLAB_Projects\Example_V5\Example_4431_V5.c; 1153.47 illegal conversion between pointer types
Warning [359] C:\MPLAB_Projects\Example_V5\Example_4431_V5.c; 1161.47 illegal conversion between pointer types

…..(no more errors, just warnings….)

Since these are generated by Flowcode and not by the user, how can the user get the compiler to recognize them as separate variables?

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

Re: Flowcode + MPLAB compile errors

Post by Benj »

Hello,

It looks like these lines in the C file are to blame.

984
1098
...

Can you post up the C file and hopefully I can help to spot what's going wrong for you.

chico
Posts: 34
Joined: Fri Dec 26, 2008 11:30 pm
Has thanked: 12 times
Been thanked: 10 times
Contact:

Re: Flowcode + MPLAB compile errors

Post by chico »

Benj wrote:Hello,
It looks like these lines in the C file are to blame.
984
1098
...
Can you post up the C file and hopefully I can help to spot what's going wrong for you.
Thanks for the response.

Actually, 984 and 1098 are the compiler error codes. The problem lines are listed at the end of the error messages in the HT compiler. So in this case, the problematic lines are 334, 335, 336, 336,557, and 583. The first three are definitions and the last two are routines:

Code: Select all

334:  MX_UINT8 FCD_ADC0_ADC_RAW_Sample_Channel_Byte();
335:  MX_UINT16 FCD_ADC0_ADC_RAW_Sample_Channel_Int();
336:  MX_UINT8 FCD_ADC0_ADC_RAW_Average_Channel_Byte(MX_UINT8 NumSamples, MX_UINT8 DelayUs);

556:  MX_UINT16 FCD_ADC0_ADC_RAW_Sample_Channel_Int()
557:  {
558:  	
559:		return FC_CAL_Sample_ADC( 1 );	//Perform Sample - Return as MX_UINT16
560:
561:  }

582:  MX_UINT16 FCD_ADC0_ADC_RAW_Average_Channel_Int(MX_UINT8 NumSamples, MX_UINT8 DelayUs)
583:  {
584:  	
585:  		MX_UINT32 average = 0;
586:  		MX_UINT8 count;
587:  
588:  		for (count=0; count<NumSamples; count++)
589:  		{
560:  			average = average + FC_CAL_Sample_ADC( 1 );					//Perform Sample - Return as MX_UINT16 - add to average
561:  
562:  			if (DelayUs)
563:  				delay_us(DelayUs);										//If delay is not 0 then pause between samples
564:  		}
565:  		average = average / count;
566:  
567:  		return (average & 0x1FFF);										//Return average as MX_SINT16
568:  
569:  }
I'm not a compiler genius, but it seems to me that the compiler can't handle the long variable names. I've been examining the compiler manual but can't find the part that says how many characters are allowed for definitions.

Does it make sense to you? I saw another post that seemed to indicate a similar issue:
http://www.matrixmultimedia.com/mmforum ... NT8#p36856

Sorry to bother you but this problem will keep me from using Flowcode....

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Flowcode + MPLAB compile errors

Post by kersing »

Could you try adding -N 50 to the compiler command line? This should increase the number of significant characters in the identifiers from the default 31 characters to 50 characters. (reference)
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

James johnson
Posts: 7
Joined: Sun Jul 15, 2012 3:41 am
Has thanked: 2 times
Contact:

Re: Flowcode + MPLAB compile errors

Post by James johnson »

kersing wrote:Could you try adding -N 50 to the compiler command line? This should increase the number of significant characters in the identifiers from the default 31 characters to 50 characters. (reference)
Ah, thank you for the reference. I hadn't been able to find that info before.

I found the MPLAB "Identifier Length" menu setting under: Project > Build Options > Compiler > (filename.c) > Identifier Length

...and it worked! Errors went away. Thanks for that.

NEXT ERROR (now that the compiler can proceed) is a linker error, "Unknown Record Type" (MX_FLOAT FCV_WATER_TEMP_VOLTAGE;):

Code: Select all

Build C:\MPLAB_Projects\Example_V5\Example_FCv5 for device 18F2620
Using driver C:\Program Files\HI-TECH Software\PICC-18\PRO\9.63\bin\picc18.exe

Make: The target "C:\MPLAB_Projects\Example_V5\Example_2620_V5.p1" is up to date.
Executing: "C:\Program Files\HI-TECH Software\PICC-18\PRO\9.63\bin\picc18.exe" -oExample_FCv5.cof -mExample_FCv5.map --summary=default,-psect,-class,+mem,-hex --output=default,-inhx032 Example_2620_V5.p1 "C:\Program Files\Flowcode\v5\Tools\boostc\Lib\float.pic18.lib" "C:\Program Files\Flowcode\v5\Tools\boostc\Lib\libc.pic18.lib" --chip=18F2620 -P --runtime=default,+clear,+init,-keep,-download,+stackwarn,-config,+clib,-plib --opt=default,+asm,-speed,+space,9 --warn=0 -N75 -D__DEBUG=1 -Blarge --double=24 --cp=16 -g --asmlist "--errformat=Error   [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s" 
HI-TECH C PRO for the PIC18 MCU Family  V9.63PL3
Copyright (C) 1984-2009 HI-TECH SOFTWARE
this licence will expire on Wed, 12 Dec 2029
Advisory[1233] Employing 18F2620 errata work-arounds:
Advisory[1234]  * Corrupted fast interrupt shadow registers
Advisory[1234]  * Data in RAM location can be corrupted if async. reset occurs during write
Error   [380] ; . unknown record type (142)

********** Build failed! **********
From the Hi-Tech C manual:
(380) unknown record type (*) (Linker) This is an internal compiler error. Contact HI-TECH Software technical support with details.

The source error line (142):

Code: Select all

140:  MX_UINT8 FCV_B2;
141:  MX_SINT16 FCV_WATER_TRANSIT_COUNT;
142:  MX_FLOAT FCV_WATER_TEMP_VOLTAGE;
143:  MX_UINT8 FCV_FCR_RETVAL;
144:  MX_CHAR FCV_TRANSFER_CURVE_STATUS[FCSZ_TRANSFER_CURVE_STATUS];
Any thoughts on this error? I'm not sure I understand how Flowcode defines these MX types...

James johnson
Posts: 7
Joined: Sun Jul 15, 2012 3:41 am
Has thanked: 2 times
Contact:

Re: Flowcode + MPLAB compile errors

Post by James johnson »

James johnson wrote: NEXT ERROR (now that the compiler can proceed) is a linker error, "Unknown Record Type" (MX_FLOAT FCV_WATER_TEMP_VOLTAGE;):

From the Hi-Tech C manual:
(380) unknown record type (*) (Linker) This is an internal compiler error. Contact HI-TECH Software technical support with details.

Any thoughts on this error? I'm not sure I understand how Flowcode defines these MX types...
OK, I found the problem with this error. I had neglected to remove the Flowcode libraries necessary for compilation with BoostC. They aren't needed with Hi-Tech C. Doh!

Anyway, now I can compile my file inside of MPLAB with Hi-Tech v9.65 and v9.80 as well as BoostC.

Thanks for the help, everyone.

Post Reply