Re: STK500 bootloader

Jason Kyle <[email protected]> Sat, 29 Nov 2003 21:19:54 +1300
Newsgroups gmane.comp.hardware.avr.general
Message-ID <[email protected]>
At 13:23 24/11/2003 -0600, dave wrote:
>Jason,
>I am trying to compile the stk500boot.c you wrote, found on the web.  I am
>using the mega128 and usart1 at 14.7456 Mhz.  I have tried to compile using
>the latest Winavr using the makefile you provided.
>
>I am new to the gcc compiler.  I feel I have left something out since
>lpm_inline and elpm_inline are undefined.

They have been eliminated from avr-libc since I wrote that code.  See 
http://savannah.nongnu.org/download/avr-libc/doc/avr-libc-user-manual/ for 
an upto date avr-libc reference, in particular the section on Program Space 
String Utilities.

Replace __lpm_inline() with pgm_read_byte_near() and __elpm_inline() with 
pgm_read_byte_far()

Hope this helps.

Jason



>I get the following errors.
>
>avr-gcc -mmcu=atmega128 -Wall -W -Wstrict-prototypes -O3 -Wa,-ahlms=stk500bo
>ot.lst -g   -c -o stk500boot.o stk500boot.c
>stk500boot.c:114: warning: conflicting types for built-in function `putchar'
>stk500boot.c: In function `main':
>stk500boot.c:151: warning: implicit declaration of function `__lpm_inline'
>stk500boot.c:151: warning: comparison between signed and unsigned
>stk500boot.c:391: warning: implicit declaration of function `__elpm_inline'
>avr-gcc stk500boot.o -o
>stk500boot.elf -mmcu=atmega128 -Wl,-M,--section-start=.text=0x1E000 >
>stk500.map
>stk500boot.o(.text+0x12): In function `main':
>C:\Documents and Settings\stk500b/stk500boot.c:151: undefined reference to
>`__lpm_inline'
>stk500boot.o(.text+0x14a):C:\Documents and
>Settings\stk500b/stk500boot.c:389: undefined reference to `__lpm_inline'
>stk500boot.o(.text+0x190):C:\Documents and
>Settings\stk500b/stk500boot.c:391: undefined reference to `__elpm_inline'
>make: *** [stk500boot.elf] Error 1
>
> > Process Exit Code: 2
>
>Dave