[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] gcc-3.3 branch
From: |
Marek Michalkiewicz |
Subject: |
Re: [avr-libc-dev] gcc-3.3 branch |
Date: |
Wed, 15 Jan 2003 00:01:47 +0100 (CET) |
Hi,
sorry for late reply - I've just looked at the issue of indirect 16-bit
writes not working with 16-bit I/O registers (because high byte should
be written first). I'm afraid it's not that simple - if you look at
out_movhi_mr_r, you will see that there are several places that would
need to be changed. If we fix just one case, people will assume that
using pointers for 16-bit I/O is safe, when it still isn't.
In some cases, where post-increment is used (most likely with the X
pointer), writing high byte first would make less efficient code
(when writing to normal SRAM, where order doesn't matter) - we lose
the reg_unused_after optimizations. So, my opinion is that it would
be best to simply document the fact that 16-bit I/O register access
works correctly only with constant addresses (which is the common case
for most I/O register accesses anyway). If you need to do a 16-bit
write high byte first to non-constant addresses, better don't depend
on GCC, but write a piece of inline asm, like this (not tested):
static inline void
write_high_byte_first(volatile unsigned int *addr, unsigned int val)
{
asm volatile (
"std %a0+1,%B1" "\n\t"
"st %a0,%A1"
: /* no outputs */
: "b" (addr), "r" (val)
);
}
After the 3.3 release you can still try to convince me, of course... :)
Hope this helps, time for me to go to sleep(18000);
Marek
- [avr-libc-dev] gcc-3.3 branch, Theodore A. Roth, 2003/01/08
- Re: [avr-libc-dev] gcc-3.3 branch, E. Weddington, 2003/01/08
- Re: [avr-libc-dev] gcc-3.3 branch, Joerg Wunsch, 2003/01/08
- Re: [avr-libc-dev] gcc-3.3 branch, E. Weddington, 2003/01/09
- Re: [avr-libc-dev] gcc-3.3 branch, Joerg Wunsch, 2003/01/09
- Re: [avr-libc-dev] gcc-3.3 branch, E. Weddington, 2003/01/09
- Re: [avr-libc-dev] gcc-3.3 branch,
Marek Michalkiewicz <=
- Re: [avr-libc-dev] gcc-3.3 branch, Joerg Wunsch, 2003/01/15
- Re: [avr-libc-dev] gcc-3.3 branch, E. Weddington, 2003/01/15
- Re: [avr-libc-dev] gcc-3.3 branch, Marek Michalkiewicz, 2003/01/15
- Re: [avr-libc-dev] gcc-3.3 branch, Joerg Wunsch, 2003/01/16