gnupic: Thread: Switching processor for gpsim


[<<] [<] Page 1 of 1 [>] [>>]
Subject: Switching processor for gpsim
From: "Matt Marsh" ####@####.####
Date: 21 Apr 2004 08:40:49 +0100
Message-Id: <51515.32.112.128.18.1082533217.squirrel@mail.home.mattmarsh.net>

Hi,

I'm pretty new to PIC programming and right now I'm just
starting to use gpsim.

One thing that I noticed straight away was that my first
PIC program couldn't be run in gpsim because it was written
for the P16F84A which isn't supported. The P16F84 is
supported though so it was easy enough to change the two
lines at the top of my assembly source to:

        list    P=16F84
        include "p16f84.inc"

What I'd really like to do is to have some way of automating
this, so that I can build my project either for simulation,
or for a real chip, and have it set those two lines as
appropriate. So what I'd really like is two make targets, say
"projname.hex" and "projname-sim.hex" where those two lines
are set appropriately. Can anyone think of a way of doing this?

Thanks,
Matt

-- 
Matt N. Marsh
Email: ####@####.####          Yahoo: marshmn
  Web: http://www.mattmarsh.net/  Jabber: ####@####.####
                                     MSN: ####@####.####
                                     ICQ: 250467363
                                     AIM: MattMarshUK



Subject: Re: Switching processor for gpsim
From: "Matt Marsh" ####@####.####
Date: 21 Apr 2004 09:02:32 +0100
Message-Id: <14030.32.112.128.18.1082534518.squirrel@mail.home.mattmarsh.net>

> What I'd really like to do is to have some way of automating
> this, so that I can build my project either for simulation,
> or for a real chip, and have it set those two lines as
> appropriate. So what I'd really like is two make targets, say
> "projname.hex" and "projname-sim.hex" where those two lines
> are set appropriately. Can anyone think of a way of doing this?

Actually, thinking about this a bit more, I guess I'll
generate a 'processor.inc' file as part of each of the make
rules for the two targets and include that generated inc file
in the assembly source. That should work. I'll give it a try
later and post the results.

Thanks,
Matt

-- 
Matt N. Marsh
Email: ####@####.####          Yahoo: marshmn
  Web: http://www.mattmarsh.net/  Jabber: ####@####.####
                                     MSN: ####@####.####
                                     ICQ: 250467363
                                     AIM: MattMarshUK



Subject: Re: Switching processor for gpsim
From: Chris Emerson ####@####.####
Date: 21 Apr 2004 09:34:12 +0100
Message-Id: <20040421083405.GA27390@ixion.tartarus.org>

On Wed, Apr 21, 2004 at 09:01:58AM +0100, Matt Marsh wrote:
> 
> > What I'd really like to do is to have some way of automating
> > this, so that I can build my project either for simulation,
> > or for a real chip, and have it set those two lines as
> > appropriate. So what I'd really like is two make targets, say
> > "projname.hex" and "projname-sim.hex" where those two lines
> > are set appropriately. Can anyone think of a way of doing this?
> 
> Actually, thinking about this a bit more, I guess I'll
> generate a 'processor.inc' file as part of each of the make
> rules for the two targets and include that generated inc file
> in the assembly source. That should work. I'll give it a try
> later and post the results.

That sounds like it could get into sticky difficulties with
dependencies...

Try something like this:

    ifdef __16F84
        include "p16f84.h"
    else
        include "p16f84a.h"
    endif

And then you can add "-p16f84" or "-p16f84a" to your gpasm command line
as appropriate.

Having said that, I think the '84 and '84a are identical as far as
simulation is concerned, so you needn't bother here.

I presume you've read the various reasons not to use the 16F84 anymore?
(More expensive and less capable than new chips like the 16F628, 16F88,
etc.)

Chris
Subject: Re: Switching processor for gpsim
From: "Matt Marsh" ####@####.####
Date: 21 Apr 2004 09:43:10 +0100
Message-Id: <1028.32.112.128.18.1082536961.squirrel@mail.home.mattmarsh.net>

>> Actually, thinking about this a bit more, I guess I'll
>> generate a 'processor.inc' file as part of each of the make
>> rules for the two targets and include that generated inc file
>> in the assembly source. That should work. I'll give it a try
>> later and post the results.
>
> That sounds like it could get into sticky difficulties with
> dependencies...
>
> Try something like this:
>
>    ifdef __16F84
>        include "p16f84.h"
>    else
>        include "p16f84a.h"
>    endif
>
> And then you can add "-p16f84" or "-p16f84a" to your gpasm command line
> as appropriate.

Ah yes, that's a much better idea, I shall do that.

> I presume you've read the various reasons not to use the 16F84 anymore?
> (More expensive and less capable than new chips like the 16F628, 16F88,
> etc.)

Indeed I have, the 16f84 was my first project, I know better
for my second project :-) I thought I'd try out gpsim with
my working first project that's all :-)

Thanks for the help,
Matt

-- 
Matt N. Marsh
Email: ####@####.####          Yahoo: marshmn
  Web: http://www.mattmarsh.net/  Jabber: ####@####.####
                                     MSN: ####@####.####
                                     ICQ: 250467363
                                     AIM: MattMarshUK



[<<] [<] Page 1 of 1 [>] [>>]


Powered by ezmlm-browse 0.20.