[swift-dev] Feasibility of Swift for Arduino

Dmitri Gribenko gribozavr at gmail.com
Fri Dec 4 11:26:30 CST 2015


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>*/


More information about the swift-dev mailing list