From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1464 invoked by alias); 3 Mar 2005 13:13:40 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 1356 invoked by uid 48); 3 Mar 2005 13:13:26 -0000 Date: Thu, 03 Mar 2005 13:13:00 -0000 Message-ID: <20050303131326.1355.qmail@sourceware.org> From: "bob dot paddock at gmail dot com" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20050302181643.20288.bob.paddock@gmail.com> References: <20050302181643.20288.bob.paddock@gmail.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug target/20288] AVR assignment of a value through a 16 bit pointer generates out of order code X-Bugzilla-Reason: CC X-SW-Source: 2005-03/txt/msg00356.txt.bz2 List-Id: ------- Additional Comments From bob dot paddock at gmail dot com 2005-03-03 13:13 ------- (In reply to comment #5) >Personally see no problem. The quote above has specifically to do with how to >write a logical 16-bit timer/counter value into a pair of otherwise distinct >8-bit registers, which controls a specific peripheral function which presumes a >specific write sequence to maintainthe logical integrety of that specific timer/counter value; it has nothing to with 16-bit pointers, >the sequencing of multi-byte logical data type transactions, or the compiler in >general. It is specific to the pointer case because the correct order of operations is generated in all other cases. Due to the limited Flash space of the AVR it is common to have structures of pointers pointing to the hardware registers, so that the same code will work with both Output Compare One, and Output Compare Three for example. The Input Capture and Output Compare registers are truly 16-bits in length, they are not distinct 8-bit registers. They are accessed 8-bits at a time. To access the 16-bit registers 8-bits at a time without use of the hardware latching mechanism would require that interrupts be disabled. In many embedded applications this is unacceptable, hence the hardware is provided to deal with this problem. By not disabling interrupts and not using the hardware latching mechanism the embedded device, be it a Cruse Control or Phase Control System, is going to have outputs that are off by a factor of 256 at apparently "random" times. If the complier can not be made to generate correct code for this case then the compile should fail. Consider that if the the order of 16-bit operations I/O was wrong in all cases then the GCC would not be usable on the AVR. "Asynchronous Hardware/Firmware" by Jack Ganssle at http://www.ganssle.com/articles/asynchf.htm goes into the gory details of why this type of failure in a embedded device is down right dangerous. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20288