So, maybe you could have a look on two differents projects : - Ocapic http://www.algo-prog.info/ocapic/web/index.php?id=OCAPIC (1) - Ocamlcc https://github.com/ocaml-bytes/ocamlcc (2) Ocapic (1) provide a caml virtual machine for a PIC, and tools to minimise code size. Ocamlcc (2) is a tool to generate plain C code from ocaml bytecode. There's risks that the code could be two large, but it can work. Of course, these way are slower because of bytecode. 2015-06-26 11:57 GMT+02:00 xavier deschuyteneer < xavier.deschuyteneer@gmail.com>: > When i say embedded system, i really mean embedded system running on a > minimal Linux with low power CPU, not so much flash, same for the RAM. > It's similar to think that a raspberry pi is a IOT. It's not, it's mini > computer on ARM platform. In my case, it's really an embedded system, low > cpu, not so much ram, neither flash. > > And btw i know exactly how yocto works because i build myself our OS. And > that's not exactly python, it's a mix between python and bash. > We build two different distributions: one ARM and one x86 (for emulation > purpose, valgrind, etc.). and all tools(chains) associated. > This ocaml software needs to be integrated in this workflow. > > Right now, we use plain C, and yes cross compilation is a specific setup, > but it's not difficult to achieve. > The advantage right now to use cross compilation are: > We can use all the power of a real computer to build/debug/code. > I can use all the interfaces that my computer have and not my end > (embedded) system: multiple ethernet cards, bluetooth, usb, etc. > I have multiple projects to manage and all of them are not embedded > related. > > Thanks for your answer and the time spent for my question :-) > > TL;DR: i need to cross compile ocaml code to arm because my device is not > powerful enough and that's not possible in industrial purpose to change > that. > > > Xavier Deschuyteneer > > 2015-06-26 5:04 GMT+02:00 Berke Durak : > >> On Tue, Jun 23, 2015 at 6:32 AM, Markus Weißmann >> wrote: >> > >> > I can offer experience in the following cases: >> > 1) If your system is powerful enough (e.g. rasperry pi), you can just >> install the ocaml toolchain on your system and develop there on your target >> system. >> >> Seconded. We did almost that for one of our projects and it works >> pretty well. The difference is that we didn't use QEmu, but two of >> our custom Q7 board (based on a Zynq ARM Cortex A9 with 512 MB RAM, >> see http://xiphos.com/products/q7-processor/ ). >> >> We use Yocto to generate two versions of a Linux system: the target >> system, and a much larger version that contains developer tools (C >> compiler, m4, etc.) The development system runs from microSD cards, >> and takes the better part of a gigabyte, while the target system has >> to run from < 64 megs of flash. The required run-time dependencies of >> the target system have to be manually configured in the Yocto recipes. >> >> We then manually install opam on the developer board, and use it to >> compile our OCaml code. The generated native ARM executables are then >> packaged into .ipks and transferred to the target Q7 board (connected >> to actual hardware: >> http://www.ghgsat.com/wp-content/uploads/2015/03/Payload-Selfie.jpg ) >> The packaging is done using a simple shell script that invokes ar and >> tar. >> >> We did try using QEmu but it's significantly slower, however it may >> come into play as automating the build process (using a virtual >> machine or dedicated hardware) is on our to do list, and build time >> isn't as important when it's a nightly automated build. >> >> Initially we looked into using a cross-compiler but we decided that >> being able to use Opam largely outweighs any possible benefit we could >> get from cross-compiling. And cross-compiling is often a source of >> headaches, even when compiling plain old C. We would have to write a >> lot of Yocto recipes to get it running. Note that Yocto is written in >> a progarmming language called Python and requires recipes to be >> expressed mostly the same language. >> >> To conclude, as powerful ARM systems are very cheap and plentiful >> these days, and since the convenience of Opam is immense, I'm not sure >> there is much incentive in using a cross-compiler. BTW, is there a >> maintained ARM cross-compiler? >> -- >> Berke Durak >> >> -- >> Caml-list mailing list. Subscription management and archives: >> https://sympa.inria.fr/sympa/arc/caml-list >> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >> Bug reports: http://caml.inria.fr/bin/caml-bugs >> > > -- --------------------- https://twitter.com/#!/ontologiae/ http://linuxfr.org/users/montaigne