[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-dev] [RFC] Boot Loader Support
From: |
E. Weddington |
Subject: |
[avr-libc-dev] [RFC] Boot Loader Support |
Date: |
Mon, 09 Sep 2002 15:17:29 -0600 |
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
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
avr-boot.h
Description: Binary data
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
boottest.h
Description: Binary data
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
boottest.c
Description: Binary data
- [avr-libc-dev] [RFC] Boot Loader Support,
E. Weddington <=
- Re: [avr-libc-dev] [RFC] Boot Loader Support, ken restivo, 2002/09/09
- [avr-libc-dev] timer.h, Chris Baugher, 2002/09/15
- Re: [avr-libc-dev] timer.h, E. Weddington, 2002/09/16
- Re: [avr-libc-dev] timer.h, Joerg Wunsch, 2002/09/30
- Re: [avr-libc-dev] timer.h, E. Weddington, 2002/09/30
- Re: [avr-libc-dev] timer.h, Joerg Wunsch, 2002/09/30
- Re: [avr-libc-dev] timer.h, E. Weddington, 2002/09/30
- Re: [avr-libc-dev] timer.h, Theodore A. Roth, 2002/09/30