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: HeaderSeverity: 3 - Normal
Priority: 7 - HighItem Group: Header files
Status: Need InfoPercent Complete: 0%
Assigned to: NoneOpen/Closed: Open
Release: AnyFixed 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 File(s):

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
  • -unavailable- added by joerg_wunsch (Posted a comment)
  • -unavailable- added by arcanum (Posted a comment)
  • -unavailable- added by sjackman (Submitted the item)
  • -unavailable- added by sjackman

    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 9 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 16 Nov 2012 05:57:18 PM UTCarcanumAssigned toarcanum=>None
    Thu 12 May 2011 07:14:00 PM UTCarcanumStatusNone=>Need Info
    Tue 30 Sep 2008 02:04:08 PM UTCarcanumPriority9 - Immediate=>7 - High
    Mon 11 Aug 2008 03:01:05 AM UTCarcanumPriority5 - Normal=>9 - Immediate
    Sat 08 Mar 2008 02:42:20 PM UTCarcanumCategoryNone=>Header
    Tue 18 Dec 2007 10:48:12 PM UTCarcanumAssigned toNone=>arcanum
    Fri 14 Dec 2007 11:51:53 PM UTCsjackmanAttached File-=>Added boot.diff, #14628
      Carbon-Copy-=>Added -unavailable-

    Back to the top

    Powered by Savane 3.1-cleanup1