avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] Bootloader - SPM - Mega128


From: Christian Ludlam
Subject: Re: [avr-gcc-list] Bootloader - SPM - Mega128
Date: Tue, 22 Jan 2002 15:59:54 +0000
User-agent: POPstar/2.02

On 22 Jan Pieter Potgieter wrote:

> Has someone written a bootloader for the mega128 ?
> 
> How do I get the following opcode to work?
>  __asm__ __volatile__ ( "spm" : : );
> 
> If I use this the compiler tells me the following: ccDPY2QO.s:1997: Error:
> illegal opcode spm for mcu atmega128
> 
> I intend to write macros to handle the assembler for the bootloader
> page_write and page_load etc. 
> 
> Question: How is the SPM instruction involved, because in the example
> bootloader code  in the datasheet for the Mega128, I do not see the spm
> instruction being  used? 
> 
> Any suggestions or previous experience will be appreciated.

I've just written one for the Mega161 - Atmel's application note 
"AVR109: Self programming" gives an excellent description of how the SPM
instruction works in general.

Basically though, you set up the SPMCR register to say what you want to do
(erase page, write page etc) then execute SPM within 4 cycles, which actually
does the work.

I was working in assembler though, as recommended by the app note; it may be
that binutils doesn't support this instruction yet.


C
-- 
Christian Ludlam
address@hidden
avr-gcc-list at http://avr1.org



reply via email to

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