Re: Hey, what is all this 'off topic' posting?



In article <431BA05F.379524C0@xxxxxxxxxxx>,
Pooh Bear <rabbitsfriendsandrelations@xxxxxxxxxxx> wrote:
>Ken Smith wrote:
[...]
>> Isn't it actually the linker that does the RAM overlay function?
>
>You may be right there. RL51 does get called at some point. I never
>looked into it
>that hard. There's several levels of optimisation available as compiler
>directives
>too.

I've had to look into the subject to fix a problem with some interrupt
code. The Keil C51 does some of the work in the compile step but most of
the actual assigning of overlayed addresses happens at link time. When
you think about it, it is obvious that this must be so because the
routines you call may be in a different file.

The Keil stuff doesn't seem to be smart enough to be able to handle
overlaying across files in the interrupt code.

>I do however have a reasonably large application that runs on an 8031
>and I would
>defy an asm coder to keep track of all the *** going on in it and maintain
>efficient lifetime dependent variable optimised use of RAM too..

A lot depends on the nature of the program. In some programs, a lot of
the variables are fixed and can't be overlayed. In one project I did,
only 12 bytes were needed for the overlayed stuff. Almost everything else
was a running total or the like.


>I honestly don't think it would be maintainable in asm, and most likely
>very hard
>to write bug free.

When you manually overlay RAM, you have to comment the code very well on
the subject. Basically you extend what you do for registers like this:


;********************************************************
;* ArcTan *
;* *
;* This rountine takes the arc tangent of the input *
;* *
;* Input: *
;* R1 The address of the XXXX.XXXX input *
;* R0 Where the XXXX.XXXX output goes *
;* *
;* Output: *
;* R1 incremented by 4 *
;* [R1] written *
;* R0 incremented by 4 *
;* R2 zero *
;* R3-R7 trashed *
;* Work1 trashed *
;* Work2-4 Preserved *
;********************************************************

--
--
kensmith@xxxxxxxxx forging knowledge

.


Quantcast