Problems simulating ATxmega32A4

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

Hi All,

I'm using Simulator2 (AVRStudio V4.18 build 716) to do some algorithmic testing on some functions I've written. To start with I used a very simple program:

uint8_t testData;
int main(void)
{
   for(uint8_t x=0; x<8; x++)
   {
      asm("nop");
      testData = x;
   }

   while(1);
} // end main

I set up a watch window to look at testData and single step. If I target the ATxmega32A4 I get mis-operation, it doesn't seen to do anything sensible (even the frequency is wrong). If I target an ATxmega128A1 it seems to work properly. Can anyone verify this?
Since I'm only interested in algorithmic testing any targeted device will do, so which is the most stable?

Thanks!
Mark.

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

Quote:
it doesn't seen to do anything sensible
This is because you didn't do anything useful. The compiler sees that the code does nothing and removes it.

Regards,
Steve A.

The Board helps those that help themselves.

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

Koshchi wrote:
Quote:
it doesn't seen to do anything sensible
This is because you didn't do anything useful. The compiler sees that the code does nothing and removes it.

I've set the compiler to use no otpimization, the compiler shouldn't remove anything (also it doesn't explain why the ATxmega128A4 simulation works).

Mark.

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

Quote:

Since I'm only interested in algorithmic testing any targeted device will do, so which is the most stable?

Atmega128 probably. (they've had longest to get it right in Sim2 ;-))

BTW for testing non-h/w related algorithms in C I don't see the point in doing any of it on an AVR (simulated or not). Why not simply do this in a P environment where it's much easier to simply put in some printf()s and see the output at a command prompt? Or use the far more advanced debugging tools in Visual Studio Express.