on master help sign in
Added rts/arudino/idris_main.c. It is similar to the standard idris_main.c except it does not attempt to handle argv/argc and it also calls the Arduino init() function.

Additionally, all the rts .c files are now included in the data-files section of the idris.cabal file. When using Idris to cross-compile, we need to recompile the RTS for the target platform. We do not know what platforms might be targeted in advance, so we need to have all the RTS source files available at compile time.

commit58eed038fe9d94b2b3c8a6ccf3bb1853afb06d5c authorstepcut <jeremy@n-heptane.com> dateWed 16 Jul 2014, 15:28 (12 years ago) parent4382706
2 files changed+47−1
idris.cabal+18−1 rts/arduino/idris_main.c+29
idris.cabal+18−1
@@ -52,12 +52,28 @@ Data-files: idrisdoc/styles.css
5252 jsrts/Runtime-node.js
5353 jsrts/jsbn/jsbn.js
5454 jsrts/jsbn/LICENSE
55+ rts/arduino/idris_main.c
56+ rts/idris_bitstring.c
57+ rts/idris_bitstring.h
58+ rts/idris_gc.c
5559 rts/idris_gc.h
60+ rts/idris_gmp.c
5661 rts/idris_gmp.h
62+ rts/idris_heap.c
63+ rts/idris_heap.h
5764 rts/idris_main.c
58− rts/idris_rts.h
65+ rts/idris_net.c
5966 rts/idris_net.h
67+ rts/idris_opts.c
68+ rts/idris_opts.h
69+ rts/idris_rts.c
70+ rts/idris_rts.h
71+ rts/idris_stats.c
72+ rts/idris_stats.h
73+ rts/idris_stdfgn.c
6074 rts/idris_stdfgn.h
75+ rts/mini-gmp.c
76+ rts/mini-gmp.h
6177 rts/libtest.c
6278
6379Extra-source-files:
@@ -66,6 +82,7 @@ Extra-source-files:
6682
6783 rts/*.c
6884 rts/*.h
85+ rts/arduino/*.c
6986 rts/windows/*.c
7087 rts/Makefile
7188
rts/arduino/idris_main.cnew file+29
@@ -0,0 +1,29 @@
1+#include "idris_opts.h"
2+#include "idris_stats.h"
3+#include "idris_rts.h"
4+#include "Arduino.h"
5+
6+// The default options should give satisfactory results under many circumstances.
7+RTSOpts opts = {
8+ .init_heap_size = 128,
9+ .max_stack_size = 128,
10+ .show_summary = 0
11+};
12+
13+// no argv or argc
14+int main() {
15+ init(); // arduino init function
16+
17+ VM* vm = init_vm(opts.max_stack_size, opts.init_heap_size, 1);
18+ _idris__123_runMain0_125_(vm, NULL);
19+
20+#ifdef IDRIS_DEBUG
21+ if (opts.show_summary) {
22+ idris_gcInfo(vm, 1);
23+ }
24+#endif
25+
26+ Stats stats = terminate(vm);
27+
28+ return 0;
29+}