Compile problem with HTPICC-18 (works w/ 9.63, not w/ 9.80)

Moderator: Benj

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

Compile problem with HTPICC-18 (works w/ 9.63, not w/ 9.80)

Post by James johnson »

Hi - I've been evaluating Flowcode, and I've run into a situation where my code compiles with Hi-Tech PICC-18 v9.63, but not with v9.80 (the most recent version).

Here's the compiler output:

With v9.63:

Code: Select all

File name:     C:\MPLAB Projects\FLOWCODE\TestFile.c
Title: 
Description: 
Generated by: Flowcode v5.1.0.0
Date: Wednesday, July 11, 2012 13:39:47
Licence: Free version
***FREE/DEMO VERSION***
NOT FOR COMMERCIAL USE
http://www.matrixmultimedia.com
Launching the compiler...

 C:\Program Files\HI-TECH Software\PICC-18\PRO\9.63\bin\picc18.exe --CHIP= 18F2220 -N48 TestFile.c
 HI-TECH C PRO for the PIC18 MCU Family  V9.63PL3
 Copyright (C) 1984-2009 HI-TECH SOFTWARE
  
 (multiple warnings removed)
  

  
 Memory Summary:
     Program space        used  275Eh ( 10078) of 10000h bytes   ( 15.4%)
     Data space           used    94h (   148) of   F80h bytes   (  3.7%)
     EEPROM space         used     0h (     0) of   400h bytes   (  0.0%)
     ID Location space    used     0h (     0) of     8h nibbles (  0.0%)
     Configuration bits   used     0h (     0) of     7h words   (  0.0%)
  
 Return code = 0
 Launching the linker/assembler...
 C:\Program Files\Flowcode\v5\Tools\DoNothing\DoNothing.exe 
 Return code = 0
  
 FINISHED
 

With v9.80:

Code: Select all

File name:     C:\MPLAB Projects\FLOWCODE\TestFile.c
Title: 
Description: 
Generated by: Flowcode v5.1.0.0
Date: Wednesday, July 11, 2012 13:39:47
Licence: Free version
***FREE/DEMO VERSION***
NOT FOR COMMERCIAL USE
http://www.matrixmultimedia.com
Launching the compiler...

 C:\Program Files\HI-TECH Software\PICC-18\9.80\bin\picc18.exe --CHIP= 18F2220 -N48 TestFile.c
 TestFile.c:
 TestFile.c: FCD_LCDDisplay0_RawSend()
    618:        portc &= ~(1 << 0);
 ^ (192) undefined identifier "portc"
    622:        porta &= ~(1 << 2);
 ^ (192) undefined identifier "porta"
 TestFile.c: FCD_LCDDisplay0_Start()
    668:        {trisc &= ~(1 << 0); portc &= ~(1 << 0);};
 ^ (192) undefined identifier "trisc"
                     ^ (192) undefined identifier "portc"
    669:        {trisc &= ~(1 << 1); portc &= ~(1 << 1);};
 ^ (192) undefined identifier "trisc"
                     ^ (192) undefined identifier "portc"
    670:        {trisc &= ~(1 << 2); portc &= ~(1 << 2);};
 ^ (192) undefined identifier "trisc"
                     ^ (192) undefined identifier "portc"
    671:        {trisc &= ~(1 << 3); portc &= ~(1 << 3);};
 ^ (192) undefined identifier "trisc"
                     ^ (192) undefined identifier "portc"
    672:        {trisa &= ~(1 << 2); porta &= ~(1 << 2);};
 ^ (192) undefined identifier "trisa"
                     ^ (192) undefined identifier "porta"
    673:        {trisa &= ~(1 << 5); porta &= ~(1 << 5);};
 ^ (192) undefined identifier "trisa"
                     ^ (192) undefined identifier "porta"
 C:\Program Files\Flowcode\v5\CAL\PIC\PIC_CAL_ADC.c: FC_CAL_Enable_ADC()
   1474:        adcon2 = Conv_Speed & 0x07;
 ^ (192) undefined identifier "adcon2"
   1481:        tris_reg = &trisa;
             ^ (192) undefined identifier "trisa"
                 ^ (359) illegal conversion between pointer types (warning)
 pointer to int -> pointer to unsigned char
   1482:        adcon1 = 0x0E;
 ^ (192) undefined identifier "adcon1"
   1572:        adcon0 = (0x01 | (Channel << 2));
 ^ (192) undefined identifier "adcon0"
 C:\Program Files\Flowcode\v5\CAL\PIC\PIC_CAL_ADC.c: FC_CAL_Sample_ADC()
   1584:        adcon0 = adcon0 | 0x02;
 ^ (192) undefined identifier "adcon0"
   1592:        iRetVal = (adresh << 2);
           ^ (192) undefined identifier "adresh"
   1593:        iRetVal = iRetVal | (adresl >> 6);
                     ^ (192) undefined identifier "adresl"
 C:\Program Files\Flowcode\v5\CAL\PIC\PIC_CAL_ADC.c: 1593: too many errors (21)
 HI-TECH C Compiler for PIC18 MCUs (PRO Mode)  V9.80
 
 I've tried examining the various include files called by the assembler but I'm not experienced enough to fully understand what's happening. Anybody have any ideas why this will compile in 9.63 but not in 9.80?

