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: Paulo Marques
Subject: Re: [avr-gcc-list] Success running the testsuite with avrtest
Date: Wed, 16 Jan 2008 13:17:10 +0000
User-agent: Thunderbird 1.5.0.12 (X11/20070509)


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]