avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Success running the testsuite with avrtest


From: andrewhutchinson
Subject: Re: [avr-gcc-list] Success running the testsuite with avrtest
Date: Wed, 16 Jan 2008 8:43:41 -0500

The return from main is specified in dejagnu. gcc documents state to use exit 
and abort

I did not check if any (execute) testcases return 1. Most abort(), use exit(0) 
or return(0). So you may not be far off.

Port = exit code might well be a problem if you have naked function and -O0. 
There is no telling what compiler will do. It has no idea  that naked means the 
prolog is gone. Any  temporaries it creates will create stack slots unless code 
EXACTLY matches instruction pattern. 

Naked is designed  for  100% "asm" functions. It seems inappropriate to use 
this in this context.

I ran all tests last night and still have a few  things to look at before 
declaring that mine is working correctly - at least to the fullest extent that 
the test harness can support.

So some of my suggestion may not be correct!

A quick look showed I had stack underflow again. Unrecognised "asm" function in 
abort()  - lord know what caused that, but it suggests "asm" is problematic in 
some circumstance. And some duplicate definitions of exit/abort. (perhaps that 
is a tescase that has its own).

So I got to do some more checking and fixin!






---- Paulo Marques <address@hidden> wrote: 
> 
> Hi, Andrew
> 
> Andrew Hutchinson wrote:
> > See my other post, exit and abort can't be naked AND try to do C stuff.
> > 
> > It will underflow stack as there is no frame pointer setup and the stack 
> > is completely empty.
> > 
> > NAKED is fine for asm only functions. exit/abort  dont need to be naked 
> > for these purposes.
> 
> I don't think I have a problem there because my exit function is just:
> 
> void exit(int code)
> {
>       *((volatile unsigned char *) EXIT_PORT) = code;
> }
> 
> which should translate into just writing "code" into the EXIT_PORT. At 
> this point the simulator exits with "EXIT", so no more code is executed.
> 
> But since I didn't look into the assembly generated for this with -O0, I 
> might be missing something...
> 
> > exit should check value and issue ABORT if not zero. Otherwise its a pass.
> > 
> > As it seems that return 0 from main  or exit(0) is a pass. And abort() 
> > or return 1 or exit(1) is a fail.
> 
> Damn, I wish I saw this post earlier.
> 
> Right now avrtest prints "EXIT" if:
>   - exit() function is called (no matter what exit code was used)
>   - RJMP +0 is called (standard exit code)
> 
> and it prints ABORTED if:
>   - abort() function is called
>   - an illegal opcode is encountered
>   - the PC goes to an unprogrammed flash area
> 
> and finally it prints TIMEOUT when more than "program_cycles_limit" 
> (which currently defaults to 200000000) have been executed.
> 
> So, this doesn't match exactly what the testsuite is expecting. I have 
> to change the "exit()" implementation to print ABORTED if the exit code 
> is not zero.
> 
> "RJMP +0" shouldn't happen because we should always exit through the 
> exit function even when returning from main, right?
> 
> If a return from main results in a "RJMP +0", we just need to check R24 
> to get the exit code, and process it the same way as "exit()".
> 
> So, there are still some "PASS"'ed tests that might change to "FAIL" 
> once this is in place...
> 
> -- 
> Paulo Marques
> Software Development Department - Grupo PIE, S.A.
> Phone: +351 252 290600, Fax: +351 252 290601
> Web: www.grupopie.com
> 
> "The Computer made me do it."





reply via email to

[Prev in Thread] Current Thread [Next in Thread]