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

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

Re: [avr-libc-dev] [RFC] Boot Loader Support


From: ken restivo
Subject: Re: [avr-libc-dev] [RFC] Boot Loader Support
Date: Mon, 9 Sep 2002 15:36:50 -0700
User-agent: Mutt/1.3.25i

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Very cool, thanks!

The avr-boot.h functions look pretty efficient; I'm sure they'll be very useful 
to many, especially those with the larger parts who get to write their 
bootloaders in c. Alas, I have an atmega163 with only 16K flash, and budget of 
only 512 bytes for a bootloader, so I'm stuck writing mine in assembler. Oh 
well.

It might also be helpful to include Bryce Denney's main.lcf or a sample 
Makefile with some of the --defsyms in it, or both. BTW, when I used 
-nodefaultlibs and -nostartfiles, then I had to manually define __stack as 
well.  Fun fun fun.

- -ken
- ------
On Mon, Sep 09, 2002 at 03:17:29PM -0600, E. Weddington wrote:
Content-Description: Mail message body
> Hello All,
> 
> I've been working recently on adding a boot loader to my ATmega128 
> application. I've noticed that there are very little low-level 
> functions to support creating a bootloader.
> 
> Also, according to Atmel's web site, the devices that have boot 
> loader support:
> 1. ATmega8
> 2. ATmega8515
> 3. ATmega8535
> 4. ATmega16
> 5. ATmega169
> 6. ATmega32
> 7. ATmega64
> 8. ATmega128
> 9. ATmega161
> 10. ATmega162
> 11. ATmega163
> 12. ATmega323
> 
> So it seems that Atmel is including this feature in more and more 
> devices.
> 
> I've attached some code that at least represents a stab at providing 
> low-level support for writing boot loader code in C.
> 
> The main code is in avr-boot.h. The other two files (boottest.c 
> boottest.h) are examples of using the API in avr-boot.h.
> 
> avr-boot.h provides macros to write the flash memory from the 
> bootloader section of the flash memory, and to read the flash memory 
> from anywhere.
> 
> There are some caveats with avr-boot.h
> 1. It includes <io.h>. I'm sure it needs changing to <avr/io.h> to 
> work with the latest CVS. (My development system is not necessarily 
> the latest).
> 2. I don't include support (yet) for reading the fuse and lock bits 
> from software.
> 3. I've only tested this on my ATmega128 and it works on it. It needs 
> testing on other devices.
> 4. The main API are inline assembly macros. While I get no warnings 
> or errors, and it tests OK, I'm not 100% sure if the assembly 
> constraints are the most optimal. Any input on this is appreciated.
> 5. I #define a symbol BOOTLOADER which defines a new text section, 
> .bootloader (see example for use). In the makefile, I've added:
> 
> #bootloader sizes start addresses (ATmega128)
>       BOOTLOADER_START_0 = 0x1FC00
>       BOOTLOADER_START_1 = 0x1F800
>       BOOTLOADER_START_2 = 0x1F000
>       BOOTLOADER_START_3 = 0x1E000
>       BOOTLOADER_START = $(BOOTLOADER_START_3)
> 
> #linker flags (passed via gcc)
>       LDFLAGS = -Wl,--section-start=.bootloader=$(BOOTLOADER_START)
> 
> Does anybody have a better idea on switching the start location of 
> the bootloader code? And to do so with different devices?
> 
> Does anybody have an opinion on whether to reserve the section name 
> .bootloader or allow the user to set the name, and if so, how to 
> easily do that?
> 
> If bootloader support is added to avrlibc, there should be extra 
> documentation about creating a bootloader. Such as:
> 1. Not being able to depend upon the low-level library (which is 
> linked into the application section) hence having to write all the 
> sub-routines that the bootloader must call and placing them in the 
> bootloader section as well.
> 2. Whether or not to move interrupts to the bootloader section.
> 
> Food for thought...
> 
> Eric Weddington
> 

Content-Description: Attachment information.
> 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:  9 Sep 2002, 12:26
>      Size:  12976 bytes.
>      Type:  Program-source


Content-Description: Attachment information.
> 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:  boottest.h
>      Date:  9 Sep 2002, 14:32
>      Size:  147 bytes.
>      Type:  Program-source


Content-Description: Attachment information.
> 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:  boottest.c
>      Date:  9 Sep 2002, 14:32
>      Size:  801 bytes.
>      Type:  Program-source



- -- 
- ---------------
The world's most affordable web hosting.
http://www.nearlyfreespeech.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9fSKAe8HF+6xeOIcRAqiHAKDghNcD39XarNa9P74oGSM04nXtawCbBBpd
rtVIRrlK162+EEd2a2M44LQ=
=2FrA
-----END PGP SIGNATURE-----




reply via email to

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