[98740] trunk/dports/cross

landonf at macports.org landonf at macports.org
Sun Oct 14 00:08:00 PDT 2012


Revision: 98740
          http://trac.macports.org//changeset/98740
Author:   landonf at macports.org
Date:     2012-10-14 00:08:00 -0700 (Sun, 14 Oct 2012)
Log Message:
-----------
Add port for simulavr, an AVR microcontroller simulator.

Added Paths:
-----------
    trunk/dports/cross/simulavr/
    trunk/dports/cross/simulavr/Portfile
    trunk/dports/cross/simulavr/files/
    trunk/dports/cross/simulavr/files/patch-msleep
    trunk/dports/cross/simulavr/files/patch-src_systemclock.cpp

Added: trunk/dports/cross/simulavr/Portfile
===================================================================
--- trunk/dports/cross/simulavr/Portfile	                        (rev 0)
+++ trunk/dports/cross/simulavr/Portfile	2012-10-14 07:08:00 UTC (rev 98740)
@@ -0,0 +1,61 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+# $Id$
+
+PortSystem 1.0
+
+name              simulavr
+version           1.0.0
+categories        cross devel
+maintainers       landonf
+description       Simulator for Atmel AVR microcontrollers
+long_description  The SimulAVR program is a simulator for the Atmel AVR family \
+                  of microcontrollers. (ATtiny and ATmega) SimulAVR can be used \
+                  either standalone or as a remote target for avr-gdb. 
+homepage          http://www.nongnu.org/simulavr/
+platforms         darwin
+master_sites      http://savannah.nongnu.org/download/simulavr/
+
+checksums           rmd160  0e9eb32f398943449b564e919765348c32f4c600 \
+                    sha256  39d93faa3eeae2bee15f682dd6a48fb4d4366addd12a2abebb04c99f87809be7
+
+depends_lib       port:avr-binutils \
+                  port:swig-python \
+                  port:swig-tcl
+
+patchfiles        patch-src_systemclock.cpp \
+                  patch-msleep
+
+post-patch {
+    # Hack the swig macro into detecting a modern version of swig
+    reinplace "s|required=1.3.18|required=2.0.8|g" ${worksrcpath}/configure
+
+    # Apply changes from http://savannah.nongnu.org/bugs/?35737 to fix building
+    # against the later avr-libc releases
+    set regexps {
+        "s/SIG_INTERRUPT0/INT0_vect/"
+        "s/SIG_INTERRUPT1/INT1_vect/"
+        "s/SIG_INTERRUPT2/INT2_vect/"
+        "s/SIG_OUTPUT_COMPARE2/TIMER2_COMP_vect/"
+        "s/SIG_OUTPUT_COMPARE2A/TIMER2_COMPA_vect/"
+        "s/SIG_OUTPUT_COMPARE3B/TIMER3_COMPB_vect/"
+        "s/SIG_UART0_RECV/USART0_RX_vect/"
+        "s/SIG_UART0_DATA/USART0_UDRE_vect/"
+        "s/__attribute__((progmem))/PROGMEM/"
+        "s/__attribute__ ((progmem))/PROGMEM/"
+    } 
+
+    fs-traverse fpath ${worksrcpath} {
+        if {[file isfile "${fpath}"]} {
+            foreach r $regexps {
+                reinplace $r $fpath
+            }
+        }
+    }
+
+    reinplace "s|^static char unshifted|static const char unshifted|" ${worksrcpath}/examples/atmel_key/scancodes.h
+    reinplace {s|prog_char shifted\[\]\[2\]|static const char shifted\[\]\[2\] PROGMEM|g} ${worksrcpath}/examples/atmel_key/scancodes.h
+}
+
+configure.args    --with-bfd="${prefix}/avr/host" \
+                  --with-libiberty="${prefix}/avr/host"
+#configure.args    --mandir=${prefix}/share/man


Property changes on: trunk/dports/cross/simulavr/Portfile
___________________________________________________________________
Added: svn:keywords
   + Id

Added: trunk/dports/cross/simulavr/files/patch-msleep
===================================================================
--- trunk/dports/cross/simulavr/files/patch-msleep	                        (rev 0)
+++ trunk/dports/cross/simulavr/files/patch-msleep	2012-10-14 07:08:00 UTC (rev 98740)
@@ -0,0 +1,39 @@
+--- examples/atmel_key/StdDefs.c	2012-10-14 01:14:44.000000000 -0400
++++ examples/atmel_key/StdDefs.c	2012-10-14 01:51:12.000000000 -0400
+@@ -54,16 +54,6 @@
+        sbi(TESTPIN_PORT, TESTPIN_BIT);
+    }
+ 
+-// 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
+-    }
+-
+ //------------------------------------------------------------
+ // void putBCD(INT16S X, CHARU length, CHARU TrailingSpace)
+ //
+--- examples/atmel_key/main.c	2012-10-14 01:14:44.000000000 -0400
++++ examples/atmel_key/main.c	2012-10-14 01:51:53.000000000 -0400
+@@ -5,6 +5,8 @@
+ // PS-1 Keyboard interface test program
+ 
+ #include <avr/io.h>
++#include <util/delay.h>
++
+ #include <stdlib.h>
+ //include <sig-avr.h>
+ #include <avr/interrupt.h>
+@@ -31,7 +33,7 @@
+     {
+         key=getchar();
+         putchar(key);
+-        msleep(10);
++        _delay_ms(10);
+     }
+     return 1;
+ }

Added: trunk/dports/cross/simulavr/files/patch-src_systemclock.cpp
===================================================================
--- trunk/dports/cross/simulavr/files/patch-src_systemclock.cpp	                        (rev 0)
+++ trunk/dports/cross/simulavr/files/patch-src_systemclock.cpp	2012-10-14 07:08:00 UTC (rev 98740)
@@ -0,0 +1,11 @@
+--- src/systemclock.cpp.orig	2012-10-13 23:07:50.000000000 -0400
++++ src/systemclock.cpp	2012-10-13 23:07:56.000000000 -0400
+@@ -67,7 +67,7 @@
+ 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) {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20121014/6d367a75/attachment.html>


More information about the macports-changes mailing list