On 11.11.2015 13:42, Johan Ström wrote:
> Also try to search for pgm_read_ptr_near and/or pgm_read* in the include
> files which your avr-libc package installs (check with your package
> manager how to list installed files).
There seem to be some somewhat-incompatible and probably incompletely
updated/patched AVR libc packages floating around, and Ubuntu LTR14
appears to have caught one of them.
It's all in /usr/lib/avr/include/avr/pgmspace.h.
The complete code from that file, as far as pgm_read_ptr_near is
concerned, is this:
#define __LPM_word_classic__(addr) \
(__extension__({ \
uint16_t __addr16 = (uint16_t)(addr); \
uint16_t __result; \
__asm__ __volatile__ \
( \
"lpm" "\n\t" \
"mov %A0, r0" "\n\t" \
"adiw r30, 1" "\n\t" \
"lpm" "\n\t" \
"mov %B0, r0" "\n\t" \
: "=r" (__result), "=z" (__addr16) \
: "1" (__addr16) \
: "r0" \
); \
__result; \
}))
#define __LPM_word_tiny__(addr) \
(__extension__({ \
uint16_t __addr16 = (uint16_t)(addr) + __AVR_TINY_PM_BASE_ADDRESS__; \
uint16_t __result; \
__asm__ \
( \
"ld %A0, z+" "\n\t" \
"ld %B0, z" "\n\t" \
: "=r" (__result), "=z" (__addr16) \
: "1" (__addr16) \
); \
__result; \
}))
#define __LPM_word_enhanced__(addr) \
(__extension__({ \
uint16_t __addr16 = (uint16_t)(addr); \
uint16_t __result; \
__asm__ __volatile__ \
( \
"lpm %A0, Z+" "\n\t" \
"lpm %B0, Z" "\n\t" \
: "=r" (__result), "=z" (__addr16) \
: "1" (__addr16) \
); \
__result; \
}))
#if defined (__AVR_HAVE_LPMX__)
#define __LPM_word(addr) __LPM_word_enhanced__(addr)
#elif defined (__AVR_TINY__)
#define __LPM_word(addr) __LPM_word_tiny__(addr)
#else
#define __LPM_word(addr) __LPM_word_classic__(addr)
#endif
#define pgm_read_ptr_near(address_short) \
(void*)__LPM_word((uint16_t)(address_short))
Thus if somebody could build a patch for MoaT that can work around
whatever is missing from your avr libc (preferably without duplicating
anything that _is_ there), please go ahead and submit a pull request.
Thank you.
--
-- Matthias Urlichs
------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/owfs-developers