FW: [En-Nut-Discussion] Compiling Ethernut with WinAVR
Gert Jan Kruizinga
gjk at gjk4all.net
Fri Jan 10 23:41:04 CET 2003
Here are the diffs
----------------- <include/avr/eeprom.h> (my nutos
version) -------------------
/* Copyright (c) 2002, Marek Michalkiewicz
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. */
/*
eeprom.h
Contributors:
Created by Marek Michalkiewicz <marekm at linux.org.pl>
*/
/* patched for libc-20021217cvs by Gert Jan Kruizinga (gjk at gjk4all.net) */
#ifndef _EEPROM_H_
#define _EEPROM_H_ 1
#define __need_size_t
#include <stddef.h>
#include <inttypes.h>
#include <avr/io.h>
/** \defgroup avr_eeprom EEPROM handling
\code #include <avr/eeprom.h> \endcode
This header file declares the interface to some simple library
routines suitable for handling the data EEPROM contained in the
AVR microcontrollers. The implementation uses a simple polled
mode interface. Applications that require interrupt-controlled
EEPROM access to ensure that no time will be wasted in spinloops
will have to deploy their own implementation.
\note All of the read/write functions first make sure the EEPROM
is ready to be accessed. Since this may cause long delays if a
write operation is still pending, time-critical applications
should first poll the EEPROM e. g. using eeprom_is_ready() before
attempting any actual I/O. */
/** \name avr-libc declarations */
/*@{*/
/** \def eeprom_is_ready
\ingroup avr_eeprom
return 1 if EEPROM is ready for a new read/write operation, 0 if not */
#define eeprom_is_ready() bit_is_clear(EECR, EEWE)
#ifdef __cplusplus
extern "C" {
#endif
/** \ingroup avr_eeprom
Read one byte from EEPROM address \c addr. */
extern uint8_t eeprom_read_byte (uint8_t *addr);
/** \ingroup avr_eeprom
Read one 16-bit word (little endian) from EEPROM address \c addr. */
extern uint16_t eeprom_read_word (uint16_t *addr);
/** \ingroup avr_eeprom
Write a byte \c val to EEPROM address \c addr. */
extern void eeprom_write_byte (uint8_t *addr, uint8_t val);
/** \ingroup avr_eeprom
Read a block of \c n bytes from EEPROM address \c addr to
\c buf. */
extern void eeprom_read_block (void *buf, void *addr, size_t n);
/** \ingroup avr_eeprom
read one byte from EEPROM address \c addr */
#define eeprom_rb(addr) eeprom_read_byte ((uint8_t *)(addr))
/** \ingroup avr_eeprom
read one 16-bit word (little endian) from EEPROM address \c addr */
#define eeprom_rw(addr) eeprom_read_word ((uint16_t *)(addr))
/** \ingroup avr_eeprom
write a byte \c val to EEPROM address \c addr */
#define eeprom_wb(addr,val) eeprom_write_byte ((uint8_t *)(addr),
(uint8_t)(val))
#ifdef __cplusplus
}
#endif
/*@}*/
/** \name IAR C compatibility defines */
/*@{*/
/** \def _EEPUT
\ingroup avr_eeprom
write a byte to EEPROM */
#define _EEPUT(addr, val) eeprom_wb(addr, val)
/** \def _EEGET
\ingroup avr_eeprom
read a byte from EEPROM */
#define _EEGET(var, addr) (var) = eeprom_rb(addr)
/*@}*/
#endif /* _EEPROM_H_ */
----------------------------------------------------------------------------
----
---------------------- <net/ifconfig.c> (line
159) -----------------------------
eeprom_read_block(&confnet, &confnet_ee_offset, sizeof(CONFNET));
----------------------------------------------------------------------------
----
That should do the trick.
Gert Jan Kruizinga.
-----Original Message-----
From: deoxy at u.washington.edu [mailto:deoxy at u.washington.edu]
Sent: Friday, January 10, 2003 9:48 PM
To: gjk at gjk4all.net
Subject: Re: [En-Nut-Discussion] Compiling Ethernut with WinAVR
Hi,
I would like to take a look, if it's not too much trouble. Could you send
the file to me, or to the list?
Thanks for your help,
Louis
On Fri, 10 Jan 2003, Gert Jan Kruizinga wrote:
> I had the same problem on the linux distribution
>
> This is due to some changes in the eeprom code from the new libc. I had to
> merge the originam libc avr/eeprom.h header file whith te avr/eeprom.h
> header file from the nut/os tree.
>
> After that you're left with one problem in the ifconfig.c, there is a call
> to eeprom_block_read where te address is given as an integer, in the new
> libc this has to be a pointer, so adding a anpassant (&) in front of this
> address variable will solve the problem.
>
> I'm apoligize for possible errors in the above, i'm on my work right now.
> If there is a interrest for it then i can mail the diffs for the lib
> tonight (europe).
>
> Gert Jan Kruizinga.
>
> > I'm having trouble compiling Ethernut 2.5.2 using WinAVR-20021209. The
> > compiler has trouble with the calls to eeprom_wb in init.c, and
> > ifconfig.c. I had no trouble when using the experimental GCC3.2
> > release from AVRfreaks. There is no problem when compiling the library
> > files, only when compiling an app.
> >
> > Commenting out these calls in the library allows the app to compile
> > with no errors. Replacing the call to eeprom_wb with a call to
> > eeprom_write_byte gives an error when compiling the library files.
> >
> > I'd stick with the GCC3.2 release from AVRfreaks, but I want to use the
> > experimental PPP version, which I think requires a newer version of
> > libc.
> >
> > Any ideas???
> >
> > Thanks,
> >
> > Louis Beaudoin
> >
> >
> > C:/egnite/nut/lib/gcc/atmega128/init.o(.text+0x84): In function
> > `NutSaveConfig':
> >
> > : undefined reference to `eeprom_wb'
> >
> >
> > C:/egnite/nut/lib/gcc/atmega128\libnutnet.a(ifconfig.o)(.text+0xc0): In
> > function `NutNetSaveConfig':
> > : undefined reference to `eeprom_wb'
> >
> >
> > _______________________________________________
> > En-Nut-Discussion mailing list
> > En-Nut-Discussion at egnite.de
> > http://www.egnite.de/mailman/listinfo/en-nut-discussion
>
>
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo/en-nut-discussion
>
More information about the En-Nut-Discussion
mailing list