Programming Microcontrollers in OCaml: The OCaPIC Project

  • Benoît Vaugon
  • Philippe Wang
  • Emmanuel Chailloux
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9131)


PIC microcontrollers are low-cost programmable integrated circuits,consume very little energy, but are hard to program due to very little available resources. They are traditionally programmed using low-level languages (e.g., assembler or subsets of C), which provide very few safeguards if any. This paper presents the issues we had to solve to successfully port a modern multi-paradigm general-purpose programming language, which notably provides automatic memory management and strong static type checking, to this rather peculiar hardware.


Microcontroller Virtual machine Programming language implementation OCaml Applications 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    van Ooijen et al, W.: Jal (not ?) Just Another Language, May 2004.
  2. 2.
    Brouwers, N., Corke, P., Langendoen, K.: Darjeeling, a Java compatible virtual machine for wireless sensor networks. In: Proceedings of the ACM/IFIP/USENIX Middleware 2008 Conference Companion (2008)Google Scholar
  3. 3.
    Chailloux, E., Manoury, P., Pagano, B.: Developing Applications with Objective Caml. O’Reilly (2000).
  4. 4.
    Clerc, X.: Cadmium, February 2010.
  5. 5.
    Feeley, M., Dubé, D.: Picbit: a scheme system for the PIC microcontroller. In: Scheme and Functional Programming Workshop (SFPW 2003), pp. 7–15, November 2003Google Scholar
  6. 6.
    Leroy, X.: The ZINC experiment : an economical implementation of the ML language. Tech. Rep. RT-0117, INRIA, February 1990Google Scholar
  7. 7.
    Leroy, X., Doligez, D., Frisch, A., Garrigue, J., Rémy, D., Vouillon, J.: The OCaml system (release 4.02): Documentation and user’s manual. Inria, September 2014.
  8. 8.
    Madhavapeddy, A., Mortier, R., Rotsos, C., Scott, D., Singh, B., Gazagnaire, T., Smith, S., Hand, S., Crowcroft, J.: Unikernels: library operating systems for the cloud. In: Proceedings of the 18th International Conference on Architectural Support for Programming Languages and Operating Systems (APLOS), pp. 461–472. ACM (2013)Google Scholar
  9. 9.
    Mandel, L., Pouzet, M.: ReactiveML, a reactive extension to ML. In: Proceedings of 7th International conference on Principles and Practice of Declarative Programming (PPDP 2005), Lisbon, Portugal, July 2005Google Scholar
  10. 10.
    Nordman, M.: Flashforth (2013).
  11. 11.
    Oracle: Java Card 3.0.4 Platform Specification. Oracle, September 2011.
  12. 12.
    Osborne, M., Rubinstein, A.: Course in Game Theory. MIT Press (1994)Google Scholar
  13. 13.
    Pagano, B., Andrieu, O., Moniot, T., Canou, B., Chailloux, E., Wang, P., Manoury, P., Colaço, J.L.: Experience report: using objective caml to develop safety-critical embedded tools in a certification framework. In: ICFP 2009: Proceedings of the 14th International Conference on Functional Programming, pp. 215–220. ACM (2009)Google Scholar
  14. 14.
    Paternotte, P.: Pic Micro Pascal V1.4: User Manual, July 2010.
  15. 15.
    Pottier, F., Rémy, D.: Advanced Topics in Types and Programming Languages, chap. The Essence of ML Type Inference. MIT Press (2005)Google Scholar
  16. 16.
    St-Amour, V., Feeley, M.: PICOBIT: a compact scheme system for microcontrollers. In: Morazán, M.T., Scholz, S.-B. (eds.) IFL 2009. LNCS, vol. 6041, pp. 1–17. Springer, Heidelberg (2010) Google Scholar
  17. 17.
    Tardieu, S.: A forth compiler for microchip pic 18fxxx (2011).
  18. 18.
    Wang, P., Jonquet, A., Chailloux, E.: Non-intrusive structural coverage for objective caml. In: 5th Workshop on Bytecode Semantics, Verification, Analysis and Transformation, vol. 264 4 Electronic Notes in Theoretical Computer Science, pp. 59–73. Elsevier (2011).

Copyright information

© Springer International Publishing Switzerland 2015

Authors and Affiliations

  • Benoît Vaugon
    • 1
  • Philippe Wang
    • 2
  • Emmanuel Chailloux
    • 2
  1. 1.U2IS, ENSTA ParisTechPalaiseauFrance
  2. 2.LIP6, CNRS UMR 7606, UPMCParisFrance

Personalised recommendations