diff options
author | mef <mef> | 2014-08-29 04:40:06 +0000 |
---|---|---|
committer | mef <mef> | 2014-08-29 04:40:06 +0000 |
commit | cfdf5b39ea87add4acb911ae38e52fceff1ccf0e (patch) | |
tree | fb0861c2e4e3345f42f0515ac7818aff45223110 /emulators | |
parent | 07460fe43c3c4c24ad9995c9104a133cf8d3ebb0 (diff) | |
download | pkgsrc-cfdf5b39ea87add4acb911ae38e52fceff1ccf0e.tar.gz |
(pkgsrc)
simulavr asks for libiberty.a.
With avr-gcc 4.5.3 and avr-binutils-2.23.2, binutils is installing
libiberty.a
But with new binutils-2.24, it won't install libiberty. Instead,
avr-gcc-4.8.3 will provied libiberty.
Makefile (of simulavr) now has pointer to PATH of libiberty now
as:
CONFIGURE_ARGS+= --with-libiberty=${PREFIX}/lib/gcc/avr
(Add patches)
patch-src_systemclock_cpp (rename from patch-src_systemclock.cpp)
patch-src_systemclock_h
patch-src_traceval_cpp
patch-src_traceval_h
clang flags as resize unresolved reference,
backport from git repository (as of 2013-09-15).
patch-examples_atmel_key_StdDefs_c Status: Locally Added
passing argument 1 of 'strlen' differ in signedness [-Wpointer-sign]
Diffstat (limited to 'emulators')
-rw-r--r-- | emulators/simulavr/MESSAGE | 11 | ||||
-rw-r--r-- | emulators/simulavr/Makefile | 7 | ||||
-rw-r--r-- | emulators/simulavr/PLIST | 2 | ||||
-rw-r--r-- | emulators/simulavr/distinfo | 10 | ||||
-rw-r--r-- | emulators/simulavr/patches/patch-configure | 2 | ||||
-rw-r--r-- | emulators/simulavr/patches/patch-doc_simulavr_texinfo | 17 | ||||
-rw-r--r-- | emulators/simulavr/patches/patch-examples_atmel_key_StdDefs_c | 40 | ||||
-rw-r--r-- | emulators/simulavr/patches/patch-examples_atmel_key_scancodes.h | 2 | ||||
-rw-r--r-- | emulators/simulavr/patches/patch-regress_timertest_timer_16bit.c | 2 | ||||
-rw-r--r-- | emulators/simulavr/patches/patch-src_Makefile.in | 2 | ||||
-rw-r--r-- | emulators/simulavr/patches/patch-src_systemclock.cpp | 13 | ||||
-rw-r--r-- | emulators/simulavr/patches/patch-src_systemclock_cpp | 223 | ||||
-rw-r--r-- | emulators/simulavr/patches/patch-src_systemclock_h | 78 | ||||
-rw-r--r-- | emulators/simulavr/patches/patch-src_traceval_cpp | 126 | ||||
-rw-r--r-- | emulators/simulavr/patches/patch-src_traceval_h | 88 |
15 files changed, 583 insertions, 40 deletions
diff --git a/emulators/simulavr/MESSAGE b/emulators/simulavr/MESSAGE new file mode 100644 index 00000000000..e0ad5fb0a45 --- /dev/null +++ b/emulators/simulavr/MESSAGE @@ -0,0 +1,11 @@ +=========================================================================== +$NetBSD: MESSAGE,v 1.1 2014/08/29 04:40:06 mef Exp $ +Various README files are installed at following locations: + ${PREFIX}/share/doc/simulvar/README + ${PREFIX}/share/doc/simulvar/README.gdb + ${PREFIX}/share/doc/simulvar/examples/{topics}/README +Also, please read the 'info' at the node of SimulAVR. + +The introduction of simulAVR with avr-gdb, see following URL: + http://www.nongnu.org/simulavr/intro.html +=========================================================================== diff --git a/emulators/simulavr/Makefile b/emulators/simulavr/Makefile index 0bb12e95a6d..819c87cf514 100644 --- a/emulators/simulavr/Makefile +++ b/emulators/simulavr/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.23 2014/06/13 03:41:46 dsainty Exp $ +# $NetBSD: Makefile,v 1.24 2014/08/29 04:40:06 mef Exp $ # DISTNAME= simulavr-1.0.0 -PKGREVISION= 1 +PKGREVISION= 2 CATEGORIES= emulators MASTER_SITES= http://download.savannah.gnu.org/releases/simulavr/ @@ -16,6 +16,7 @@ BUILD_DEPENDS+= avr-libc-[0-9]*:../../cross/avr-libc CONFIGURE_ARGS+= --disable-tests CONFIGURE_ARGS+= --enable-python=python${PYVERSSUFFIX} CONFIGURE_ARGS+= --with-bfd=${PREFIX}/avr +CONFIGURE_ARGS+= --with-libiberty=${PREFIX}/lib/gcc/avr CONFIGURE_ENV+= TEX=no # Following line does not work yet (examples/python directory) @@ -86,11 +87,9 @@ BUILDLINK_TRANSFORM+= rm:-Werror .include "../../cross/avr-binutils/buildlink3.mk" .include "../../cross/avr-gcc/buildlink3.mk" -#.include "../../cross/avr-libc/buildlink3.mk" .include "../../devel/swig/buildlink3.mk" .include "../../mk/curses.buildlink3.mk" .include "../../lang/python/pyversion.mk" .include "../../lang/${PYPACKAGE}/buildlink3.mk" -#include "../../lang/tcl-itcl/buildlink3.mk" .include "../../lang/tcl/buildlink3.mk" .include "../../mk/bsd.pkg.mk" diff --git a/emulators/simulavr/PLIST b/emulators/simulavr/PLIST index 5be1d77710c..97e7aed61aa 100644 --- a/emulators/simulavr/PLIST +++ b/emulators/simulavr/PLIST @@ -1,4 +1,4 @@ -@comment $NetBSD: PLIST,v 1.4 2013/09/12 06:20:35 mef Exp $ +@comment $NetBSD: PLIST,v 1.5 2014/08/29 04:40:06 mef Exp $ bin/simulavr include/simulavr/adcpin.h include/simulavr/application.h diff --git a/emulators/simulavr/distinfo b/emulators/simulavr/distinfo index 036c4ecc9ac..a8b6f824d2e 100644 --- a/emulators/simulavr/distinfo +++ b/emulators/simulavr/distinfo @@ -1,11 +1,15 @@ -$NetBSD: distinfo,v 1.9 2014/06/13 04:06:26 dsainty Exp $ +$NetBSD: distinfo,v 1.10 2014/08/29 04:40:06 mef Exp $ SHA1 (simulavr-1.0.0.tar.gz) = e7cacc74be974793bd9c18330ec8d128fbd17d42 RMD160 (simulavr-1.0.0.tar.gz) = 0e9eb32f398943449b564e919765348c32f4c600 Size (simulavr-1.0.0.tar.gz) = 1013014 bytes SHA1 (patch-configure) = 8fe7c24d17ded8a5b53688f5d35b4aaf55e6c830 -SHA1 (patch-doc_simulavr_texinfo) = b2d169f24623c090038a6d4196f284ae9a611831 +SHA1 (patch-doc_simulavr_texinfo) = ce5615f6e64d4be535b056bd8d3377b1f7a4a5d6 +SHA1 (patch-examples_atmel_key_StdDefs_c) = 73a89da0144d1d0cc2c678476270ea1f79300089 SHA1 (patch-examples_atmel_key_scancodes.h) = f7f6d3f2da8eec4cf9b52800a499bd8300545bc0 SHA1 (patch-regress_timertest_timer_16bit.c) = 81ee86847fd4d40817b2f4bf01e03aca86856f3c SHA1 (patch-src_Makefile.in) = 28354fe97e521b528b6f6d804b7b750d7c63062f -SHA1 (patch-src_systemclock.cpp) = 2e259583d2bdf5003b80b3ebebe81154c68d82bd +SHA1 (patch-src_systemclock_cpp) = 91535a11446dade72752dd0d549d4a605c5e90bc +SHA1 (patch-src_systemclock_h) = fce9df95336b02b3152ec9b162a085c8c4b20283 +SHA1 (patch-src_traceval_cpp) = a92597bd935916fa0ec366b9187df33f075a7c83 +SHA1 (patch-src_traceval_h) = 140fc29e4879d1a4d9ad650ce8eb0be6939e1aae diff --git a/emulators/simulavr/patches/patch-configure b/emulators/simulavr/patches/patch-configure index 8824b4017ce..4e7dff33a0a 100644 --- a/emulators/simulavr/patches/patch-configure +++ b/emulators/simulavr/patches/patch-configure @@ -1,4 +1,4 @@ -$NetBSD: patch-configure,v 1.1 2013/09/12 06:20:35 mef Exp $ +$NetBSD: patch-configure,v 1.2 2014/08/29 04:40:06 mef Exp $ => Checking for portability problems in extracted files ERROR: [check-portability.awk] => Found test ... == ...: diff --git a/emulators/simulavr/patches/patch-doc_simulavr_texinfo b/emulators/simulavr/patches/patch-doc_simulavr_texinfo index 4090b8834d4..e66009a4a04 100644 --- a/emulators/simulavr/patches/patch-doc_simulavr_texinfo +++ b/emulators/simulavr/patches/patch-doc_simulavr_texinfo @@ -1,4 +1,4 @@ -$NetBSD: patch-doc_simulavr_texinfo,v 1.2 2014/06/13 04:06:26 dsainty Exp $ +$NetBSD: patch-doc_simulavr_texinfo,v 1.3 2014/08/29 04:40:06 mef Exp $ Add directory entry information. Without this, ${PREFIX}/info/dir won't be updated by install-info. Typical error message will be: @@ -7,11 +7,9 @@ won't be updated by install-info. Typical error message will be: install-info: warning: no info dir entry in `./work/simulavr-1.0.0/doc/simulavr.info' ---- -Remove @hfill - not supported by gtexinfo 5+ - --- doc/simulavr.texinfo.orig 2012-02-13 00:26:38.000000000 +0900 +++ doc/simulavr.texinfo 2013-08-14 14:04:34.000000000 +0900 -@@ -36,6 +36,11 @@ +@@ -36,6 +36,11 @@ by the Free Software Foundation. @end copying @@ -23,14 +21,3 @@ Remove @hfill - not supported by gtexinfo 5+ @titlepage @title SimulAVR - an AVR simulation framework @subtitle A simulator for the Atmel AVR family of microcontrollers. -@@ -44,8 +49,8 @@ - - @c The following two commands start the copyright page. - @page --@hfill Send bugs and comments on SimulAVR to@* --@hfill @w{@email{simulavr-devel@@nongnu.org}} -+Send bugs and comments on SimulAVR to@* -+@w{@email{simulavr-devel@@nongnu.org}} - @vskip 0pt plus 1filll - @insertcopying - @end titlepage diff --git a/emulators/simulavr/patches/patch-examples_atmel_key_StdDefs_c b/emulators/simulavr/patches/patch-examples_atmel_key_StdDefs_c new file mode 100644 index 00000000000..d404d0470a3 --- /dev/null +++ b/emulators/simulavr/patches/patch-examples_atmel_key_StdDefs_c @@ -0,0 +1,40 @@ +$NetBSD: patch-examples_atmel_key_StdDefs_c,v 1.1 2014/08/29 04:40:06 mef Exp $ + +StdDefs.c: In function 'putstr': +StdDefs.c:120:4: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness [-Wpointer-sign] + for (j = 0; j <= strlen(s); j++) + ^ +In file included from StdDefs.c:10:0: +/usr/pkg/avr/include/string.h:133:15: note: expected 'const char *' but argument is of type 'CHARU *' + extern size_t strlen(const char *) __ATTR_PURE__; + +--- /export/WRKOBJDIR/wip/simulavr/work/simulavr-1.0.0/examples/atmel_key/StdDefs.c 2014-06-20 23:24:10.000000000 +0900 ++++ ./examples/atmel_key/StdDefs.c 2014-06-20 12:31:14.000000000 +0900 +@@ -55,13 +55,11 @@ + } + + // Delay in 1/10's of a millisecond +-void msleep(INT16U ms) +- { /* This loop does not work with optimization != 0. Therefore we use +- avr-libc _delay routines K. Schwichtenberg +- INT16S i,j; +- for (i = 1; i < ms; i++) +- for (j = 1; j < ONETENTH_MS; j++); / * to give 1/10 ms*/ +- _delay_ms(ms); // Changed K. Schwichtenberg ++// Does not work with -O0, use -O1, even for debugging. ++void msleep(INT16U ms10) ++ { ++ for( ; ms10; --ms10) ++ _delay_ms(0.1); + } + + //------------------------------------------------------------ +@@ -117,7 +115,7 @@ + void putstr(CHARU *s) + { + int j; +- for (j = 0; j <= strlen(s); j++) ++ for (j = 0; j <= strlen((char*)s); j++) + putchar(*(s + j)); + CRLF(); + } diff --git a/emulators/simulavr/patches/patch-examples_atmel_key_scancodes.h b/emulators/simulavr/patches/patch-examples_atmel_key_scancodes.h index 93cb2e1a3f1..e2da286cd13 100644 --- a/emulators/simulavr/patches/patch-examples_atmel_key_scancodes.h +++ b/emulators/simulavr/patches/patch-examples_atmel_key_scancodes.h @@ -1,4 +1,4 @@ -$NetBSD: patch-examples_atmel_key_scancodes.h,v 1.1 2013/09/12 06:20:35 mef Exp $ +$NetBSD: patch-examples_atmel_key_scancodes.h,v 1.2 2014/08/29 04:40:06 mef Exp $ In file included from kb.c:14:0: scancodes.h:19:1: warning: missing braces around initializer diff --git a/emulators/simulavr/patches/patch-regress_timertest_timer_16bit.c b/emulators/simulavr/patches/patch-regress_timertest_timer_16bit.c index 7b554e65f61..4addd356c31 100644 --- a/emulators/simulavr/patches/patch-regress_timertest_timer_16bit.c +++ b/emulators/simulavr/patches/patch-regress_timertest_timer_16bit.c @@ -1,4 +1,4 @@ -$NetBSD: patch-regress_timertest_timer_16bit.c,v 1.1 2013/09/12 06:20:35 mef Exp $ +$NetBSD: patch-regress_timertest_timer_16bit.c,v 1.2 2014/08/29 04:40:06 mef Exp $ error: attempt to use poisoned "VARNAME" diff --git a/emulators/simulavr/patches/patch-src_Makefile.in b/emulators/simulavr/patches/patch-src_Makefile.in index 9c13bd838ce..21463169578 100644 --- a/emulators/simulavr/patches/patch-src_Makefile.in +++ b/emulators/simulavr/patches/patch-src_Makefile.in @@ -1,4 +1,4 @@ -$NetBSD: patch-src_Makefile.in,v 1.1 2013/09/12 06:20:35 mef Exp $ +$NetBSD: patch-src_Makefile.in,v 1.2 2014/08/29 04:40:06 mef Exp $ /usr/pkg/bin/swig -c++ -python -Ipython -o pysim ... ... diff --git a/emulators/simulavr/patches/patch-src_systemclock.cpp b/emulators/simulavr/patches/patch-src_systemclock.cpp deleted file mode 100644 index b9d7447fc0d..00000000000 --- a/emulators/simulavr/patches/patch-src_systemclock.cpp +++ /dev/null @@ -1,13 +0,0 @@ -$NetBSD: patch-src_systemclock.cpp,v 1.1 2013/09/20 23:05:21 joerg Exp $ - ---- src/systemclock.cpp.orig 2013-09-20 22:35:37.000000000 +0000 -+++ src/systemclock.cpp -@@ -67,7 +67,7 @@ bool MinHeap<Key, Value>::ContainsValue( - template<typename Key, typename Value> - void MinHeap<Key, Value>::Insert(Key k, Value v) - { -- resize(this->size()+1); -+ this->resize(this->size()+1); - for(unsigned i = this->size();;) { - unsigned parent = i/2; - if(parent == 0 || (*this)[parent-1].first < k) { diff --git a/emulators/simulavr/patches/patch-src_systemclock_cpp b/emulators/simulavr/patches/patch-src_systemclock_cpp new file mode 100644 index 00000000000..2bb7798ccb2 --- /dev/null +++ b/emulators/simulavr/patches/patch-src_systemclock_cpp @@ -0,0 +1,223 @@ +$NetBSD: patch-src_systemclock_cpp,v 1.1 2014/08/29 04:40:06 mef Exp $ + +clang flags as resize unresolved reference, +backport from git repository (as of 2013-09-15). + +--- simulavr-1.0.0/src/systemclock.cpp 2012-02-13 00:26:38.000000000 +0900 ++++ src/systemclock.cpp 2013-09-13 09:41:15.000000000 +0900 +@@ -2,7 +2,7 @@ + **************************************************************************** + * + * simulavr - A simulator for the Atmel AVR family of microcontrollers. +- * Copyright (C) 2001, 2002, 2003 Klaus Rudolph ++ * Copyright (C) 2001, 2002, 2003 Klaus Rudolph + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +@@ -28,6 +28,7 @@ + #include "simulationmember.h" + #include "helper.h" + #include "application.h" ++#include "avrdevice.h" + #include "avrerror.h" + + #include "signal.h" +@@ -35,83 +36,78 @@ + + using namespace std; + +- + template<typename Key, typename Value> + MinHeap<Key, Value>::MinHeap() + { +- this->reserve(10); // vector would free&malloc when we keep inserting and removing only 1 element. ++ this->reserve(10); // vector would free&malloc when we keep inserting and removing only 1 element. + } + + template<typename Key, typename Value> + void MinHeap<Key, Value>::RemoveMinimum() + { +- assert(!this->empty()); +- Key k = this->back().first; +- Value v = this->back().second; +- RemoveMinimumAndInsert(k, v); +- this->pop_back(); ++ assert(!this->empty()); ++ Key k = this->back().first; ++ Value v = this->back().second; ++ RemoveMinimumAndInsert(k, v); ++ this->pop_back(); + } + + template<typename Key, typename Value> + bool MinHeap<Key, Value>::ContainsValue(Value v) const + { +- for(unsigned i = 0; i < this->size(); i++) +- { +- std::pair<Key,Value> item = (*this)[i]; +- if(item.second == v) +- return true; +- } +- return false; ++ for(unsigned i = 0; i < this->size(); i++) ++ { ++ std::pair<Key,Value> item = (*this)[i]; ++ if(item.second == v) ++ return true; ++ } ++ return false; + } + + template<typename Key, typename Value> +-void MinHeap<Key, Value>::Insert(Key k, Value v) ++void MinHeap<Key, Value>::InsertInternal(Key k, Value v, unsigned pos) + { +- resize(this->size()+1); +- for(unsigned i = this->size();;) { +- unsigned parent = i/2; +- if(parent == 0 || (*this)[parent-1].first < k) { +- (*this)[i-1].first = k; +- (*this)[i-1].second = v; +- return; +- } +- Key k_temp = (*this)[parent-1].first; +- Value v_temp = (*this)[parent-1].second; +- (*this)[i-1].first = k_temp; +- (*this)[i-1].second = v_temp; +- i = parent; +- } ++ for(unsigned i = pos;;) { ++ unsigned parent = i/2; ++ if(parent == 0 || (*this)[parent-1].first <= k) { ++ (*this)[i-1].first = k; ++ (*this)[i-1].second = v; ++ return; ++ } ++ Key k_temp = (*this)[parent-1].first; ++ Value v_temp = (*this)[parent-1].second; ++ (*this)[i-1].first = k_temp; ++ (*this)[i-1].second = v_temp; ++ i = parent; ++ } + } + + template<typename Key, typename Value> +-void MinHeap<Key, Value>::RemoveMinimumAndInsert(Key k, Value v) ++void MinHeap<Key, Value>::RemoveAtPositionAndInsertInternal(Key k, Value v, unsigned pos) + { +- assert(!this->empty()); +- unsigned i = 1; +- for(;;) { +- unsigned left = 2*i; +- unsigned right = 2*i + 1; +- unsigned smallest = i; +- if(left-1 < this->size() && (*this)[left-1].first < k) +- smallest = left; +- if(right-1 < this->size() && (*this)[right-1].first < k) +- smallest = right; +- if(smallest == i) { +- (*this)[smallest-1].first = k; +- (*this)[smallest-1].second = v; +- return; +- } +- Key k_temp = (*this)[smallest-1].first; +- Value v_temp = (*this)[smallest-1].second; +- (*this)[smallest-1].first = k; +- (*this)[smallest-1].second = v; +- k = k_temp; +- v = v_temp; +- i = smallest; +- } ++ assert(pos < this->size()); ++ unsigned i = pos + 1; ++ for(;;) { ++ unsigned left = 2*i; ++ unsigned right = 2*i + 1; ++ unsigned smallest = i; ++ if(left-1 < this->size() && (*this)[left-1].first < k) ++ smallest = left; ++ if(right-1 < this->size() && (*this)[right-1].first < k && (*this)[right-1].first < (*this)[left-1].first) ++ smallest = right; ++ if(smallest == i) { ++ (*this)[smallest-1].first = k; ++ (*this)[smallest-1].second = v; ++ return; ++ } ++ Key k_temp = (*this)[smallest-1].first; ++ Value v_temp = (*this)[smallest-1].second; ++ (*this)[i-1].first = k_temp; ++ (*this)[i-1].second = v_temp; ++ i = smallest; ++ } + } + +- + SystemClock::SystemClock() { + static int no = 0; + currentTime = 0; +@@ -130,7 +126,6 @@ + } + } + +- + void SystemClock::Add(SimulationMember *dev) { + syncMembers.Insert(currentTime, dev); + } +@@ -153,6 +148,8 @@ + currentTime = syncMembers.begin()->first; + SystemClockOffset nextStepIn_ns = -1; + ++ syncMembers.RemoveMinimum(); ++ + // do a step on simulation member + res = core->Step(untilCoreStepFinished, &nextStepIn_ns); + +@@ -164,9 +161,7 @@ + // be called anymore! + + if(nextStepIn_ns > 0) +- syncMembers.RemoveMinimumAndInsert(nextStepIn_ns, core); +- else +- syncMembers.RemoveMinimum(); ++ syncMembers.Insert(nextStepIn_ns, core); + + // handle async simulation members + amiEnd = asyncMembers.end(); +@@ -180,12 +175,11 @@ + } + + void SystemClock::Rescedule(SimulationMember *sm, SystemClockOffset newTime) { +- MinHeap<SystemClockOffset, SimulationMember *>::iterator ii; + +- for(ii=syncMembers.begin(); ii != syncMembers.end(); ii++) { +- if(ii->second == sm) { +- syncMembers.erase(ii); +- break; ++ for(unsigned i = 0; i < syncMembers.size(); i++) { ++ if(syncMembers[i].second == sm) { ++ syncMembers.RemoveAtPositionAndInsert(newTime+currentTime+1, sm, i); ++ return; + } + } + +@@ -211,6 +205,7 @@ + } + + void SystemClock::Endless() { ++ breakMessage = false; // if we run a second loop, clear break before entering loop + int steps = 0; + + signal(SIGINT, OnBreak); +@@ -227,7 +222,6 @@ + Application::GetInstance()->PrintResults(); + } + +- + void SystemClock::Run(SystemClockOffset maxRunTime) { + int steps = 0; + +@@ -269,4 +263,3 @@ + static SystemClock obj; + return obj; + } +- diff --git a/emulators/simulavr/patches/patch-src_systemclock_h b/emulators/simulavr/patches/patch-src_systemclock_h new file mode 100644 index 00000000000..ed7d2df21a8 --- /dev/null +++ b/emulators/simulavr/patches/patch-src_systemclock_h @@ -0,0 +1,78 @@ +$NetBSD: patch-src_systemclock_h,v 1.1 2014/08/29 04:40:06 mef Exp $ + +clang flags as resize unresolved reference, +backport from git repository (as of 2013-09-15). + +--- simulavr-1.0.0/src/systemclock.h 2012-02-13 00:26:38.000000000 +0900 ++++ src/systemclock.h 2013-09-13 09:41:15.000000000 +0900 +@@ -2,7 +2,7 @@ + **************************************************************************** + * + * simulavr - A simulator for the Atmel AVR family of microcontrollers. +- * Copyright (C) 2001, 2002, 2003 Klaus Rudolph ++ * Copyright (C) 2001, 2002, 2003 Klaus Rudolph + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +@@ -29,26 +29,41 @@ + #include <map> + #include <vector> + +-#include "avrdevice.h" + #include "systemclocktypes.h" + ++class SimulationMember; ++ + /** A heap data structure optimized for obtaining Value of the smallest Key. +- Example MinHeap<SystemClockOffset, SimulationMember*>. */ ++ Example MinHeap<SystemClockOffset, SimulationMember*>. */ + template<typename Key, typename Value> + class MinHeap : public std::vector<std::pair<Key,Value> > + { + public: +- MinHeap(); +- bool IsEmpty() const { return this->empty(); } +- Value GetMinimumKey() const { return this->front().first; } +- Value GetMinimumValue() const { return this->front().second; }; +- void RemoveMinimum(); +- bool ContainsValue(Value v) const; +- void Insert(Key k, Value v); +- void RemoveMinimumAndInsert(Key k, Value v); ++ MinHeap(); ++ bool IsEmpty() const { return this->empty(); } ++ Key GetMinimumKey() const { return this->front().first; } ++ Value GetMinimumValue() const { return this->front().second; }; ++ void RemoveMinimum(); ++ bool ContainsValue(Value v) const; ++ void Insert(Key k, Value v) { ++ this->resize(this->size()+1); ++ InsertInternal(k, v, this->size()); ++ } ++ void RemoveMinimumAndInsert(Key k, Value v) { ++ RemoveAtPositionAndInsertInternal(k, v, 0); ++ } ++ void RemoveAtPositionAndInsert(Key k, Value v, unsigned pos) { ++ if(k < (*this)[pos-1].first) ++ InsertInternal(k, v, pos); ++ else ++ RemoveAtPositionAndInsertInternal(k, v, pos); ++ } ++protected: ++ // These are internal because a bad value of `pos' could violate the binary heap invariant. ++ void InsertInternal(Key k, Value v, unsigned pos); ++ void RemoveAtPositionAndInsertInternal(Key k, Value v, unsigned pos); + }; + +- + //! Class to store and manage the central simulation time + /*! This acts as a time table, a simulation member gets a place on this ordered + table, where it should be called next time, the placement depends on the +@@ -72,7 +87,7 @@ + + protected: + SystemClockOffset currentTime; //!< time in [ns] since start of simulation +- MinHeap<SystemClockOffset, SimulationMember *> syncMembers; //!< earliest first ++ MinHeap<SystemClockOffset, SimulationMember *> syncMembers; //!< earliest first + std::vector<SimulationMember*> asyncMembers; //!< List of asynchron working simulation members, will be called every step! + + public: diff --git a/emulators/simulavr/patches/patch-src_traceval_cpp b/emulators/simulavr/patches/patch-src_traceval_cpp new file mode 100644 index 00000000000..6b187f717ab --- /dev/null +++ b/emulators/simulavr/patches/patch-src_traceval_cpp @@ -0,0 +1,126 @@ +$NetBSD: patch-src_traceval_cpp,v 1.1 2014/08/29 04:40:06 mef Exp $ + +clang flags as resize unresolved reference, +backport from git repository (as of 2013-09-15). + +--- simulavr-1.0.0/src/traceval.cpp 2012-02-13 00:26:38.000000000 +0900 ++++ src/traceval.cpp 2013-09-13 09:41:15.000000000 +0900 +@@ -28,6 +28,7 @@ + #include <stdlib.h> + #include "helper.h" + #include "traceval.h" ++#include "avrdevice.h" + #include "avrerror.h" + #include "systemclock.h" + +@@ -36,7 +37,7 @@ + TraceValue::TraceValue(size_t bits, + const std::string &__name, + const int __index, +- void *_shadow) : ++ const void *_shadow) : + b(bits), + _name(__name), + _index(__index), +@@ -111,15 +112,16 @@ + unsigned nv; + switch (b) { + case 1: +- nv=*(bool*)shadow; break; ++ nv = *(const bool*) shadow; break; + case 8: +- nv=*(uint8_t*)shadow; break; ++ nv = *(const uint8_t*) shadow; break; + case 16: +- nv=*(uint16_t*)shadow; break; ++ nv = *(const uint16_t*) shadow; break; + case 32: +- nv=*(uint32_t*)shadow; break; ++ nv = *(const uint32_t*) shadow; break; + default: + avr_error("Internal error: Unsupported number of bits in TraceValue::cycle()."); ++ break; + } + if (v!=nv) { + f|=CHANGE; +@@ -144,6 +146,26 @@ + f=0; + } + ++char TraceValue::VcdBit(int bitNo) const { ++ if (_written) ++ return (v & (1 << bitNo)) ? '1' : '0'; ++ else ++ return 'x'; ++} ++ ++char TraceValueOutput::VcdBit(int bitNo) const { ++ unsigned val = value(); ++ if(written()) { ++ if(val == Pin::TRISTATE) ++ return 'z'; ++ if((val == Pin::HIGH) || (val == Pin::PULLUP)) ++ return '1'; ++ if(val == Pin::LOW) ++ return '0'; ++ } ++ return 'x'; ++} ++ + TraceValueRegister::~TraceValueRegister() { + for (valmap_t::iterator i = _tvr_values.begin(); i != _tvr_values.end(); i++) + delete i->first; +@@ -360,14 +382,9 @@ + + void DumpVCD::valout(const TraceValue *v) { + osbuffer << 'b'; +- if (v->written()) { +- unsigned val=v->value(); +- for (int i=v->bits()-1; i>=0; i--) +- osbuffer << ((val&(1<<i)) ? '1' : '0'); +- } else { +- for (int i=0; i < v->bits(); i++) +- osbuffer << 'x'; +- } ++ for (int i = v->bits()-1; i >= 0; i--) ++ osbuffer << v->VcdBit(i); ++ + } + + void DumpVCD::flushbuffer(void) { +@@ -726,31 +743,28 @@ + return load(is); + } + +-TraceValue* trace_direct(TraceValueRegister *t, const std::string &name, bool *val) { ++TraceValue* trace_direct(TraceValueRegister *t, const std::string &name, const bool *val) { + TraceValue *tv=new TraceValue(1, t->GetTraceValuePrefix() + name, + -1, val); + t->RegisterTraceValue(tv); + return tv; + } + +-TraceValue* trace_direct(TraceValueRegister *t, const std::string &name, uint8_t +-*val) { ++TraceValue* trace_direct(TraceValueRegister *t, const std::string &name, const uint8_t*val) { + TraceValue* tv=new TraceValue(8, t->GetTraceValuePrefix() + name, + -1, val); + t->RegisterTraceValue(tv); + return tv; + } + +-TraceValue* trace_direct(TraceValueRegister *t, const std::string &name, uint16_t +-*val) { ++TraceValue* trace_direct(TraceValueRegister *t, const std::string &name, const uint16_t*val) { + TraceValue* tv=new TraceValue(16, t->GetTraceValuePrefix() + name, + -1, val); + t->RegisterTraceValue(tv); + return tv; + } + +-TraceValue* trace_direct(TraceValueRegister *t, const std::string &name, uint32_t +-*val) { ++TraceValue* trace_direct(TraceValueRegister *t, const std::string &name, const uint32_t*val) { + TraceValue* tv=new TraceValue(32, t->GetTraceValuePrefix() + name, + -1, val); + t->RegisterTraceValue(tv); diff --git a/emulators/simulavr/patches/patch-src_traceval_h b/emulators/simulavr/patches/patch-src_traceval_h new file mode 100644 index 00000000000..b16de33e655 --- /dev/null +++ b/emulators/simulavr/patches/patch-src_traceval_h @@ -0,0 +1,88 @@ +$NetBSD: patch-src_traceval_h,v 1.1 2014/08/29 04:40:06 mef Exp $ + +clang flags as resize unresolved reference, +backport from git repository (as of 2013-09-15). + +--- simulavr-1.0.0/src/traceval.h 2012-02-13 00:26:38.000000000 +0900 ++++ src/traceval.h 2013-09-13 09:41:15.000000000 +0900 +@@ -106,8 +106,9 @@ + TraceValue(size_t bits, + const std::string &_name, + const int __index=-1, +- void* shadow=0); +- ++ const void* shadow=0); ++ virtual ~TraceValue() {} ++ + //! Give number of bits for this value. Max 32. + size_t bits() const; + +@@ -177,6 +178,9 @@ + flags. */ + virtual void dump(Dumper &d); + ++ /*! Give back VCD coding of a bit */ ++ virtual char VcdBit(int bitNo) const; ++ + protected: + //! Clear all access flags + void clear_flags(); +@@ -191,7 +195,7 @@ + const unsigned b; + + //! shadow reg, if used +- void *shadow; ++ const void *shadow; + + //! The value itself + unsigned v; +@@ -207,6 +211,17 @@ + bool _enabled; + }; + ++class TraceValueOutput: public TraceValue { ++ ++ public: ++ /*! Generate a new uninitialized trace value of pin output driver */ ++ TraceValueOutput(const std::string &_name): TraceValue(1, _name) {} ++ ++ /*! Give back VCD coding of pin output driver */ ++ virtual char VcdBit(int bitNo) const; ++ ++}; ++ + class AvrDevice; + class TraceValueRegister; + +@@ -453,7 +468,7 @@ + if(_tvr_scopename.length() > 0) + _tvr_scopeprefix += _tvr_scopename + "."; + } +- ~TraceValueRegister(); ++ virtual ~TraceValueRegister(); + + //! Returns the scope prefix + const std::string GetTraceValuePrefix(void) { return _tvr_scopeprefix; } +@@ -511,18 +526,18 @@ + + //! Register a directly traced bool value + /*! \return pointer to the new registered TraceValue */ +-TraceValue *trace_direct(TraceValueRegister *t, const std::string &name, bool *val); ++TraceValue *trace_direct(TraceValueRegister *t, const std::string &name, const bool *val); + + //! Register a directly traced byte value + /*! \return pointer to the new registered TraceValue */ +-TraceValue* trace_direct(TraceValueRegister *t, const std::string &name, uint8_t *val); ++TraceValue* trace_direct(TraceValueRegister *t, const std::string &name, const uint8_t *val); + + //! Register a directly traced 16bit word value + /*! \return pointer to the new registered TraceValue */ +-TraceValue* trace_direct(TraceValueRegister *t, const std::string &name, uint16_t *val); ++TraceValue* trace_direct(TraceValueRegister *t, const std::string &name, const uint16_t *val); + + //! Register a directly traced 32bit word value + /*! \return pointer to the new registered TraceValue */ +-TraceValue* trace_direct(TraceValueRegister *t, const std::string &name, uint32_t *val); ++TraceValue* trace_direct(TraceValueRegister *t, const std::string &name, const uint32_t *val); + + #endif |