aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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) {