Hi All,

First, thanks a lot for this great and quite accurate simulator!
Packaging 1.0.0 for our build service https://build.opensuse.org/package/show?package=simulavr&project=CrossToolchain%3Aavr I made 2 patches, the first of which I'd like you to consider for upstream inclusion. Please comment or apply.

        Torsten

-----8<-----
NotSimulatedRegister warns on stdout about each r/w access to each instance. This causes not only the regular startup messages to scroll off screen, but also warnings about config registers used only once during device initialisation. This patch makes simulavr warn only once for every register written, and for the 10 first registers' read-before-write accesses.

Signed-off-by: Torsten Duwe <[email protected]>

--- simulavr-1.0.0/src/rwmem.h.orig     2012-02-12 16:26:38.000000000 +0100
+++ simulavr-1.0.0/src/rwmem.h  2012-02-22 10:03:19.000000000 +0100
@@ -144,6 +144,7 @@ class InvalidMem : public RWMemoryMember
 class NotSimulatedRegister : public RWMemoryMember {
     private:
         const char * message_on_access;
+        bool have_warned;

     public:
         NotSimulatedRegister(const char * message_on_access);
--- simulavr-1.0.0/src/rwmem.cpp.orig   2012-02-12 16:26:38.000000000 +0100
+++ simulavr-1.0.0/src/rwmem.cpp        2012-02-22 10:03:19.000000000 +0100
@@ -125,15 +125,22 @@ void InvalidMem::set(unsigned char c) {
 }

 NotSimulatedRegister::NotSimulatedRegister(const char * message_on_access_)
-    : message_on_access(message_on_access_)  {}
+    : message_on_access(message_on_access_)  {have_warned = false;}

 unsigned char NotSimulatedRegister::get() const {
-    avr_warning(message_on_access);
+    static unsigned warn_count = 0;
+
+    if(!have_warned) {
+        if (warn_count++ < 10)
+         avr_warning(message_on_access);
+    }
     return 0;
 }

 void NotSimulatedRegister::set(unsigned char c) {
-    avr_warning(message_on_access);
+    if(!have_warned)
+        avr_warning(message_on_access);
+    have_warned = true;
 }



_______________________________________________
Simulavr-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/simulavr-devel

Reply via email to