[Top][All Lists]

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

[avr-gcc-list] Bootloaders (self programming problems)

From: Larry Barello
Subject: [avr-gcc-list] Bootloaders (self programming problems)
Date: Fri, 20 May 2005 22:11:37 -0700

Below is a fragment of code from my bootloader (heavily modified version of
Jason Kyle's stk500boot.c).

The "C" code version works on an m128, but fails on an m16 (odd bytes are
written as '0x00').  The Assembly version works on both.

It seems that using in/out instructions doesn't work, but lds/sts does.  On
the m128 the SPMCR is in extended I/O so the compiler generates sts/lds, on
the m16 it is in low I/O.

What is going on?  Shouldn't in/out work in this application?

void waitspm(uint8_t command)
#if 0
        while (SPMCR & BV(SPMEN))       // in R0, 37
                ;                               // sbrc R0, 0, rjmp .-6
        SPMCR = command;                        // out 37, R24
        asm volatile("spm");            // spm, ret
        asm volatile(
        "\tlds  r25, %0\n"
        "\tsbrc r25, 0\n"
        "\trjmp .-8\n"
        "\tsts  %0, r24\n"
        : "=m" (SPMCR) );

Larry Barello

reply via email to

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