[Top][All Lists]

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

[avr-libc-dev] [patch #6352] Far pointer library

From: Carlos Lamas
Subject: [avr-libc-dev] [patch #6352] Far pointer library
Date: Thu, 03 Jan 2008 00:54:08 +0000
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv: Gecko/20070725 Firefox/

Follow-up Comment #2, patch #6352 (project avr-libc):

This is a good point. I've considered this at the time of writing the
functions but then I've discarded it considering that the code for
pgm_read_xxxx_far() macros in avr/pgmspace.h has also the same problems and
EEPROM routines are also affected. RAMPZ modification is documented but I
agree that the side effects could be explained more clearly.

Making these functions reentrant secured imposes a small penalty (just to
save and restore RAMPZ in any of the free call-used registers, 2 instructions,
2 machine cycles) for each function, probably small enough to avoid having two
different versions, one reentrant and the other not. pgm_read_xxxx_far()
macros probably could live in two flavors, reentrant and not reentrant. These
macros will suffer more (relative to their small size) overhead costs adding
RAMPZ preserving code.

This is all referred to interrupt handlers only. Preemptive task execution
will require to save and restore RAMPZ as part of the task state for each
context swap unless interrupts were disabled in the whole function (absurd)

Maybe it's time to debate the creation of a reentrant avr-libc version...

> 3. In future add support of "far" pointer in avr-gcc.

This sounds a bit optimistic but... who knows?


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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