View previous topic :: View next topic |
Author |
Message |
kjohara
Joined: 06 Jan 2004 Posts: 2
|
Linux or Windows? |
Posted: Tue Jan 06, 2004 2:39 pm |
|
|
I am looking for a C compiler for the pic16f87. I'd rather use Linux, but if the Windows version is much better I will go with that. Can anyone share their experience? Thanks. |
|
|
Doug Guest
|
|
Posted: Tue Jan 06, 2004 3:11 pm |
|
|
I can't comment on any experiences with the compiler for Linux because I bought the one for Windows. I can say that the PCM compiler for Windows will integrate with the Microchip MPLAB (which is compatible with all of their programmers and emulators) and therefore provide a complete IDE for developement. The compiler will also work from the command line in both versions.
On the other hand if you are comfortable with programming in Linux, it may be possible to configure one of the available IDE's to use the PCM compiler for its output. Just make sure you have a way to program the chip from Linux.
Someone who has the Linux version could be more helpful I guess. |
|
|
Darren Rook
Joined: 06 Sep 2003 Posts: 287 Location: Milwaukee, WI
|
|
Posted: Tue Jan 06, 2004 3:54 pm |
|
|
Get the Windows one...
You can use WINE to use the Windoze one in Linux. |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Jan 06, 2004 7:23 pm |
|
|
It doesn't really matter wether the compiler is in Linux or Windows. What you should be concerned with is how well the compiler works in general. I would go with Windows due to the amount of tools out there. |
|
|
kjohara
Joined: 06 Jan 2004 Posts: 2
|
|
Posted: Wed Jan 07, 2004 12:37 pm |
|
|
Thanks for the advice. We will probably go with the Windows one since it is older and probably more mature, we we can integrate the compiler into the MPLAB IDE, and we can run it via wine if we want to compile things from Linux. Thanks again. |
|
|
picgrammer Guest
|
|
Posted: Wed Jan 07, 2004 3:43 pm |
|
|
Hello
Quote: | You can use WINE to use the Windoze one in Linux. |
Can you tell me if there are any special things you have to do, to get it to work with wine? Did you ned special dlls?
I have pcm 2.734 an it does absoluetly not work with wine (picchips does sometimes)
Many thanks
Felix |
|
|
Jan Capek Guest
|
windoze compiler in linux w/ wine |
Posted: Wed Jan 07, 2004 5:12 pm |
|
|
Hi,
I use the windows compiler in linux, however my version is 3.176 (as of PCM). Can you tell more how the wine acts when you run the compiler? First general problem is that the compiler command line is not something linux really likes, so I made a little wrapper script, that converts some basic GCC like options (like -I -D) to something the linux compiler understands and invokes it via wine. Beneath is code snippet. I also have a special option to which compiler to run (PCH/PCM) and separate handling for their options as the that I use had different command line options. Here it is:
<pre>
#!/usr/bin/perl
#####################################################################
# ccsc.pl #
# #
# Description: Linux Perl wrapper script that launches the correct #
# CCSC compiler - windows version, using 'wine'. #
# It also provides standard switches as gcc and #
# gcc-like behavior #
# #
# #
# Synopsis:ccsc.pl [-I dir] [-D name[=definition] [-b machine] file #
# #
# #
# Author: Jan Capek #
# Created: 07/31/2003 #
# #
#####################################################################
# (C) Copyright 2003 Custom Computer Services #
#####################################################################
use vars qw/ %opt /;
$DEBUG = 0;
# Path to the compilers location
$COMPILER_PATH = '/home/ccs/ccs-software';
$PIC16_C_PATH = $COMPILER_PATH.'/picc-3-122';
$PIC18_C_PATH = $COMPILER_PATH.'/picc-3-160';
# Change this to use different compiler
$PIC16_C = $PIC16_C_PATH.'/Ccsc.exe +FM +STDOUT';
$PIC18_C = $PIC18_C_PATH.'/Ccsc.exe +FH +STDOUT';
# Supported target machine types
$PIC16_MACHINE = 'PIC16';
$PIC18_MACHINE = 'PIC18';
# include directive value for the compiler
my $Idir;
# preprocessor flags storage
my $CPPflags;
# compiler chosen by the user
my $Compiler;
sub init()
{
# storage for the parsed options
my @includedirs = (''); # stores all include paths separated by white spaces
my @macros; # all macro defitions
my $machine = $PIC16_MACHINE; # default machine type is PIC16
my $help;
# use bundling (off by default) of parameters
use Getopt::Long qw(:config bundling);
$result = GetOptions ("I=s" => \@includedirs,
"D=s" =>\@macros,
"b=s" => \$machine,
"h" => \$help);
usage() if $help;
# PIC16 compiler settings
if($machine eq $PIC16_MACHINE)
{
$Compiler = $PIC16_C;
$Idir = '+I'; # include directive
$DefPath = $PIC16_C_PATH.'/Devices';
}
# PIC18 compiler settings
elsif($machine eq $PIC18_MACHINE)
{
$Compiler = $PIC18_C;
$Idir = 'I='; # include directive
$DefPath = $PIC18_C_PATH.'/Devices';
}
# setup include directives for CCSC compiler
$Idir .= '"'.join(';',@includedirs);
# append semicolon if the non-empty include directives have been specified
$Idir .= ';'.$DefPath.'"';
# get rid of the leading semicolon
$Idir =~ s/;//;
# switch to slashes to backslashes in the include paths (windows stuff..)
$Idir =~ s/\//\\/g;
print "Include directive: $Idir \n" if $DEBUG;
# parse the macro definition and add the default values (=1)
for ($i = 0; $i < @macros; $i++)
{
($name, $def) = split('=', $macros[$i]);
$macros[$i] = $name.'=1' if(!$def); # set a default value for the macro
# since our compiler requires that
}
# prepare the preprocessor flags
$CPPflags = join(' \#', @macros);
$CPPflags = '\#'.$CPPflags if ($CPPflags);
print "CPP flags: $CPPflags\n" if $DEBUG;
}
# Initialize the compiler settings
init();
if($ARGV[0])
{
# print "wine $Compiler $Idir $CPPflags $ARGV[0]\n";
`wine $Compiler $Idir $CPPflags $ARGV[0]`;
# get the error file name
my $ErrFile = $ARGV[0];
$ErrFile =~ s/\..*/\.err/;
# error flag initially set
my $NoErrFlag = 0;
open(ERRFILE,"<$ErrFile")
|| die "$0: $ARGV[0]: No such file\n";
# parse the error file
while(<ERRFILE>)
{
next if($_ =~ /^\s*$/); # skip empty lines
# check if there were no errors
if($_ =~ /.*No Errors.*/)
{
$NoErrFlag = 1;
next;
}
print STDERR;
}
close(ERRFILE);
# generate an error code when an error occured
die "\n" if $NoErrFlag != 1;
}
else
{
die "$0: No input file\n";
}
sub usage()
{
print STDERR <<HELP;
CCS-C - compiler wrapper for Linux
Usage: $0 [-I dir] [-D name[=definition] [-b machine] file
Options:
-I dir
Add the directory 'dir' to the list of directories to be searched for header files.
-D name
Predefine name as a macro, with definition 1.
-D name=definition
Predefine name as a macro, with definition 'definition'.
-b machine
The argument 'machine' specifies the target machine for compilation.
Supported machines: $PIC16_MACHINE, $PIC18_MACHINE
-h
this (help) message
HELP
exit;
}
</pre> |
|
|
picgrammer Guest
|
|
Posted: Thu Jan 08, 2004 8:39 am |
|
|
Hello
Command lines and resulting wine error messages:
>wine pcm.exe
This seems to be a very old (pre-3.0) Windows executable. Expect crashes, especially if this is a real-mode binary !
Could not load 'RTM.DLL' required by 'PC', error=2
If I put a rtm.dll (fopund in www) in the same directory as pcm:
>wine pcm.exe
This seems to be a very old (pre-3.0) Windows executable. Expect crashes, especially if this is a real-mode binary !
Could not load 'RTM.DLL' required by 'PC', error=21
If I want to use pcm without IDE (with -C) the errors ar the same.
Many thanks
Felix |
|
|
Darren Rook
Joined: 06 Sep 2003 Posts: 287 Location: Milwaukee, WI
|
|
Posted: Thu Jan 08, 2004 8:55 am |
|
|
Don't use PCM.EXE. PCM.EXE was an old Borland style DOS IDE. It hasn't been supported in a long time.
Use CCSC.EXE, which is the command line compiler. |
|
|
picgrammer Guest
|
|
Posted: Thu Jan 08, 2004 9:13 am |
|
|
Hello
Quote: |
Don't use PCM.EXE. PCM.EXE was an old Borland style DOS IDE. It hasn't been supported in a long time.
Use CCSC.EXE, which is the command line compiler.
|
Look at this!
With ccsc.exe it does work very nice!
I used pcm.exe also on Windows systems because my manual say that's the way you should invoke the DOS compiler (ok it isn't the newest manual)
Many thanks!
mfg
Felix |
|
|
|