[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] FPLIB BUG: MEGA128

From: Peter Bosscha
Subject: Re: [avr-gcc-list] FPLIB BUG: MEGA128
Date: Wed, 20 Mar 2002 17:52:03 +0200

Hi Again,

Under the heading of: Excuse my ignorance..

Like I said, LPM_R0_ZPLUS_INIT uses a register. 

If going for option 1. the best way would be to write another macro
which somehow works out at what address the relevant table sits and
loads RAMPZ accordingly, after that one can use LPM_R0_ZPLUS_NEXT to
load the data. 
Question is: how do you work out where the table gets linked in ? As
far as I understand, all I can get is a 16 bit address (not 17 bit).

BIG_CODE looks a bit suspicious to me (mine reads 0x10000) shouldn't it
read 0xffff ? 


>>> Peter Jansen <address@hidden> 03/20/02 02:16AM >>>

> Sorry, I was out of action for a few days.
> I got the linking bit right by swapping:
>     *(.text.*)  and    *(.text)
> libc now sits pretty high up.
> Thanks for that one.
> I tried your suggestion of changing mLPMRdZpp but that ran into the
> problem that ELPM is not defined for the device types under AVR5 (I
> assume your version will work, remember I'm working under windows
> is pretty behind on patches).
> Regardless of that little problem: I can think of 3 solutions to
> fplib dilemma:
> 1. Reserve an extra register for use inside mLPMRdZpp which then
> rampz. This would mean quite a bit of code changes in all the
> which use this macro. (ouch)

I don't think you need a register in the LPM macro, where this macro
used and the Z register is loaded, put 
#if FLASHEND > 0xffff   ; or use BIG_CODE (defined in macros.inc)
        LPM_R0_ZPLUS_INIT (table_atan2)

Then you would have to do something when the table crosses the
and Z is set to Z + Rad(lcount)
You could fix up the stuff in the fplib so that it uses the macros in
macros.h instead of defining its own.
> 2. Make the fplib tables relocatable so that they always load into
> lower section of memory (much like the progchar strings in 'c') (how
> does one do that in assembler ?)

Where is this done?

> 3. Tell people to change the linker script so that fplib always
> first (ish)

a bit ugly because someone will break it one day.

you could put them in there own section but thats also ugly.


Peter Jansen
KlaxonIQA (formally Smart Container)
Level 1, IBC Building
Garden St
NSW       1430
Ph 02 9209 4017
avr-gcc-list at http://avr1.org 

avr-gcc-list at http://avr1.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]