stevenvar / OMicroB

An OCaml generic virtual machine for microcontrollers
Other
138 stars 23 forks source link

Can port to ARM? #14

Open hexiangdong2017 opened 5 years ago

stevenvar commented 5 years ago

Yeah its a work in progress for BBC Micro:bit (which is based on ARM Cortex-M0)!

Vertmo commented 4 years ago

The mentionned port is in progress on #25

Naereen commented 6 days ago

Hi there, Do you think this port to ARM micro:bit could work (without too much efforts) for Numworks calculators? They run a ARMv7 Cortex-M 32bit processor, with 256 kb of Ram.

OMicroB seems to be my last hope in trying to cross-compile OCaml code to their bare-metal architecture... See https://discuss.ocaml.org/t/could-we-add-a-tiny-ocaml-interpreter-to-numworks-graphical-calculators/7652/11 for the ongoing discussion.

Thanks in advance! @Naereen

Vertmo commented 5 days ago

Hi @Naereen, this is an interesting questions. I think porting OMicroB itself to numworks calculator would not be too difficult, as long as you can write and load an arbitrary C program on numworks calculator, which I gather is possible ?

However, this might not give you exactly what you're looking for: from looking at the discuss post, it seems that you want an embedded interpreter à-la MicroPython. OMicroB is not that, its a runtime environment for OCaml bytecode (embedded in the program). To get what you want, you would need to add a parser and compiler for OCaml expressions, and connect the virtual machine to its output. Since the OCaml compiler is itself written in OCaml, you could probably execute it (or a simplified version of it) using OMicroB. Then, the remaining question is "is 256kb of RAM enough to run the OCaml compiler in OMicroB" ? Since 256kb is way more than what we had to work with until now, I would say this is worth a try.

Overall, I think this would require a bit of effort, but would be quite a fun project, which I would like to participate in, so let me know if you want to go further with it :)

Naereen commented 5 days ago

Hi @Vertmo and thanks for your quick reply. I'll open a separate issue and continue the discussion there.