aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qa-slave-shield.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/qa-slave-shield.cpp')
-rw-r--r--examples/qa-slave-shield.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/examples/qa-slave-shield.cpp b/examples/qa-slave-shield.cpp
index fcee9cf..b395cca 100644
--- a/examples/qa-slave-shield.cpp
+++ b/examples/qa-slave-shield.cpp
@@ -37,9 +37,14 @@ void loop() {
}
}
-
-int main(void) {
+// 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)
+{
setup();
while (1) {
@@ -47,3 +52,4 @@ int main(void) {
}
return 0;
}
+