gnupic: [gnupic] Differend data segment types
Subject:
Re: [gnupic] Differend data segment types
From:
Peter Onion ####@####.####
Date:
22 May 2005 10:01:18 +0100
Message-Id: <1116752450.5931.28.camel@HP.RoomLan>
On Sat, 2005-05-21 at 20:13 -0500, Craig Franklin wrote:
> Peter Onion wrote:
>
> >I'm a little unsure what the various "udata" segment types mean in
> >relocation mode, and the gputils manual isn't particularly helpful.
> >
> The mpasm/mplink/mplib manual has a pretty good description. A copy is
> on the gputils website.
Thanks. I'll go and get it and have a look.
> udata_ovr - This is an overlay section. All overlay sections with the
> same name, within the same object, are forced to start at the same
> address. This is a simple way to save memory.
Ah ! That's something else I need to do !
> >Also, for preformance reasons I'de like to be able to have a data
> >segment that I know is in bank 0, but which I can add variables to from
> >differnet modules. I can't work out how to do this.
Have a look at this picture to see why I'm interested in performance...
http://www.btinternet.com/~Peter.Onion/PhaseData/p002101.jpg
That display is a 'scope screen being driven in X-Y mode in real time.
I need working registers that I know are in bank 0 so I can write code
that manipulates the ports connected to the DtoAs without the overhead
of bank switching.
(The display is showing the data recovered from the 25 bits/s data
stream carried by phase shifting the carrier for BBC Radio 4, which is
transmitted on 198kHz. The bottom line shows the current time
"08:29:48" which is sent once a minute)
> >
> 2. Create a logical section in bank one and use that logical name as
> the section name. A little more linker impact, but the data is
> guaranteed to be in bank 0.
> Here is an example of #2.
>
> Use this file:
> processor 16f877
>
> DATA1 udata
> buffer res 1
>
> end
>
> Use this linker script:
> include 16f877a.lkr
>
> SECTION NAME=DATA1 RAM=gpr0
> SECTION NAME=DATA2 RAM=gpr1
> SECTION NAME=DATA3 RAM=gpr2
> SECTION NAME=DATA4 RAM=gpr3
>
> NOTE: Doing this uncovered a little bug. I am not using the default
> script path on scripts included from scripts. I have fixed it. The
> change will be in cvs shortly. In the mean time, copy the file to your
> current directory.
>
To be honest I hadn't even considered that the linker scripts could be
used for this sort of thing. I havn't even looked at a linker script to
see what they cointain. This looks like the answer.
I've always done everything in absolute mode before and I was begining
to think moving to relocation was a bad move as it seems a lot harder to
get code to work right, but I guess it just requires more attention to
details that in absolute mode I never bothered about.
Thanks for all the helpful tips.
Peter