avr-libc-dev
[Top][All Lists]
Advanced

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

Re: [avr-libc-dev] fplib and MUL


From: Björn Haase
Subject: Re: [avr-libc-dev] fplib and MUL
Date: Tue, 11 Oct 2005 23:46:51 +0200
User-agent: KMail/1.7.1

Peeter Vois wrote on Dienstag, 11. Oktober 2005 21:31 :
> Hi,
>
> I would like to inform that i have implemented the multiplication but I
> have not tested it. As you can quess it was not hard. I have been
> looking for the simulavr but looks like it is lots of work to make some
> tests running with it. It seems easier to run the tests on real
> hardware. For any case, I'll post the modified files from release 1.2.5

If you are interested: Here you will be finding sample scripts for 
automatically running numerics testsuites with simulavr. I have been using it 
for testing my fractional numerics libraries at work, so you might not need 
to make too many adaptions. You probably will however have to know a little 
bit about gdb and maybe a little on the expect language.


The scripts use the following procedure:

1.) They assume that you have started on the local machine "simulavr -d 
atmega128 -g -p 1212".


2.) They use a test program of the structure

typedef struct { ... } inputdata_t;
typedef struct { ... } resultdata_t;

inputdata_t inputdata;
resultdata_t resultdata[1];

int 
main (void)
{ 
  test_start ();  
  // At this point the variable inputdata will be filled with binary inputdata
  // stored in a file on the pc that you would be providing seperately.

  testfunction (&inputdata, &resultdata[0]);

  test_end ();
  // The binary contents in resultdata[0] would be written in a file stored on
  // the pc.
}

3.) The test run is done using gdb:

 A) Starting gdb. 
 B) Attaching gdb to simulavr by "target remote localhost:1212"
 C) Excecuting "load"
 D) setting breakopoints at the functions test_start and test_end
 E) Running until the program ends up at the test_start function breakpoint
 F) Filling inputdata with the contents of a file on the pc using gdb commands 
for writing memory.
 G) Continuing the program in gdb until the "test_end" breakpoint is reached
 H) Reading out the memory contents between resultdata[0] and resultdata[1] 
and writing the results to a file on the pc.

The attached expect script automatically performs these individual steps so 
that you no longer need to write all the gdb commands by hand. The also 
attached .cc-File provides the dummy functions test_start and test_end. These 
functions are in fact useless, however we could easily make the simulator 
stop at functions with these names so that we could fill the memory with 
useful values or read out the memory contents when the breakpoints have been 
reached. 

The script assumes four parameters:
1.) The name of the .elf file for an atmega128
2.) The code "atmega128" (actually discarded)
3.) A filename in the local directory with the binary inputpattern
4.) A filename where the outputpattern is assumed to be written to.

Requirements are a functional gdb, a functional simulavr and working expect 
implementation.

My personal experience is that automatic tests are a more useful approach than 
hand-run tests.

HTH,

Bjoern.


P.S.:

If you plan to build simulavr: I myself never succeeded in building 
simulavrxxx. The build system seemed to be broken. If you are planing to 
build the old revision of simulavr, you will need binutils version 14. The 
old simulavr will not build with the newer binutils release.

Attachment: control_simulator
Description: Text document

Attachment: teststub.cc
Description: Text Data


reply via email to

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