From: Michel Pollet <buserror@gmail.com>
Date: Tue, 15 Sep 2015 13:34:29 +0000 (+0100)
Subject: ioport: Don't crash if core defition is incomplete
X-Git-Tag: v1.6~51
X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=698aa1aac0a15eeeb0baab67862d67675d2ad029;p=sx%2Fsimavr.git

ioport: Don't crash if core defition is incomplete

This is not something that happends on existing cores, but can be
annoying when defining a new one.

Signed-off-by: Michel Pollet <buserror@gmail.com>
---

diff --git a/simavr/sim/avr_ioport.c b/simavr/sim/avr_ioport.c
index 14fabce..edbdf50 100644
--- a/simavr/sim/avr_ioport.c
+++ b/simavr/sim/avr_ioport.c
@@ -247,6 +247,10 @@ static	avr_io_t	_io = {
 
 void avr_ioport_init(avr_t * avr, avr_ioport_t * p)
 {
+	if (!p->r_port) {
+		printf("skipping PORT%c for core %s\n", p->name, avr->mmcu);
+		return;
+	}
 	p->io = _io;
 //	printf("%s PIN%c 0x%02x DDR%c 0x%02x PORT%c 0x%02x\n", __FUNCTION__,
 //		p->name, p->r_pin,