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 CCS Technical Support

Console output

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



Joined: 05 Aug 2006
Posts: 52

View user's profile Send private message Visit poster's website AIM Address MSN Messenger

Console output
PostPosted: Fri Oct 06, 2006 4:57 am     Reply with quote

Hi,

I primarily use Mac, but have a couple XP/Linux boxes for various development (MCU/FPGA/Embedded Linux) projects.

Since I would like to code and compile in OS X, the simplest way (as I see is) to setup an OpenSSHd running in XP via Cygwin, then SSH in and compile code over sftp.

The thing is, everytime I ran the PCM executable in the console it causes a pop-up window and any debug output goes in the .err file. Is there an easier way to force the compiler to dump output info to the console? (some args of some sort?)

Thanks Smile
Mike
jma_1



Joined: 08 Feb 2005
Posts: 147
Location: Wisconsin

View user's profile Send private message

PostPosted: Fri Oct 06, 2006 6:57 am     Reply with quote

Greetings,

I'm not following your description of the setup running Cygwin (GNU Linux tools for Windows) under Windows XP, but using Linux or OS X? I do not follow.

If you have Linux boxes, buy the Linux version of the compiler and continue to do the developement in Linux. If you have the windows version of the compiler, I would not recommend using an emulator like WINE or anything else. You are asking for problems with this route.

I'm assuming you are using the command line verison of the compiler. One of the options is using the +STDOUT option. I have not used this, but it should allow you to capture and view the errors. On windows a sample command line calling might be
"c:\Program Files\Picc\ccsc.exe" +STDOUT +EA +FH +P3 +DF +Y9 +DC +STDOUT +J -T -Z +LNlst +O8hex Main.c

As an alternative, use your favorite editor/IDE and parse the error file. For examples, you might look at the previous post for seting up the compiler for use with CodeWright (project file -> error file, error parser, etc)

Under Windows, CCS does have some sort of executable which can assist in directing where the output goes. I do not remember the details, but CCS was kind enough to send it to me. I never used the executable and decided to use the Windows version of the compiler instead.

Cheers,
JMA
bsodmike



Joined: 05 Aug 2006
Posts: 52

View user's profile Send private message Visit poster's website AIM Address MSN Messenger

PostPosted: Fri Oct 06, 2006 12:39 pm     Reply with quote

jma,

thanks for the tip(s)! Yea, I'm not too hot on using WINE/VPC etc. Getting the linux version is an alternative too, but as I already have the PCM version, Cygwin allows you to install a sort of emulated *nix on windows and setting up a sshd isn't too much trouble. At least that'll save me $125 and work almost as well as the native linux version, besides my programmer is windows dependent.

+STDOUT, thanks that's exactly what I'm after Smile
bsodmike



Joined: 05 Aug 2006
Posts: 52

View user's profile Send private message Visit poster's website AIM Address MSN Messenger

PostPosted: Sat Oct 07, 2006 4:51 am     Reply with quote

Nope, the +stdout option does not send the err output to the console. Any ideas?

The easiest would be to put the compile string and,

cat main.err

into a bash script. This will work thanks to cygwin Smile
bsodmike



Joined: 05 Aug 2006
Posts: 52

View user's profile Send private message Visit poster's website AIM Address MSN Messenger

PostPosted: Sat Oct 07, 2006 2:09 pm     Reply with quote

\o/

Code:
[01:33:30] core2duo:~/Desktop/test Administrator$ mcuPCM
 
CCS PCM C Compiler, Version 3.249      Sun Oct  8 01:33:31 IST 2006
 
      Memory usage:   ROM=79%      RAM=35% - 74%
      0 Errors,  0 Warnings.
 


I've got it with -EW for the moment. Looking into a way of reading a few lines of the .lst file, might get a c program to do it and output the info just above the memory usage from the err file.

For anyone else that *might* be interested, here's the bash script chmodded to 777,

Code:
#!/bin/bash                                                                   

echo " "
echo -n "CCS PCM C Compiler, Version 3.249      "
date
echo " "

#-EW to remove warnings!                                                     
"/cygdrive/c/Program Files/CCS/Ccsc.exe" +FM +DF +DC +LNlst +T +A +M -Z +J +Y\
9 +EA -EW main.c
cat main.err
echo " "


I've got it in my ~ and that's in my PATH so I can call it from anywhere (and appeares under tab-completion). I also tend to keep my main file as 'main.c' and any other files are included via it.

Smile
bsodmike



Joined: 05 Aug 2006
Posts: 52

View user's profile Send private message Visit poster's website AIM Address MSN Messenger

PostPosted: Sat Oct 07, 2006 8:02 pm     Reply with quote

Slight improvement,

Code:
// reading a text file                                                       
#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main ()
{
  string line;
  int i;
   
  ifstream myfile ("main.lst");
   
  if (myfile.is_open())
    {
      for (i=0;i<10;i++)
        {
          if (! myfile.eof() )
            {
              getline (myfile,line);
              cout << line << endl;
            }
        }
      myfile.close();
    }

  else cout << endl << "Unable to open file main.lst" << endl << endl;

  return 0;
}


And now running the modified script,

Code:
#!/bin/bash
echo " "

#-EW to remove warnings!
"/cygdrive/c/Program Files/CCS/Ccsc.exe" +FM +DF +DC +LNlst +T +A +M -Z +J +Y9 +EA -EW main.c
main
cat main.err
echo " "


results in,

Code:
$ mcuPCM
 
CCS PCM C Compiler, Version 3.249, 34595               08-Oct-06 07:28

               Filename: main.lst

               ROM used: 1439 words (35%)
                         Largest free fragment is 2048
               RAM used: 41 (23%) at main() level
                         71 (41%) worst case
               Stack:    7 worst case (4 in main + 3 for interrupts)

      Memory usage:   ROM=35%      RAM=23% - 41%
      0 Errors,  0 Warnings.
 


I compiled the c program with the output binary as 'main' located in ~/readTXT, which has also been added to my path.
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