CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Strange behavior in MPLAB IDE compiling

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
apcaye



Joined: 22 May 2009
Posts: 29
Location: Brazil

View user's profile Send private message

Strange behavior in MPLAB IDE compiling
PostPosted: Fri May 22, 2009 3:46 pm     Reply with quote

Hi,

I'm using CCSC compiler version 3.223 with MPLAB IDE version 8.30. The CCS Plug-in version installed in my PC is 2.0.0.7 and my operating system is Windows 2000 SP4. I have already built successfully many projects using this compiler inside MPLAB, but it's a little bit strange in these last days. What happens is that I cannot simulate the code that is compiled. I use MPLAB SIM as debugger and MPLAB ICD2 as the programmer. CCSC seems to compile the project successfully, but in the Output window I cannot see any compiler message. The only message that appears in the Output window (Build tab) is this one:

Executing: "C:\Arquivos de programas\PICC\Ccsc.exe" +FM "Principal.c" +DF +LN +T -A +M +Z +Y=9 +EA

It's not a problem specific to one project, because I tried to compile other projects that had been built successfully and it happened the same thing. My projects are multi-file, but in the Project window I added only the main source file in the "Source Files" section. The hex file is generated, but the simulator does not start after compilation and, as I said, I cannot see any status messages from the CCSC compiler in the Output window's Build tab.

After I compile the project, the "Make" and "Build All" items on the Project menu become disabled. And when I close MPLAB program, it still appears as an active process on the Windows' Task Manager. I have then to manually finish the MPLAB process to execute MPLAB again. This did not use to happen a few days ago.

I have made an upgrade in MPLAB, because I used to use version 8.10. I have also upgraded the CCS Plug-In to the version mentioned above. I have uninstalled and reinstalled CCSC compiler, but I have got no changes at all. Do you have an idea on what could be happening in my PC?

Thanks for your attention and best regards,
Adriano.
apcaye



Joined: 22 May 2009
Posts: 29
Location: Brazil

View user's profile Send private message

PostPosted: Mon May 25, 2009 9:17 am     Reply with quote

Hi again,

with respect to my compiling problems inside MPLAB: today I have tried to compile my project again, and a different message appeared in the Output window's Build tab, which can clarify the problem. There it is below:

Executing: "C:\Arquivos de programas\PICC\Ccsc.exe" +FM "Principal.c" I+="C:\Arquivos de programas\PICC\Devices" +DF +LN -T -A -M -Z +Y=9 +EA
>>> Warning 203 "C:\Trabalho\PIC Transceptor\Branches\DoisLoops\Firmware\BootRom.c" Line 72(1,1): Condition always TRUE
>>> Warning 203 "C:\Trabalho\PIC Transceptor\Branches\DoisLoops\Firmware\Interrupts.c" Line 101(1,1): Condition always TRUE
>>> Warning 203 "C:\Trabalho\PIC Transceptor\Branches\DoisLoops\Firmware\Interrupts.c" Line 111(1,1): Condition always TRUE
>>> Warning 203 "C:\Trabalho\PIC Transceptor\Branches\DoisLoops\Firmware\Interrupts.c" Line 128(1,1): Condition always TRUE
>>> Warning 203 "C:\Trabalho\PIC Transceptor\Branches\DoisLoops\Firmware\Principal.c" Line 77(1,1): Condition always TRUE
--- Info 300 "C:\Trabalho\PIC Transceptor\Branches\DoisLoops\Firmware\Principal.c" Line 197(0,1): More info: Unable to write to Principal.PJT
*** Error 44 "C:\Trabalho\PIC Transceptor\Branches\DoisLoops\Firmware\Principal.c" Line 197(0,1): Internal Error - Contact CCS OUTPUT FILE P
Halting build on first failure as requested.
BUILD FAILED: Mon May 25 11:27:00 2009

I tried to recompile the project again after this message, but then the same symptons appeared: no more compile status messages and the "Make" item disabled at the Project menu. Actually this message has already appeared to me many times before, but then I used to recompile the project and it used to work succesfully, now not any more. Do you please have any suggestions?

Thanks and best regards,
Adriano Caye.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon May 25, 2009 12:50 pm     Reply with quote

Quote:

I have already built successfully many projects using this compiler inside
MPLAB, but it's a little bit strange in these last days.

Transceptor\Branches\DoisLoops\Firmware\BootRom.c

Unable to write to Principal.PJT

Internal Error - Contact CCS

The compiler may be partially crashing because of something in your
code that it can't handle. I notice you have a "Bootrom.c" file.
Are you using #org statements ? That might be the problem.

