# How to start programing microcontroller in Julia ? is any package?

**URL:** https://discourse.julialang.org/t/how-to-start-programing-microcontroller-in-julia-is-any-package/3688
**Category:** General Usage
**Tags:** hardware, arduino
**Created:** [May 13, 2017, 8:17am UTC](https://discourse.julialang.org/t/how-to-start-programing-microcontroller-in-julia-is-any-package/3688 "2017-05-13T08:17:05Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![programista](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/programista/32/5372_2.png) [@programista](https://discourse.julialang.org/u/programista)
#### Post date: [May 13, 2017, 8:17am UTC](https://discourse.julialang.org/t/how-to-start-programing-microcontroller-in-julia-is-any-package/3688/1 "2017-05-13T08:17:05Z")

</div>

How to start programing microcontroller in Julia ? is any package ?  
Paul

---

<div class="post-metadata">

### Author: ![mzaffalon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mzaffalon/32/214168_2.png) [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)
#### Post date: [May 14, 2017, 6:52pm UTC](https://discourse.julialang.org/t/how-to-start-programing-microcontroller-in-julia-is-any-package/3688/2 "2017-05-14T18:52:57Z")

</div>

I am not sure it is supported though [https://github.com/rennis250/Arduino.jl](https://github.com/rennis250/Arduino.jl)

---

<div class="post-metadata">

### Author: ![programista](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/programista/32/5372_2.png) [@programista](https://discourse.julialang.org/u/programista)
#### Post date: [May 15, 2017, 6:23am UTC](https://discourse.julialang.org/t/how-to-start-programing-microcontroller-in-julia-is-any-package/3688/3 "2017-05-15T06:23:18Z")

</div>

Sombody are using ATMEGA8 (16…) with Julia ?  
Paul

W dniu 2017-05-14 o 20:58, Michele Zaffalon pisze:

---

<div class="post-metadata">

### Author: ![programista](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/programista/32/5372_2.png) [@programista](https://discourse.julialang.org/u/programista)
#### Post date: [June 20, 2017, 4:08pm UTC](https://discourse.julialang.org/t/how-to-start-programing-microcontroller-in-julia-is-any-package/3688/4 "2017-06-20T16:08:45Z")

</div>

THX , but I am using microcontroller ATMEGA8 , Arduino is other chip. Question stil actual.  
Paul

---

<div class="post-metadata">

### Author: ![oxinabox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oxinabox/32/206603_2.png) [@oxinabox](https://discourse.julialang.org/u/oxinabox)
#### Post date: [June 21, 2017, 2:08am UTC](https://discourse.julialang.org/t/how-to-start-programing-microcontroller-in-julia-is-any-package/3688/5 "2017-06-21T02:08:14Z")

</div>

You can’t _run_ julia on a ATMEGA8.  
Julia can only be run on a computer with a (supported) operating system.

---

<div class="post-metadata">

### Author: ![programista](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/programista/32/5372_2.png) [@programista](https://discourse.julialang.org/u/programista)
#### Post date: [June 21, 2017, 2:01pm UTC](https://discourse.julialang.org/t/how-to-start-programing-microcontroller-in-julia-is-any-package/3688/6 "2017-06-21T14:01:25Z")

</div>

Shure!

I am lookong for some suport to programing ATMEGA8, analogical like  
Arduino.jl …

Paul

---

<div class="post-metadata">

### Author: ![amckay1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amckay1/32/8280_2.png) [@amckay1](https://discourse.julialang.org/u/amckay1)
#### Post date: [June 21, 2017, 2:49pm UTC](https://discourse.julialang.org/t/how-to-start-programing-microcontroller-in-julia-is-any-package/3688/7 "2017-06-21T14:49:36Z")

</div>

I was looking into this a while back and I believe one would need the chip to at least support llvm. I had heard espressif was working on this for the xtensa based esp32 with an eye to supporting the rust language, but according to this post, that is behind:

> **[Rust \[and other LLVM languages\] support for ESP32 - ESP32 Forum](https://www.esp32.com/viewtopic.php?t=499)**
>
> Espressif ESP32 Official Forum

---

<div class="post-metadata">

### Author: ![John\_Hearns](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/john_hearns/32/1685_2.png) [@John\_Hearns](https://discourse.julialang.org/u/John_Hearns)
#### Post date: [June 21, 2017, 2:52pm UTC](https://discourse.julialang.org/t/how-to-start-programing-microcontroller-in-julia-is-any-package/3688/8 "2017-06-21T14:52:42Z")

</div>

Paul, Julia does run on the Raspberry Pi. OK, that’s not a microcontroller but you should be able to hook at Atmega8 up to the Pi

---

<div class="post-metadata">

### Author: ![oxinabox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oxinabox/32/206603_2.png) [@oxinabox](https://discourse.julialang.org/u/oxinabox)
#### Post date: [June 22, 2017, 3:09am UTC](https://discourse.julialang.org/t/how-to-start-programing-microcontroller-in-julia-is-any-package/3688/9 "2017-06-22T03:09:15Z")

</div>

I’m still unclear if you want to:

- run julia _on_ the ATMEGA8 – impossible (without some serious work on changing the language itself)
- communicate with a program on ATMEGA – which is what Arduino.jl lets you do, but you could do directly with [SerialPorts.jl](https://github.com/JuliaIO/SerialPorts.jl)
- Use julia to automate the transferring of compiled programs (eg written in C), to the ATMEGA, eg via JTAG – in which case you probably are best off using julia’s great power for calling external programs, to run the commandline tools that Atmel provides.

---

<div class="post-metadata">

### Author: ![tshort](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tshort/32/43_2.png) [@tshort](https://discourse.julialang.org/u/tshort)
#### Post date: [June 22, 2017, 11:46am UTC](https://discourse.julialang.org/t/how-to-start-programing-microcontroller-in-julia-is-any-package/3688/10 "2017-06-22T11:46:04Z")

</div>

No one has done it that I’m aware of, but with some work, one could probably cross-compile Julia code (static) with LLVM’s atmel backend. A similar approach is being worked on for Rust:

[http://dylanmckay.io/blog/rust/avr/llvm/2017/02/09/safer-microcontrollers-almost-here.html](http://dylanmckay.io/blog/rust/avr/llvm/2017/02/09/safer-microcontrollers-almost-here.html)

---

<div class="post-metadata">

### Author: ![programista](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/programista/32/5372_2.png) [@programista](https://discourse.julialang.org/u/programista)
#### Post date: [June 22, 2017, 1:29pm UTC](https://discourse.julialang.org/t/how-to-start-programing-microcontroller-in-julia-is-any-package/3688/11 "2017-06-22T13:29:21Z")

</div>

Hi  
Typical way to prgraming microcontrolers ATMEGA is preparing program in  
lenguage C. But I i am using Julia (Not C) and Ia mlooking for simply  
way to programing mikrokontolers in Julia !  
Paul  
W dniu 2017-06-22 o 05:14, Lyndon White pisze:

---

<div class="post-metadata">

### Author: ![programista](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/programista/32/5372_2.png) [@programista](https://discourse.julialang.org/u/programista)
#### Post date: [June 22, 2017, 1:40pm UTC](https://discourse.julialang.org/t/how-to-start-programing-microcontroller-in-julia-is-any-package/3688/12 "2017-06-22T13:40:46Z")

</div>

BIg Thx, idea nice but for me very hard… i will try 🙂  
P

W dniu 2017-06-21 o 16:58, John Hearns pisze:

---

<div class="post-metadata">

### Author: ![scelles](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scelles/32/220408_2.png) [@scelles](https://discourse.julialang.org/u/scelles)
#### Post date: [September 1, 2018, 8:23am UTC](https://discourse.julialang.org/t/how-to-start-programing-microcontroller-in-julia-is-any-package/3688/13 "2018-09-01T08:23:48Z")

</div>

Python have [http://micropython.org/](http://micropython.org/) and PyBoard [MicroPython Store](https://store.micropython.org/product/PYBv1.1H)

Having a MicroJulia and a JuliaBoard with a ARM MCU (such as STM32) or ESP32 will be great!

Some others boards supporting MicroPython

- Wipy [https://pycom.io/product/wipy-3-0-multipack/](https://pycom.io/product/wipy-3-0-multipack/)
- [https://github.com/micropython/micropython/wiki/Boards-Summary](https://github.com/micropython/micropython/wiki/Boards-Summary)

---

<div class="post-metadata">

### Author: ![jpsamaroo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jpsamaroo/32/46804_2.png) [@jpsamaroo](https://discourse.julialang.org/u/jpsamaroo)
#### Post date: [September 1, 2018, 6:31pm UTC](https://discourse.julialang.org/t/how-to-start-programing-microcontroller-in-julia-is-any-package/3688/14 "2018-09-01T18:31:12Z")

</div>

I don’t expect that Julia would ever run directly on an MCU that small, because Julia (well, really its dependencies) is _big_. LLVM alone takes up a huge amount of space (not to mention computational time during compilation), and is not currently suitable to be run on an MCU. The only reason Python gets by here, is that at its core, it’s just a simple (slow) interpreter, which is easy enough to implement on an MCU, given the RAM, Flash, and CPU budget you have available. I’m of course glossing over certain important details, but suffice to say that Python and Julia are two very different beasts.

---

<div class="post-metadata">

### Author: ![scelles](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scelles/32/220408_2.png) [@scelles](https://discourse.julialang.org/u/scelles)
#### Post date: [November 28, 2018, 7:26am UTC](https://discourse.julialang.org/t/how-to-start-programing-microcontroller-in-julia-is-any-package/3688/15 "2018-11-28T07:26:56Z")

</div>

Go have TinyGo [GitHub - tinygo-org/tinygo: Go compiler for small places. Microcontrollers, WebAssembly (WASM/WASI), and command-line tools. Based on LLVM.](https://github.com/aykevl/tinygo) for microcontrollers. It’s also using LLVM.

Rust have

- [GitHub - rust-embedded/awesome-embedded-rust: Curated list of resources for Embedded and Low-level development in the Rust programming language](https://github.com/rust-embedded/awesome-embedded-rust)
- [Introduction - The Embedded Rust Book](https://rust-embedded.github.io/book/)
- [GitHub - rust-embedded/wg: Coordination repository of the embedded devices Working Group](https://github.com/rust-embedded/wg)
- [https://docs.rust-embedded.org/](https://docs.rust-embedded.org/)

for microcontrollers. It’s also using LLVM.

---

<div class="post-metadata">

### Author: ![jpsamaroo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jpsamaroo/32/46804_2.png) [@jpsamaroo](https://discourse.julialang.org/u/jpsamaroo)
#### Post date: [November 28, 2018, 12:58pm UTC](https://discourse.julialang.org/t/how-to-start-programing-microcontroller-in-julia-is-any-package/3688/16 "2018-11-28T12:58:29Z")

</div>

tinygo is a compiler which runs on a host computer and compiles code for the target MCU. If that’s what we want to do for Julia, then I’m all for it.

The point I was making is that the interpreted part of Julia (where you have a REPL where you can type code into and have it JIT compiled as usual) could never run directly on an MCU most likely, because it just involves way too much overhead from memory usage and library size. Of course, there’s nothing to stop you from building an interpreter that can interpret most of Julia to run directly on an MCU, but it’ll be slower than compiled code flashed from a host computer.

---

<div class="post-metadata">

### Author: ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)
#### Post date: [December 11, 2018, 10:00am UTC](https://discourse.julialang.org/t/how-to-start-programing-microcontroller-in-julia-is-any-package/3688/17 "2018-12-11T10:00:27Z")

</div>

> [@oxinabox](#):
>
> I’m still unclear if you want to:
> 
> - run julia _on_ the ATMEGA8 – impossible (without some serious work on changing the language itself)
> - communicate with a program on ATMEGA – which is what Arduino.jl lets you do, but you could do directly with [SerialPorts.jl](https://github.com/JuliaIO/SerialPorts.jl)
> - Use julia to automate the transferring of compiled programs (eg written in C), to the ATMEGA

Right, any 8/16 bit MCUs/CPUs, such as Arduino, are impossible, as I thought (see answer to my question on it). Except for Julia2C loophole. See below.

Julia supports ARM, and there is one non-8/16-bit Arduino, the 32-bit ARM-based Arduino Due (or Zero or M0 variant currently sold out). That’s the one potentially having the fewest issues to get working with Julia.Note the ARM-based MCUs, at least these ones may only support “Thumb ARM”, not full ARM, so I’m not even sure Julia would support such variants currently. A better bet might be x86 based Arduino: [Arduino Official Store | Boards Shields Kits Accessories](https://store.arduino.cc/genuino-101)

The link in the thread above to Arduino.jl is broken, but from memory it’s just to interface to it, same as SerialPorts.jl that actually has a “`Arduino` submodule”. [This may even be the same code? I’m not sure if the name was changed as it was misleading or that package copied from the former.]

You can use Julia with/for C programs as you say; but also there was Intel’s Julia2C project. It seems to have bitrotted. If it would get maintained (or just using very old Julia syntax…) you could translate Julia to C and then get the code on the MCU. Possibly almost any MCU, even 8/16 bit ones. I’m however ignoring all OS issues. Julia by default requires running in an OS. A project similar to MicroPython, done for Julia, could help with that, and there’s a Discourse thread on it.

Unless you get around the OS/Linux requirement of Julia you need to look into this thread and answers there:

> **[Embedded Linux on Arduino DUE](https://forum.arduino.cc/t/embedded-linux-on-arduino-due/136608)**
>
> Hello Arduino Community, I have worked on arduino UNo board and now i'm migrating onto Arduino DUE .Is there a way where we can run an embedded linux such on an ARDUINO DUE BOARD ? . If yes please let me know the steps for the same . Thanks and...

> We can customize the Linux to run on Due.  
> But what we want to achieve with this?  
> Any value added that we are getting with this?

---

<div class="post-metadata">

### Author: ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)
#### Post date: [December 11, 2018, 12:04pm UTC](https://discourse.julialang.org/t/how-to-start-programing-microcontroller-in-julia-is-any-package/3688/18 "2018-12-11T12:04:51Z")

</div>

You may find  
[https://gitlab.control.lth.se/labdev/LabConnections.jl](https://gitlab.control.lth.se/labdev/LabConnections.jl)  
useful. We use a beaglebone to control lab processes using Julia in our university lab. The Readme links to documentation with install instructions
