[Top][All Lists]

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

[avr-libc-dev] Additional bootloader support in boot.h?

From: Erik Walthinsen
Subject: [avr-libc-dev] Additional bootloader support in boot.h?
Date: Fri, 23 Dec 2005 13:11:21 -0800
User-agent: Debian Thunderbird 1.0.7 (X11/20051017)

I've been bootstrapping a bootloader (doh) and have spent a lot of time trying to find any decent explanations of how to construct one, to little effect. I may have to write a basic HOWTO. Anyway, I did find some examples to work from, but still had to fight with things a bit.

Specifically, the last little detail of a bootloader: jumping to the application, didn't work as expected from the butterfly bootloader (bf_boot), which has it as follows:

    void (*funcptr)( void ) = 0x0000;       // Set up function pointer
. . .
            funcptr();      // Jump to application sector

I ended up with less than useful results, afaict it never got where it was supposed to go.

Another project (LUB) has tinyloader, written in asm. It's got the equivalent of:

  asm volatile ("clr r30\n clr r31\n       ijmp\n"::);

This works just fine, and afaict is what's really supposed to happen. I don't think a function call is really what should be done, though I would expect it should work. The fact is, though, that with the latest gcc-3.4.4 and AVR patches (so I can start on my ATtiny45 shortly), it doesn't work.

This little operation seems to me like a prime candidate for inclusion into boot.h, alongside actual SPM/LPM code. If one can't get out of the bootloader, there's really no point. It's also (AFAICT) always going to work the same way, so it seems obvious to me that it should be included in avr-libc.

I'd submit a patch, but I don't know what it really should be called, and all it consists of is a function-ish #define with the above assembly code in it. I can file a bug at least, for tracking purposes.

    aka Erik Walthinsen

reply via email to

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