I suggest that you compile a simple file, to prove if the compiler
can compile it. Example:
Code:
#include <18F452.h>
#fuses XT,NOWDT,PUT,BROWNOUT,NOLVP
#use delay(clock=4000000)

//==============================
void main(void)
{

while(1);
}

If that works, then the compiler installation is basically working.
The reason for the Internal Error is something in your code.
(Because you have already re-installed everything, so presumably
the installation is OK).

Find the problem in your program by commenting large blocks of code.
Comment out entire #include files (and any calls functions in them).
Eventually you will stop getting the Internal Error. By a process of
commenting out, and then uncommenting smaller blocks, you will
find the line of code that is causing the problem.
apcaye



Joined: 22 May 2009
Posts: 29
Location: Brazil

View user's profile Send private message

PostPosted: Mon May 25, 2009 2:17 pm     Reply with quote

Thanks, PCM programmer. I have tried to compile the simple piece of code you provided. I created a project from the MPLAB's Project Wizard. Unfortunately it happened the same: the code is compiled, the hex file is generated, but no status messages appear. This is the only line of information that is showed at the Build Tab:

Executing: "C:\Arquivos de programas\PICC\Ccsc.exe" +FH "TesteSimples.c" +DF +LN +T +A +M +Z +Y=9 +EA

Yes, I use an #ORG statement in my code, but only in the file "Interrupts.c". In this file, I define an interrupt function that serves all the peripherals that I use in my application, in my case RB0/INT pin and timer 1. The beginning of the file is as below:

Code:

   #ORG 0x0004, 0x0090   

   void IntFunction(void)                        
   {
      (...)
   }


My device is PIC16F628A. As you know, 0x0004 is the interruptor vector address. I declare my interrupt function like this because then I can serve the interrupt requests faster. I can try to comment out my code, as you suggested, but I'm afraid it's not going to work, because of the test I made with your suggested code.

Regards,
Adriano.
Ttelmah
Guest







PostPosted: Mon May 25, 2009 2:36 pm     Reply with quote

The CCS 'way' to declare your int function, is:
Code:

#int_global
void IntFunction(void)                       
   {
      (...)
   }


This will automatically be put at address 4, for you, and the compiler will add no handling itself, leaving you to do it all.

Have you tried a full re-install of the compiler?. Just occasionally, some of the internal files can get corrupted, leading to odd behaviours of various sorts.

Best Wishes
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue May 26, 2009 1:28 pm     Reply with quote

I installed MPLAB vs. 8.30 on a Win2000 SP4 system. I then installed
the PCM compiler vs. 3.223. I then installed the MPLAB plugin, vs.
2.0.0.7 from the CCS website, and compiled the test program shown
below. It works. Here are the build results from the output window:
Quote:
Executing: "C:\Program files\Picc\CCSC.exe" +FM "pcm_test.c" +DF +LN +T +A +M -Z +Y=9 +EA -EW
Memory usage: ROM=1% RAM=3% - 3%
Loaded C:\Program Files\PICC\Projects\PCM_Test\pcm_test.cof.
BUILD SUCCEEDED: Tue May 26 12:08:17 2009


Here's the test program.
Code:
#include <16F628A.H>
#fuses XT,NOWDT,PUT,BROWNOUT,NOLVP
#use delay(clock=4000000)

//=========================
void main()
{

while(1);
}
apcaye



Joined: 22 May 2009
Posts: 29
Location: Brazil

View user's profile Send private message

PostPosted: Wed May 27, 2009 9:08 am     Reply with quote

Thanks Ttelmah, I didn't know the #int_global directive. I call some functions inside my interrupt routine, what caused compiler errors. So, by now, I kept the #org directive in my code.

I have done as you suggested, I uninstalled and reinstalled CCS compiler, but nothing has changed, unfortunately. But there is one more thing that I haven't told you: I used to have the CCS compiler version 3.249 installed together with version 3.223, although I used only the latter. Now I have uninstalled version 3.249 and also the old CCS plug-in, but the problem after compiling is still there.

Thanks a lot PCM programmer for doing this test. Good to know that it has worked, but there is still something in my computer that prevents the compiler from working perfectly. Do you please have any more suggestions?

Regards,
Adriano.
Ttelmah
Guest







PostPosted: Wed May 27, 2009 9:20 am     Reply with quote

Whoa.

I'd guess the compiler error, was something like 'Interrupt disabled to prevent re-entrancy'?. If so, you _must_ use the int_global route. The PIC _hardware_, does not support 're-entrancy'. This is where code is called inside itself. Supporting this, requires a hardware variable stack, so that the same code called twice, uses variables stored in different locations inside the stack. Because there is no support for this, you must _never_ call a routine inside an interrupt, that is already executing outside.

