[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Problems with avrtest simulatorand avr-gcc testsuite.
From: |
Georg-Johann Lay |
Subject: |
Re: [avr-gcc-list] Problems with avrtest simulatorand avr-gcc testsuite. |
Date: |
Wed, 20 Apr 2011 14:47:49 +0200 |
User-agent: |
Thunderbird 2.0.0.24 (X11/20100302) |
Paulo Marques schrieb:
> Georg-Johann Lay wrote:
>> Paulo Marques schrieb:
>>
>>> +/* avrtest counter wrappers */
>>> +
>>> +static void start_perf_counter(int number)
>>> ...
>>> +static void stop_perf_counter(int number)
>>> ...
>> static??
>
> Yes, the "exit.c" code is supposed to be included directly into the code
> that uses it, so that all these small functions get inlined.
>
> IIRC this is called "exit.c" and not "avrtest_helpers.h" because of the
> way the testsuite works...
The .exp I found for avrtest+atmega just mentions exit.c in ldflags.
IMO including exit.c won't work because this file is not prepared for
including. Besides that test programs should not depend on the
particular implementation of exit/abort, i.e. these functions should
always be CALLed and not inlined/macro expanded.
exit.c gets compiled on-the-fly, so together with -O0 and the "naked"
for abort resp. exit gives odd code because they rely on frame pointer.
The right way would be to use an exit-amtega128.o that was compiled
with, say, -Os and make abort/exit "noreturn" instead of "naked".
Thus, I now use a slightly different setup:
* avrtest: Disable getchar when reading from STDIO_PORT
* atmega128-sim.exp: use exit-atmega128.o instead of exit.c directly
* Reduce namespace pollution in exit.c, build exit-*.o, see attached
Johann
CFLAGS=-O3 -fomit-frame-pointer
WARN=-W -Wall -Wno-unused-parameter
CC=gcc
AVRGCC=avr-gcc
all: avrtest exit-atmega128.o
avrtest: avrtest.c Makefile
$(CC) $(WARN) $(CFLAGS) $< -o $@
$(CC) $(WARN) $(CFLAGS) $< -o address@hidden -DLOG_DUMP
exit-%.o: dejagnuboards/exit.c Makefile
$(AVRGCC) -c -Os -mmcu=$* $< -o $@
.PHONY: clean
clean:
rm -f *.o avrtest avrtest_log
/* Copyright (c) 2004, Bjoern Haase
All rights reserved.
Anatoly Sokolov added code to make more tests PASS.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the copyright holders nor the names of
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. */
#include <stdlib.h>
#include <stdio.h>
#define STDIO_PORT 0x52
#define EXIT_PORT 0x4F
#define ABORT_PORT 0x49
static int putchar_exit_c(char, FILE*) __attribute__((no_instrument_function));
static void init_exit_c(void) __attribute__ ((section
(".init8"),naked,no_instrument_function,used));
static int putchar_exit_c (char c, FILE *stream)
{
(void) stream;
*((volatile unsigned char *) STDIO_PORT) = c;
return 0;
}
static void init_exit_c (void)
{
static FILE file_exit_c;
file_exit_c.put = putchar_exit_c;
file_exit_c.get = NULL;
file_exit_c.flags = _FDEV_SETUP_WRITE;
file_exit_c.udata = 0;
stderr = stdout = &file_exit_c;
}
/* This defines never returning functions exit() and abort() */
void __attribute__ ((noreturn))
exit (int code)
{
*((volatile unsigned char *) EXIT_PORT) = code;
for(;;);
}
void __attribute__ ((noreturn))
abort (void)
{
*((volatile unsigned char *) ABORT_PORT) = 1;
for(;;);
}
- Re: [avr-gcc-list] Problems with avrtest simulator and avr-gcc testsuite., (continued)
- Re: [avr-gcc-list] Problems with avrtest simulatorand avr-gcc testsuite., Weddington, Eric, 2011/04/19
- Re: [avr-gcc-list] Problems with avrtest simulatorand avr-gcc testsuite., Paulo Marques, 2011/04/19
- Re: [avr-gcc-list] Problems with avrtest simulatorand avr-gcc testsuite., Georg-Johann Lay, 2011/04/19
- Re: [avr-gcc-list] Problems with avrtest simulatorand avr-gcc testsuite., Paulo Marques, 2011/04/20
- Re: [avr-gcc-list] Problems with avrtest simulatorand avr-gcc testsuite.,
Georg-Johann Lay <=
- Re: [avr-gcc-list] Problems with avrtest simulatorand avr-gcc testsuite., Paulo Marques, 2011/04/20
- Re: [avr-gcc-list] Problems with avrtest simulatorand avr-gcc testsuite., Georg-Johann Lay, 2011/04/26
- Re: [avr-gcc-list] Problems with avrtest simulator and avr-gcc testsuite., Weddington, Eric, 2011/04/28