aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxttocs <andy.g.scott@gmail.com>2010-06-21 19:30:04 -0400
committerPerry Hung <iperry@alum.mit.edu>2010-06-23 19:23:45 -0400
commit70a18f96b6d55d23ce58ab40ffb61f172c8f6c73 (patch)
tree2744db4b1bdcf6a936e881ba172dfeca8d33de78
parentd7d3dfe1a9ba483047d7a9835d526f540e00c417 (diff)
downloadlibrambutan-70a18f96b6d55d23ce58ab40ffb61f172c8f6c73.tar.gz
librambutan-70a18f96b6d55d23ce58ab40ffb61f172c8f6c73.zip
Support for Arduino's LiquidCrystal lib, which may help for a few other libs too.
Signed-off-by: Perry Hung <iperry@alum.mit.edu>
-rw-r--r--wirish/Print.h1
-rw-r--r--wirish/main.cxx7
2 files changed, 7 insertions, 1 deletions
diff --git a/wirish/Print.h b/wirish/Print.h
index 72208b4..9c03978 100644
--- a/wirish/Print.h
+++ b/wirish/Print.h
@@ -20,6 +20,7 @@
#ifndef Print_h
#define Print_h
+#include <libmaple_types.h>
#include <stdio.h> // for size_t
#define DEC 10
diff --git a/wirish/main.cxx b/wirish/main.cxx
index d13e2eb..f0158f8 100644
--- a/wirish/main.cxx
+++ b/wirish/main.cxx
@@ -22,9 +22,14 @@
* THE SOFTWARE.
* ****************************************************************************/
+// Force init to be called *first*, i.e. before static object allocation.
+// Otherwise, statically allocated object that need libmaple may fail.
+ __attribute__(( constructor )) void premain() {
+ init();
+}
+
int main(void)
{
- init();
setup();
while (1) {