Now, the compiler automatically 'sees' this potential disaster, when it knows a routine is the interrupt handler, and avoids the crashes this _will_ otherwise cause, by disabling interrupts around the external copies, and giving the warning. By using the #ORG, the compiler does not know that this is your interrupt handler. No error message, but potentially code that _will_ corrupt variables.

If you want to avoid the message, you need to have two copies of routines that are used inside/outside the interrupt, or avoid the problem yourself, by redesigning the code so that routines are only called from either inside, or outside.

The compiler is telling you that your code has a potentially dangerous fault. Don't 'bodge round' the warning, fix the problem.....

Best Wishes
apcaye



Joined: 22 May 2009
Posts: 29
Location: Brazil

View user's profile Send private message

PostPosted: Wed May 27, 2009 1:14 pm     Reply with quote

Thanks, Ttelmah. I recognize that calling a function from inside an interrupt routine is not good programming practice, but this same routine has already worked for me in another project. Inside the interrupt routine I call functions to read and write a byte to the EEPROM, but I clear the GIE bit then. The error message that is shown is this one:

*** Error 134 "C:\Trabalho\PIC Transceptor\Branches\DoisLoops\Firmware\Principal.c" Line 197(0,1): Unprotected call in a #INT_GLOBAL

I can avoid calling these functions inside the interrupt routine, but I think this is not going to solve the compiling/simulating problem. I have already tried to compile a simple single-file project, without interrupts, only an endless loop, and the same problem occurred.

Regards,
Adriano.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed May 27, 2009 3:19 pm     Reply with quote

To me, it sounds like you have pieces of various compilers on your PC.
You may have a local copy of the 16F628A.H file in your project directory,
instead of using the current one for the installed compiler. This is a good
way to get "out of phase" between versions. There is no guarantee by
CCS that you can mix the .H files between versions. They change how
the functions work from time to time (internally), and they change the
constants in the .H files to reflect this. So, get rid of any local copies
of the 16F628A.h file that you may have in your project directory.

Also, I don't know how you could have two versions of the command
line compiler operating on the same PC. I've never been able to make
that work. Ttelmah uses the PCWH IDE compiler. With the IDE version,
you can easily have two or more versions on the same PC.
Not so with the command line version and MPLAB. There was a big
discussion in the past on this issue. Mark came up with a method to
edit the Windows registry to allow this. I hope you didn't do that,
because it's not worth it.

My advice is to clean up your system, and make sure only one version
is installed, and that no "pieces" of older versions are floating around.
apcaye



Joined: 22 May 2009
Posts: 29
Location: Brazil

View user's profile Send private message

PostPosted: Fri May 29, 2009 2:46 pm     Reply with quote

Thanks, PCM programmer. I have checked that I don't have the PIC16F628A.h file in my project directory. The only place where it is located is the path C:\Program Files\PICC\Devices.

I have installed each version of CCS compiler in different directories. When I created a project in MPLAB IDE, I could then choose the directory of the version 3.223 or of the version 3.249. But I have to admit that I have never compiled a project successfully with version 3.249, I always used version 3.223. No, I have not edited the Windows registry, I don't like to handle with it.

I have made as you suggested. I have run CCleaner program (www.ccleaner.com) to clean my system registry and then uninstalled CCS compiler, MPLAB IDE and the CCS Plug-In. After that I reinstalled these programs, but unfortunately the problem still persists. I have another registry cleaning program, called MV RegClean, but I was told the CCleaner is better (recommended by Google). I have cleaned my system registry using this program as well. I'm getting out of resources, if you have another idea, please let me know.

Best regards,
Adriano.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri May 29, 2009 3:16 pm     Reply with quote

You said that you changed from MPLAB vs. 8.10 to 8.30.

Try making a completely new project, in a new, empty directory.
Don't make a new project in an existing project directory, that
still has .MCW, .MCP, etc., files in it. Use the MPLAB wizard.

I have seen cases where new versions of MPLAB don't work
correctly with old project files.
apcaye



Joined: 22 May 2009
Posts: 29
Location: Brazil

View user's profile Send private message

PostPosted: Mon Jun 01, 2009 8:53 am     Reply with quote

I tried that, PCM programmer, thank you very much. I built a new project in a new directory, using the Project Wizard. This time I have good news: I could finally compile my project successfully and simulate it afterwards. But if I try to compile my project again, the problem still happens.

I found out that if I close MPLAB, kill the MPLAB process in Windows' Task Manager, delete all the project output files (.COF, .PJT, .ERR, .HEX, .LST, .STA, .SYM, .TRE and .$$$) and reopen my project again in MPLAB, I'm able to compile and simulate my code with no problems. It's not the perfect solution, but at least I can continue my work this way.

Thanks again and best regards,
Adriano.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group