[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Simulavr-devel] 13-pre3 patch
From: |
ken restivo |
Subject: |
Re: [Simulavr-devel] 13-pre3 patch |
Date: |
Sun, 6 Jan 2002 20:45:29 -0800 |
User-agent: |
Mutt/1.3.25i |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
i was able to build 13-pre3, and gdb, no prob. the build system worked cleanly
and quietly. very cool.
but i found a strange problem.
this test program successively writes the bytes "0, 0, 7, 0" to PORTC, whereas
i was expecting it to write the bytes "0, 0, 4, 0".
/* test program for 7 != 4 bug */
#include <timer.h>
#include <io.h>
#include <pgmspace.h>
volatile int useless;
/****************
PRINTUNSIGNED
does unsigned hex.
********************/
volatile void
printUnsigned(unsigned int x, unsigned char maxbuf)
{
int xlen = 0;
/* XXX these are volatile for debugging. gcc -O3 will remove them */
volatile unsigned char realnum;
do {
realnum = (x >> (xlen * 4)) & 0xf ;
outp(realnum, PORTC);
xlen++;
} while( xlen < maxbuf);
} /* END PRINTUNSIGNED */
/************
* MAIN
*************/
int
main( void )
{
useless = 0x0400;
outp(0xFF, DDRD);
outp(0xFF, DDRC);
printUnsigned(useless, 4);
while(1);
return(0);
} /* end main */
/* EOF */
i use this .avrgdbinit:
set print pretty
target remote localhost:1212
load
b printUnsigned
display/x $sp
display/x $pc
c
display xlen
display realnum
the exact same code (with different includes, and with outp's changed to
printf's) does the expected behaviour when compiled for linux. so it seems to
be simulavr-specific.
the damage seems to be done in here:
realnum = (x >> (xlen * 4)) & 0xf ;
8e: 8e 2f mov r24, r30
90: 9f 2f mov r25, r31
92: 04 2e mov r0, r20
94: 02 c0 rjmp .+4 ; 0x9a
96: 96 95 lsr r25
98: 87 95 ror r24
9a: 0a 94 dec r0
9c: e2 f7 brpl .-8 ; 0x96
i compared the ror, lsr, dec, and brpl in decoder.c with the databook, and
didn't find anything amiss.
my apologies in advance if i'm just doing something stupid here.
- -ken
- ----------
On Sun, Jan 06, 2002 at 01:11:09PM -0700, Theodore A. Roth wrote:
> The 13-pre3 patch is ready. Apply it to a clean 0.0.12 release.
>
> Please try it out and let me know about any problems.
>
> Here's the url:
>
> http://res099095.halls.colostate.edu/programs/simulavr/patches/
> simulavr-0.0.12-0.0.13-pre3.patch.gz
>
>
> Ted
>
- --
- ------------------
One world. Many gods. Plenty for everyone.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE8OSfoe8HF+6xeOIcRAnbkAJ42yq6WMoVCieMU44ewGIdJqI6JDgCfWrtx
BJrqtCrsAUVT7R2/Uf5yH1w=
=nU+5
-----END PGP SIGNATURE-----