URL: <http://savannah.nongnu.org/bugs/?40206>
Summary: SP initialization in startup code for xmegas is inconsistent with compiler generated initialization in function prologue Project: AVR C Runtime Library Submitted by: saaadhu Submitted on: Tue 08 Oct 2013 12:24:16 PM GMT Category: Library Severity: 3 - Normal Priority: 5 - Normal Item Group: Startup code Status: None Percent Complete: 0% Assigned to: None Originator Email: Open/Closed: Open Discussion Lock: Any Release: 1.8.0 Fixed Release: None _______________________________________________________ Details: 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. _______________________________________________________ File Attachments: ------------------------------------------------------- Date: Tue 08 Oct 2013 12:24:16 PM GMT Name: fix_sp_write_xmega.patch Size: 707B By: saaadhu <http://savannah.nongnu.org/bugs/download.php?file_id=29326> _______________________________________________________ Reply to this item at: <http://savannah.nongnu.org/bugs/?40206> _______________________________________________ Message sent via/by Savannah http://savannah.nongnu.org/ _______________________________________________ AVR-libc-dev mailing list AVR-libc-dev@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-libc-dev