simulavr: invalid io reg

Gast #1713733
Lesenswert?

Hallo,

ich versuche gerade ein Programm in C für den ATMega16 zu schreiben und 
es vorher mit simulavr zu testen. Ich bekomme allerdings Fehlermeldungen 
in der Form "WARNING: **** Attempt to read invalid io reg:". Was mir 
dabei auffällt sind die Zeilen beim Starten von simulavr: "MESSAGE: 
TODO: attach IO Reg '<Registername>' at 0x00.." Ich habe den verdacht, 
dass hier noch irgendwas fehlt, aber ich weiß nicht was. Kennt hier 
jemand schon eine Lösung?

Ich verwende folgende Makefile: 
http://www.mikrocontroller.net/attachment/57243/Makefile
Habe auch schon simulavr-0.1.2.6 kompiliert und probiert.

Der Sourcecode für das Programm, das ich testen will:
1
#include <avr/io.h>
2
#include <avr/interrupt.h>
3

4
#define ADDITION 0
5
#define MULTIPLY 1
6

7
volatile struct
8
{
9
  unsigned operation:1;
10
} status;
11

12
typedef union {
13
        uint8_t i8;
14
        struct {
15
                uint8_t i4l;
16
                uint8_t i4h;
17
        };
18
} convert8to4;
19

20
ISR(INT0_vect)
21
{
22
  uint8_t tmp_sreg; // save global interrupt flag
23
  tmp_sreg = SREG;
24
  
25
  cli(); // disable interrupts
26
  
27
  if (PIND & (1 << PD2)) // is Pin 2 high level?
28
  {
29
    status.operation = MULTIPLY;
30
  }
31
  
32
  else
33
  {
34
    status.operation = ADDITION;
35
  }
36
  
37
  SREG = tmp_sreg; // restore global interrupt flag
38
}
39

40
void SystemInit(void)
41
{  
42
  DDRA = 0x00; // set Port A input
43
  DDRB = 0xff; // set Port B output
44
  DDRD &= 0xff & (0 << PD2); // set Pin 2 of Port D input
45
  status.operation = ADDITION;
46
  
47
  MCUCR |= (0 << ISC01) | (1 << ISC00); // any logical change triggers
48
  GICR |= (1 << INT0); // external interrupt enabled
49
  sei(); // global interrupt enable
50
}
51

52
int main(void)
53
{
54
  convert8to4 port_a;
55
  SystemInit();
56
  
57
  while (1)
58
  {
59
    port_a.i8 = PINA;
60
    
61
    if (status.operation == ADDITION)
62
    {
63
      PORTB = port_a.i4h + port_a.i4l;
64
    }
65
    
66
    else
67
    {
68
      PORTB = port_a.i4h * port_a.i4l;
69
    }
70
  }
71
  
72
  return 0;
73
}

simulavr shell Ausgabe
1
...
2
devsupp.c:354: MESSAGE: TODO: attach IO Reg 'GICR' at 0x005b
3
devsupp.c:354: MESSAGE: TODO: attach IO Reg 'OCR0' at 0x005c
4
devsupp.c:348: MESSAGE: attach: IO Reg 'SPL' at 0x005d: created
5
devsupp.c:332: MESSAGE: attach: IO Reg 'SPH' at 0x005e: ref = 0x005d
6
devsupp.c:348: MESSAGE: attach: IO Reg 'SREG' at 0x005f: created
7
avrcore.c:497: MESSAGE: attach: Internal SRAM from 0x0060 to 0x045f
8
decoder.c:3875: MESSAGE: generating opcode lookup_table
9
main.c:415: MESSAGE: Simulating clock frequency of 4000000 Hz
10
Waiting on port 1212 for gdb client to connect...
11
Connection opened by host 127.0.0.1, port -30333.
12
decoder.c:737: MESSAGE: BREAK POINT: PC = 0x00000065: clock = 37
13
memory.c:232: WARNING: **** Attempt to read invalid io reg: MCUCR at 0x0055
14
memory.c:267: WARNING: **** Attempt to write invalid io reg: MCUCR at 0x0055
15
memory.c:232: WARNING: **** Attempt to read invalid io reg: GICR at 0x005b
16
memory.c:267: WARNING: **** Attempt to write invalid io reg: GICR at 0x005b
Angehängte Dateien:
Gast #1713755
Lesenswert?

Hallo nochmal,

hatte vergessen zu erwähnen, dass ich noch simulavr-disp verwende und 
eben nicht sehe, dass die Register MCUCR und GICR irgendwie gesetzt 
werden. Das kann man auch im Screenshot erkennen.
#1715796
Lesenswert?

Hi,

mit dem "neuen" simulavrxx sollte das besser gehen, soviel zur guten 
Nachricht. ;-) Die schlechte: es gibt aktuell noch keine Release dafür, 
die nach 0.8.006 datiert und erst da ist der ATmega16 überhaupt erst mit 
drin. (d.h. für den, der sich's antun will: lesen Mailingliste, git-Repo 
clonen, selbst compilieren) Und die 2. schlechte Nachricht: 
simulavr-disp gibt es dafür nicht, geht nur eine Abfrage direkt im 
avr-gdb auf die entsprechende Stelle.

Nur mal so ... schönen Tag noch, Thomas

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren