[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: Mon, 18 Mar 2002 10:30:05 +0200


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 which
is pretty behind on patches).

Regardless of that little problem: I can think of 3 solutions to this
fplib dilemma:

1. Reserve an extra register for use inside mLPMRdZpp which then loads
rampz. This would mean quite a bit of code changes in all the routines
which use this macro. (ouch)

2. Make the fplib tables relocatable so that they always load into the
lower section of memory (much like the progchar strings in 'c') (how
does one do that in assembler ?)

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


>>> Peter Jansen <address@hidden> 03/15/02 01:32AM >>>

> I need help on this one.
> I've got an application, bigger than 64KBytes, using floating
> This means that libm.a gets linked somewhere past the 64K boundary
> LPM.
> Guess what, inside FPLIB there are tables for cos, tan, exp etc.
> All of these are addressed by LPM and therefore result in incorrect
> results.
> This behaviour only occurs on MEGA128.
> The easiest solution for me would be if I could somehow locate the
> fplib in the beginning of my memory.
> Is this possible ? (Messing around in my makefile did not help)

Yes you can do this by modifing the linker script to put the FPLIB
objects into the start of program space.
So somthing like 

*cos*.o(.text) before the other *(.text) line in the linker script.
> Anyone any other ideas ?

Fix the library, in avrlib/libm/fplib/fplib.inc add another #if
( AVR_MEGA ) then use the eplm instruction in the macro mLPMRdZpp

> Nicest would be of course if the FPLIB were updated ...


Peter Jansen
Smart Container
Level 1, NIC Building
NSW       1430
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]