bugAVR C Runtime Library - Bugs: bug #40206, incorrect SP init in startup code...


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

bug #40206: incorrect SP init in startup code for xmegas

Submitter:  Senthil Kumar Selvaraj <saaadhu>
Submitted:  Tue 08 Oct 2013 12:24:16 PM UTC
Category:  Library Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Startup code
Status:  Fixed Assigned to:  pitchumani
Percent Complete:  0% Open/Closed:  Open
Release:  1.8.0 Fixed Release:  None

Tue 29 Apr 2014 06:26:08 AM UTC, comment #1: 
Pitchumani <pitchumani>
Group Member
Tue 08 Oct 2013 12:24:16 PM UTC, original submission:  

gcrt1.S writes SPH before SPL for all devices. For xmegas, the compiler, however, writes SPL before SPH. This is to avoid occurence of interrupts after the writing of SPH but before the writing of SPL; the hardware disables interrupts for four instructions after the write to SPL.

Also, things like writing to the CCP first up in main fail silently because of the reversed order of writing to the SP (when there are less than 4 instructions separating the write to SPL and the write to CCP).

The attached patch (patch #1) makes the startup code write to SPL and then SPH for xmegas, making it consistent with what the compiler does for function prologues.

Senthil Kumar Selvaraj <saaadhu>
Group Member


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

Attached Files
file #29326:  fix_sp_write_xmega.patch added by saaadhu (707B - text/x-patch)


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 saaadhu (Submitted the item)

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-04-29 pitchumani StatusConfirmed Fixed
    2014-04-29 pitchumani StatusNone Confirmed
        Assigned toNone pitchumani
        SummarySP initialization in startup code for xmegas is inconsistent with compiler generated initialization in function prologue incorrect SP init in startup code for xmegas
    2013-10-08 saaadhu Attached File- Added fix_sp_write_xmega.patch, #29326

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code