avr-libc-dev
[Top][All Lists]
Advanced

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

Re: [avr-libc-dev] Re: avr-libc-dev archives


From: E. Weddington
Subject: Re: [avr-libc-dev] Re: avr-libc-dev archives
Date: Tue, 17 Dec 2002 17:11:23 -0700

On 18 Dec 2002 at 0:17, Joerg Wunsch wrote:

> As E. Weddington wrote:
> 
> > Whoa! I'm not into providing any kind of "protocol".
> 
> I didn't imply you should. ;-)
> 
> > What I'm proposing is a *low-level* API that right now a user has to
> > write themselves, more of a boot loader *support* API:
> > 
> > boot_page_fill(address, data)       // Fill the temporary page write
> > buffer boot_page_erase(address)     // Erase page
> > boot_page_write(address)            // Write page boot_mem_read(address)    
> >         //
> > Read memory byte boot_rww_enable()                  // Enable RWW section
> > boot_lock_bits_set(__lock_bits) // Set lock bits
> > boot_spm_interrupt_enable() // Enable SPM interrupt
> > boot_spm_interrupt_disable()        // Disable SPM interrupt
> > is_boot_spm_interrupt()             // Check if SPM interrupt enabled
> > boot_rww_busy()                             // Check if RWW section is busy
> > boot_spm_busy()                             // Check if SPM is busy 
> > boot_spm_busy_wait()            //
> > Wait while SPM is busy
> 
> So far, that doesn't sound bad.
> 
> In order to get some practical value out of it, i'd then like to use
> that to provide a bootloader (in the "examples" section, not as part
> of the library) that could talk STK500 protocol.

Well that would be pretty cool!

Attached is avr-boot.h. 

BTW, I'm not stuck on any particular name in the API or the name of 
the header file. If it is included in avrlibc, then it could very 
well be <avr/boot.h>.

avr-boot.h caveats:

1. boot_mem_read(). This essentially does the same thing as the 
__ELPM macros in pgmspace.h. But there is no API brought out to the 
user since PRG_RDB() maps to __LPM(). I'm personally not thrilled 
with the name PRG_RDB(), hence boot_mem_read(). I'm sure that all 
these names will have to be thought out. 

2. I'm not the best with writing inline assembly for GCC. I think I 
may use a couple of incorrect things especially with constraints. Any 
help with review and correction would be appreciated. However, having 
said that, I have tested this out (except for boot_lock_bits_set()) 
successfully on an ATmega128.

3. I define BOOTLOADER_SECTION as an attribute for a new named 
section .bootloader. In my own project, I then use the new section 
for relocating the code (a la the FAQ entry that started this whole 
mess ;-)) The idea is similar to the PROGMEM define in pgmspace.h.

FWIW,
Eric
The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any another MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  avr-boot.h
     Date:  22 Nov 2002, 11:03
     Size:  14155 bytes.
     Type:  Program-source

Attachment: avr-boot.h
Description: Binary data


reply via email to

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