Re: AVR simulator: excessive stack overflow

This is the oddest simulator problem I have ever seen.
To prove this, I modified the application very slightly so that I could see what was going on ...
code:. The counters allow me to find them in the RAM, and to see one of them increase monotonically. I then created a Project built from external executable in IAR Embedded Workbench, set the target to an ATmega8, set the linker to generate (actually, to expect) an Intel standard hex file, added the output of WinAVR (qsfp.hex) to the Embedded Workbench project, and started C-SPY.#include <inttypes.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>#include "salvo.h"
#define TASK_MEASURE_P OSTCBP(1) /* task #1 */
#define PRIO_MEASURE 10 /* task priorities*/
#define BINSEM_ADCRDY_P OSECBP(1) /* binSem #1 */
_OSLabel(TaskMeasurel)unsigned int counter, counter2, counter3;
void TaskMeasure( void )
{
counter2 = 0x1234;
counter3 = 0x4567;for (;;)
{
OS_Yield(TaskMeasurel);
counter++;
}
}
int main( void )
{
/* Initialize the OS */
OSInit();
/* Create all tasks */
OSCreateTask(TaskMeasure, TASK_MEASURE_P, PRIO_MEASURE);/* Create semaphores */
/* Run the scheduler */for (;;)
{
OSSched();
}
}
This loaded the project into the C-SPY simulator. I then set a few breakpoints (it's a little tricky because WinAVR shows the addresses as words and IAR shows them as bytes, so I had to multiply by two to find the correct addresses). I set a breakpoint at OSInit() (to catch resets), watched RAM, and then ran the application in C-SPY. [b]It runs forever[b], whereas it crashes after 511 calls to OSYield() in the WinAVR simulator. I can clearly see the 0x1234 and 0x5678 values, as well as counter incrementing (they're located at 0x64, 0x60 and 0x62, respectively).
So, since I'm running the exact same executable (a hex file) on two radically different simulators, AND there should not be any difference between the ATmega64 and 32 and 16 w/regard to Salvo's operation, at this point I must assume that the WinAVR simulator has some weird problem that Salvo tickles and causes it to crash. I will source some real silicon to test this ...
This took in excess of 7 hours to nail down the problem ... :(
So, it would be very helpful if you could program one of the "suspect" chips with a simple "LED counter" Salvo application and report back if it works on the chip.
------------------
[This message has been edited by aek (edited December 14, 2006).]