[swift-dev] Feasibility of Swift for Arduino

Steven Hepting shepting at twitter.com
Fri Dec 4 13:17:35 CST 2015

Matthijs, perhaps another option for Microcontroller work with Swift would
be the Raspberry Pi. It runs a full version of Linux and has the $5
Raspberry Pi Zero option now.

I'd love to hear of any progress on that front.

On Fri, Dec 4, 2015 at 9:26 AM, Dmitri Gribenko <gribozavr at gmail.com> wrote:

> On Fri, Dec 4, 2015 at 5:37 AM, Matthijs Hollemans <mail at hollance.com>
> wrote:
> > Hi all,
> >
> > Just out of curiosity, how feasible would it be to get swiftc working as
> a cross-compiler for Arduino microcontrollers?
> >
> > Currently the Arduino is programmed in C/C++ and seeing as Swift is
> positioned as a replacement for those languages, I’m wondering if it could
> live up to this task already.
> >
> > Obviously, the low-end Arduinos use an 8-bit CPU and an LLVM code
> generator for this CPU is required. But my main concern is the requirements
> of the Swift runtime. An Arduino Uno only has 32 kB of working memory. How
> much of that would be taken up by the Swift runtime?
> The runtime and the standard library currently take much more than 32
> kB.  Also, the runtime and the standard library in many places rely on
> having an OS providing a POSIX API.  I'm also unsure about the state
> of the LLVM backend for ATmega.  I'm not saying that running on a
> small 8-bit microcontroller is completely infeasible, but it will
> certainly require a major engineering effort across the whole stack,
> starting from LLVM.
> Dmitri
> --
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
> _______________________________________________
> swift-dev mailing list
> swift-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev

Steven Hepting
iOS Developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20151204/5cde776c/attachment.html>

More information about the swift-dev mailing list