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

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

[avr-libc-dev] boot API example


From: Theodore A. Roth
Subject: [avr-libc-dev] boot API example
Date: Thu, 5 Feb 2004 13:57:27 -0800 (PST)

Hi,

I'm in the process of writing a xmodem based bootloader and was just
studying the API example in the docs.

There's some mistakes in that example that really need fixing.

  - It doesn't include <avr/boot.h>.

  - There's a buffer overflow: the buffer array is 8 bytes and in the
    show() function call it appears to be loaded with 16 bytes of data.

  - I don't think that sei() should be used since it would enable
    interrupts even if they were never enabled in the first place.
    Better to show more flexible code in the example.

Also,

  - It should show that the function needs to placed in the .bootloader
    section and show an example of how to set the starting address of
    the .bootloader section via the LDFLAGS make variable.

  - The utoa() library function should propably not be used if this
    example is used in a standalone bootloader program.

  - It's not where this function should live: RWW or NRWW. If it's a
    real bootloader, it needs to go in NRWW. As it stands, there's the
    risk of clobbering the function if it overlaps ADDRESS.

  - There really should be mention of the RAMPZ register somewhere in
    the example stating that the API handles it for you automagically
    (I had to go to the source to figure that out).

Yes, I know the example is a contrived one, but it would be better to
show a less contrived example in this case since there are so many
gotchas involed in using SPM anyways.

If nobody else wants to handle this, I'll add it to my TODO list, but no
guarantees on when it will get done.

On a similar note, regarding this message:

  http://mail.gnu.org/archive/html/avr-libc-dev/2002-12/msg00067.html

Once I get it working, I can provide my bootloader as a working example
in the docs if there is desire. I'll probably have it done by tomorrow
as it's nearly working now (the xmodem part is done, I'm just adding
the SPM stuff now).

Ted Roth




reply via email to

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