bugAVR C Runtime Library - Bugs: bug #21805, boot.h: Use out instead of sts


bug #21805: boot.h: Use out instead of sts

Submitted by:  Shaun Jackman <sjackman>
Submitted on:  Fri 14 Dec 2007 11:51:52 PM UTC  
Category:  Header Severity:  3 - Normal
Priority:  7 - High Item Group:  Header files
Status:  Need Info Percent Complete:  0%
Assigned to:  None Open/Closed:  Open
Release:  Any Fixed Release:  None

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Thu 12 May 2011 07:14:00 PM UTC, comment #5:

I did a test with the original patch, and I don't see how it is saving code space with e.g. the new definition of __boot_page_fill_normal(). I'm using the latest code in boot.h, patched with the patch here (and modified) and gcc 4.3.3. I get 18 bytes of code with the current code and 20 bytes with the new code.

Eric Weddington <arcanum>
Project Administrator
Wed 07 Jan 2009 02:56:15 PM UTC, comment #4:

Another possible optimization I'm just noticing: the generated
code looks like:

ldi r24, 0xFF
ldi r25, 0x03
movw r30, r24

i.e. a parameter is passed in r24:25, and then moved into
r30:31. This might IMHO become more optimal (with the
compiler using r30:31 directly) by using the "z" constraint.

Joerg Wunsch <joerg_wunsch>
Project Administrator
Tue 30 Sep 2008 02:04:08 PM UTC, comment #3:

Again, deferred until 1.6.4.

Eric Weddington <arcanum>
Project Administrator
Wed 19 Mar 2008 10:52:35 PM UTC, comment #2:

This is a big enough change that it should be checked on multiple devices. I'm deferring this one again until 1.6.3.

Eric Weddington <arcanum>
Project Administrator
Tue 18 Dec 2007 10:48:12 PM UTC, comment #1:

Deferred until 1.6.1.

Eric Weddington <arcanum>
Project Administrator
Fri 14 Dec 2007 11:51:52 PM UTC, original submission:

From boot.h:
\todo From email with Marek: On smaller devices (all except ATmega64/128),
__SPM_REG is in the I/O space, accessible with the shorter "in" and "out"
instructions - since the boot loader has a limited size, this could be an
important optimization.

I'm writing a boot-loader that has to fit into the 256 byte boot-loader space of the 8 kB parts. Here is my proposed solution to fix this matter. I've only fixed the __boot_xxx_normal variants, but the same logic could easily be extended to the __boot_xxx_alternate and __boot_xxx_extended variants.


2007-12-14 Shaun Jackman <sjackman@gmail.com>

  • include/avr/boot.h (__boot_page_fill_normal,

__boot_page_erase_normal, __boot_page_write_normal,
__boot_rww_enable): Use an out instruction rather than an sts
instruction when possible.

Shaun Jackman <sjackman>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #14628:  boot.diff added by sjackman (5KiB - text/plain)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by joerg_wunsch (Posted a comment)
  • -email is unavailable- added by arcanum (Posted a comment)
  • -email is unavailable- added by sjackman (Submitted the item)
  • -email is unavailable- added by sjackman



    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-11-16 arcanum Assigned toarcanum => None
    2011-05-12 arcanum StatusNone => Need Info
    2008-09-30 arcanum Priority9 - Immediate => 7 - High
    2008-08-11 arcanum Priority5 - Normal => 9 - Immediate
        ReleaseNone => Any
    2008-03-08 arcanum CategoryNone => Header
    2007-12-18 arcanum Assigned toNone => arcanum
    2007-12-14 sjackman Attached File- => Added boot.diff, #14628
        Carbon-Copy- => Added -email is unavailable-

    Back to the top

    Powered by Savane 3.3