mirror of
https://github.com/ilyakooo0/Idris-dev.git
synced 2024-09-11 08:55:23 +03:00
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.
This commit is contained in:
parent
4382706ab4
commit
58eed038fe
19
idris.cabal
19
idris.cabal
@ -52,12 +52,28 @@ Data-files: idrisdoc/styles.css
|
||||
jsrts/Runtime-node.js
|
||||
jsrts/jsbn/jsbn.js
|
||||
jsrts/jsbn/LICENSE
|
||||
rts/arduino/idris_main.c
|
||||
rts/idris_bitstring.c
|
||||
rts/idris_bitstring.h
|
||||
rts/idris_gc.c
|
||||
rts/idris_gc.h
|
||||
rts/idris_gmp.c
|
||||
rts/idris_gmp.h
|
||||
rts/idris_heap.c
|
||||
rts/idris_heap.h
|
||||
rts/idris_main.c
|
||||
rts/idris_rts.h
|
||||
rts/idris_net.c
|
||||
rts/idris_net.h
|
||||
rts/idris_opts.c
|
||||
rts/idris_opts.h
|
||||
rts/idris_rts.c
|
||||
rts/idris_rts.h
|
||||
rts/idris_stats.c
|
||||
rts/idris_stats.h
|
||||
rts/idris_stdfgn.c
|
||||
rts/idris_stdfgn.h
|
||||
rts/mini-gmp.c
|
||||
rts/mini-gmp.h
|
||||
rts/libtest.c
|
||||
|
||||
Extra-source-files:
|
||||
@ -66,6 +82,7 @@ Extra-source-files:
|
||||
|
||||
rts/*.c
|
||||
rts/*.h
|
||||
rts/arduino/*.c
|
||||
rts/windows/*.c
|
||||
rts/Makefile
|
||||
|
||||
|
29
rts/arduino/idris_main.c
Normal file
29
rts/arduino/idris_main.c
Normal file
@ -0,0 +1,29 @@
|
||||
#include "idris_opts.h"
|
||||
#include "idris_stats.h"
|
||||
#include "idris_rts.h"
|
||||
#include "Arduino.h"
|
||||
|
||||
// The default options should give satisfactory results under many circumstances.
|
||||
RTSOpts opts = {
|
||||
.init_heap_size = 128,
|
||||
.max_stack_size = 128,
|
||||
.show_summary = 0
|
||||
};
|
||||
|
||||
// no argv or argc
|
||||
int main() {
|
||||
init(); // arduino init function
|
||||
|
||||
VM* vm = init_vm(opts.max_stack_size, opts.init_heap_size, 1);
|
||||
_idris__123_runMain0_125_(vm, NULL);
|
||||
|
||||
#ifdef IDRIS_DEBUG
|
||||
if (opts.show_summary) {
|
||||
idris_gcInfo(vm, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
Stats stats = terminate(vm);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user