Simulators/Emulators: Current state of the art?

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello all,

What is the current state-of-the-art for AVR simulators?

There is a list here: https://www.avrfreaks.net/index.p... but many of them seem to be either unmaintained, or their advertised website is down.

I'm not really interested in simulating an AVR per se; what I really want to do is create a unit testing framework of some description.

For example, say I have a function:

uint16_t GetConstant() 
{
    return 5;
}

And I want to test (offline and automatically) whether I've intoduced any regressions in the code. So, on a PC, I could create a test harness:

#include "LibraryToTest.h"

int main(void)
{
    return (GetConstant() == 5) ? 0 : 1;
}

So after the exectuables are built, it runs the said automatic test and sees is the process returns zero.

Quite easy for a PC, and there are now numerous regression testing frameworks (e.g. cppunit, boost::test)

So what I want to do is a similar thing:
* Cross-compile the test code for the AVR
* Run said cross-compiled code on a simulator/emulator
* See if the process was successful (by some mechanism), the return code the O/S was best)

The emphasis is on automation - I don't want to manually have to load files, or fiddle with GUIs after I have created a build script.

Does anyone have any suggestions that may help?

-- Damien

Last Edited: Thu. Aug 6, 2009 - 11:07 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As you need to add automation I'd suggest the only one you can really work with is simulavr - probably the recently updated C++ version rather than the original which is well out of date.

But the problem with this is how do you know if an error is a failure in the simulation or the AVR app? Also how do you simulate realtime stimulation (which is, after all, what microcontrollers are all about)?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
But the problem with this is how do you know if an error is a failure in the simulation or the AVR app? Also how do you simulate realtime stimulation (which is, after all, what microcontrollers are all about)?

The problem of simulator vs user code is a risk I'll have to bear.

While regression testing an entire program (including timing/events) would be the ultimate goal, I can start with regression testing individual functions and verifying individual code blocks. There are lots of tasks that don't necessarily need peripherals/timing constrains but would nonetheless benefit from such testing. For example, the CRC of a packet or the output of an FIR filter.

While it's true that much of this activity can be achieved on a desktop, I've been burned by word-length problems before.

In addition, a regression testing framework for the target will allow assembler routines to be hooked in (subject to aforementioned peripheral and timing constraints.

-- Damien