simulavr-devel
[Top][All Lists]
Advanced

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

Re: [Simulavr-devel] (no subject)


From: Theodore A. Roth
Subject: Re: [Simulavr-devel] (no subject)
Date: Tue, 14 Oct 2003 13:07:57 -0700 (PDT)


On Tue, 14 Oct 2003, Keith Gudger wrote:

> Ted:
>
> I'm checking out the additions I made to the simulavr code for the
> AT43USB.. devices.  Currently, when Timer 0 fires, simulavr says the
> following:
>
> MESSAGE: file ../../src/avrcore.c: line 823: Raising irq # 10
> MESSAGE: file ../../src/avrcore.c: line 1033: Vectoring to irq at addr:40
> offset:0
>
> This is the wrong irq.  It's supposed to be #7.

Actually, it is correct. Have a look at the _irq_sources enum in
intvects.h. IRQ_TIMER0_OVF is irq #10 in simulavr space. The strange
mapping was done to make the irq vector somewhat device independant.
It's debatable as to wether I achieved that.

The problem is really a bug in how my gdbserver.c hack is passing the
irq number down to the simulator. I mistakenly assumed that the signal
number (minus whatever offset) translates directly to an index into
the vtab_* arrays. What really needs to happen is this:

  - convert signal into address [ addr = (signal - offset) * vect_size ]
    where vect_size is 1 or 2 words.
  - vector to the address.

On another note, I'm thinking that I can make the vector table
initializers much simpler by using this C99 feature of structs:

  struct example
  {
    int a;
    int b;
    int c;
  };

  static struct example my_example = {
    .b = 12,
    .a = 42
  };

which is equivalent to this:

  static struct example my_example = { 42, 12, 0 };

This would greatly improve the readability of the intvects.c file.

(I've already started this and will post a patch in a bit.)

Ted Roth




reply via email to

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