bugAVR C Runtime Library - Bugs: bug #40569, sleep_bod_disable does not work in...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #40569: sleep_bod_disable does not work in attiny13a

Submitter:  Matthijs Kooijman <matthijs>
Submitted:  Wed 13 Nov 2013 05:14:47 PM UTC
   
 
Category:  Header Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Header files
Status:  Fixed Assigned to:  pitchumani
Percent Complete:  0% Open/Closed:  Closed
Release:  1.8.0 Fixed Release:  None

Wed 30 Jul 2014 12:26:18 PM UTC, comment #2: 

Looks good, thanks!

Matthijs Kooijman <matthijs>
Wed 30 Jul 2014 11:48:23 AM UTC, comment #1: 

http://svn.savannah.nongnu.org/viewvc?view=rev&root=avr-libc&revision=2433



This patch has been applied and committed.

Thank you for the contribution.

Pitchumani <pitchumani>
Group Member
Wed 13 Nov 2013 05:14:47 PM UTC, original submission:  

The implementation of sleep_bod_disable for non-xmega mcu's is as follows (from avr/sleep.h):

#define sleep_bod_disable()
do {
  uint8_t tempreg;
  _asm_ __volatile__("in %[tempreg], %[mcucr]" "nt"
                       "ori %[tempreg], %[bods_bodse]" "nt"
                       "out %[mcucr], %[tempreg]" "nt"
                       "andi %[tempreg], %[not_bodse]" "nt"
                       "out %[mcucr], %[tempreg]"
                       : [tempreg] "=&d" (tempreg)
                       : [mcucr] "I" _SFR_IO_ADDR(MCUCR),
                         [bods_bodse] "i" (_BV(BODS) | _BV(BODSE)),
                         [not_bodse] "i" (~_BV(BODSE)));
} while (0)

However, this hardcodes MCUCR, while attiny13 uses BODCR for these bits (see page 33 of http://www.atmel.com/Images/doc8126.pdf).

A grep on BODSE and BPDSE (a typo, see #40567) shows that tn2313a and tn4313 also have the same problem.

Perhaps adding something like:

  #ifdef BODCR
  #define BODSE_TEMP_REG BODCR
  #else
  #define BODSE_TEMP_REG MCUCR
  #endif

and then use BODSE_TEMP_REG in the ASM snippet would fix this?

Matthijs Kooijman <matthijs>

 

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

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by pitchumani (Updated the item)
  • -email is unavailable- added by matthijs (Submitted the item)
  •  

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-07-30 pitchumani StatusNone Fixed
        Open/ClosedOpen Closed
    2014-07-30 pitchumani Assigned toNone pitchumani

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code