Thanks... James

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: Compile problem with HTPICC-18 (works w/ 9.63, not w/ 9.

Post by Benj »

Hi James,

I'm guessing your are using a device that is not supported in v9.63? For the HiTech compiler we use a file to convert all the lowercase definitions from BoostC to upper case definitions to be used in HiTech.

You should be able to fix the problem by using the Project options -> Supplementary Code and inserting the following code into the top pane of the supp code window.

Code: Select all

#define porta PORTA
#define portc PORTC
#define trisa TRISA
#define trisc TRISC
#define adcon0 ADCON0
#define adcon1 ADCON1
#define adcon2 ADCON2
#define adresh ADRESH
#define adresl ADRESL
You will also need to define any other registers that cause compilation errors.

If you let me know what device you are using then I will try and generate a new version of the HiTech definition file so this is no longer an issue.

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

Re: Compile problem with HTPICC-18 (works w/ 9.63, not w/ 9.

Post by James johnson »

Benj wrote:Hi James,
I'm guessing your are using a device that is not supported in v9.63? For the HiTech compiler we use a file to convert all the lowercase definitions from BoostC to upper case definitions to be used in HiTech.
I've tried with the 18F4431 and 18F2220, as they are supported by the free edition. Both compile ok in v9.63 but not v9.80. Both give the same error messages.

Can you tell me which file contains the lowercase --> uppercase conversions, and how the main source code includes that file? Perhaps I've got a missing or corrupted file or path in v9.80.
Benj wrote:You should be able to fix the problem by using the Project options -> Supplementary Code and inserting the following code into the top pane of the supp code window.

Code: Select all

#define porta PORTA
#define portc PORTC
#define trisa TRISA
#define trisc TRISC
#define adcon0 ADCON0
#define adcon1 ADCON1
#define adcon2 ADCON2
#define adresh ADRESH
#define adresl ADRESL
You will also need to define any other registers that cause compilation errors.
Brilliant. Makes sense. I'll give it a try as a workaround.
Benj wrote:If you let me know what device you are using then I will try and generate a new version of the HiTech definition file so this is no longer an issue.
As I said, I tried with the 18F4431 and 18F2220. I then sent the Flowcode file to a colleague who owns Flowcode v5 and asked him to try it with an 18F2620 (which is my eventual target device). He came up with the same errors using v9.80.

I looked in the FCD file "definitions.h" but couldn't see these chips listed. Is that the file you are referring to?

ps. FYI, here's the compiler output from my colleague's attempt to compile for an 18F2620:

Code: Select all

Launching the compiler...
C:\Program Files\HI-TECH Software\PICC-18\9.80\bin\picc18.exe --CHIP=18F2620 -N48 Hot_2620_V5.c
Hot_2620_V5.c:
  3900:		#warning "This interrupt has previously been enabled, so the macro <TMR0_INT> may never get called."
	                                                                                                           ^ (162) #warning: "This interrupt has previously been enabled, so the macro <TMR0_INT> may never get called." (warning)
  3919:		#warning "This interrupt has previously been enabled, so the macro <TMR0_INT> may never get called."
	                                                                                                           ^ (162) #warning: "This interrupt has previously been enabled, so the macro <TMR0_INT> may never get called." (warning)
  3938:		#warning "This interrupt has previously been enabled, so the macro <TMR0_INT> may never get called."
	                                                                                                           ^ (162) #warning: "This interrupt has previously been enabled, so the macro <TMR0_INT> may never get called." (warning)
Hot_2620_V5.c: FCD_LCDDisplay0_RawSend()
   534:	portc &= ~(1 << 0);
	^ (192) undefined identifier "portc"
   538:	porta &= ~(1 << 2);
	^ (192) undefined identifier "porta"
Hot_2620_V5.c: FCD_LCDDisplay0_Start()
   584:	{trisc &= ~(1 << 0); portc &= ~(1 << 0);};
	 ^ (192) undefined identifier "trisc"
	                     ^ (192) undefined identifier "portc"
   585:	{trisc &= ~(1 << 1); portc &= ~(1 << 1);};
	 ^ (192) undefined identifier "trisc"
	                     ^ (192) undefined identifier "portc"
   586:	{trisc &= ~(1 << 2); portc &= ~(1 << 2);};
	 ^ (192) undefined identifier "trisc"
	                     ^ (192) undefined identifier "portc"
   587:	{trisc &= ~(1 << 3); portc &= ~(1 << 3);};
	 ^ (192) undefined identifier "trisc"
	                     ^ (192) undefined identifier "portc"
   588:	{trisa &= ~(1 << 2); porta &= ~(1 << 2);};
	 ^ (192) undefined identifier "trisa"
	                     ^ (192) undefined identifier "porta"
   589:	{trisa &= ~(1 << 5); porta &= ~(1 << 5);};
	 ^ (192) undefined identifier "trisa"
	                     ^ (192) undefined identifier "porta"
C:\Program Files\Flowcode\v5\CAL\PIC\PIC_CAL_ADC.c: FC_CAL_Enable_ADC()
  1474:	adcon2 = Conv_Speed & 0x07;
	^ (192) undefined identifier "adcon2"
  1481:	tris_reg = &trisa;
	            ^ (192) undefined identifier "trisa"
	                 ^ (359) illegal conversion between pointer types (warning)
pointer to int -> pointer to unsigned char
  1482:	adcon1 = 0x0E;
	^ (192) undefined identifier "adcon1"
  1572:	adcon0 = (0x01 | (Channel << 2));
	^ (192) undefined identifier "adcon0"
C:\Program Files\Flowcode\v5\CAL\PIC\PIC_CAL_ADC.c: FC_CAL_Sample_ADC()
  1584:	adcon0 = adcon0 | 0x02;
	^ (192) undefined identifier "adcon0"
  1592:	iRetVal = (adresh << 2);
	           ^ (192) undefined identifier "adresh"
  1593:	iRetVal = iRetVal | (adresl >> 6);
	                     ^ (192) undefined identifier "adresl"
C:\Program Files\Flowcode\v5\CAL\PIC\PIC_CAL_ADC.c: 1593: too many errors (21)
HI-TECH C Compiler for PIC18 MCUs (PRO Mode)  V9.80
Copyright (C) 2011 Microchip Technology Inc.
Serial number: HCPIC18P-654321 (PRO)
Employing 18F2620 errata work-arounds:
 * Corrupted fast interrupt shadow registers
 * Data in RAM location can be corrupted if async. reset occurs during write
(908) exit status = 1
Return code = 1
Flowcode was unable to compile the flowchart's C code due to the following errors:


If your flowchart contains C code, please review this carefully. If your flowchart contains no C-code or you have thoroughly reviewed the code, contact Technical Support.


FINISHED

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

Re: Compile problem with HTPICC-18 (works w/ 9.63, not w/ 9.

Post by James johnson »

Hello Benj - Just to let you know, when I put the register case conversion code into supplemental code box as you suggested, the project compiles under 9.80.

So apparently the compiler is not correctly accessing the definitions file you mentioned, or that file has a problem associated with it.

I'm sure you're better at this than I am, but I can try to track this problem down if you can give me some direction.

Thanks.... James

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: Compile problem with HTPICC-18 (works w/ 9.63, not w/ 9.

Post by Benj »

Hello James,

Yes the file your after is the "definitions.h" file in the FCD folder.

I think this is listed by family but I could be wrong. The problem may be that the device is listed differently then it was in a previous version and there fore the definitions are not being loaded into the compile correctly. I basically pop all the HiTech definition files in a folder and then use a PHP script to generate the definitions.h file. I will download the latest HiTech compiler and see if I can regenerate the definitions file so it will work correctly.

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

Re: Compile problem with HTPICC-18 (works w/ 9.63, not w/ 9.

Post by James johnson »

Benj wrote:Hello James,

Yes the file your after is the "definitions.h" file in the FCD folder.

I think this is listed by family but I could be wrong. The problem may be that the device is listed differently then it was in a previous version and there fore the definitions are not being loaded into the compile correctly. I basically pop all the HiTech definition files in a folder and then use a PHP script to generate the definitions.h file. I will download the latest HiTech compiler and see if I can regenerate the definitions file so it will work correctly.
Thanks so much. I'll look forward to your updated "definitions.h" file, but in the meantime I'll play around and see if I can hack it to make it work.

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: Compile problem with HTPICC-18 (works w/ 9.63, not w/ 9.

Post by Benj »

Hello,

Here is an updated definitions file you can try.
definitions.h
(3.01 MiB) Downloaded 508 times
Let me know how you get on.

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

Re: Compile problem with HTPICC-18 (works w/ 9.63, not w/ 9.

Post by James johnson »

Benj wrote:Hello,

Here is an updated definitions file you can try.
Let me know how you get on.
Thanks, Benj. I'm happy to say that worked fine with the processors I was able to test. Nice work.

Post Reply