Is there or will there ever be an open source version of Swift for Arduino?

Swift for Arduino is open source! The compiler frontend is standard swift (see links below) and the compiler backend is llvm (see below). We use the gcc AVR binutils to link the code and avrdude to upload it to an arduino, all of which are 100% open source and our own builds (currently) have no significant source code modifications. When/if we build patches in the future for swiftc and llvm we are planning to release them as open source, in some appropriate place for people who like to make their own compiler. The small bugfixes/tests/documentation/etc. contributions Carl made to LLVM are all in the standard upstream LLVM tree or are going through the standard process for submission, vetting, etc. as with any big open source project (much like you would with Linux).

That said, very few people can be bothered to compile their own compiler! Both swiftc and llvm can take many hours to compile even on our super fast 2017 Macbook Pro (depending on config) and it’s a very fiddly process as you’re effectively building a cross compiler on the back end, arguably even a Candian Cross (it has to work on old macs). This stuff isn’t trivial. Plus the compiler and full toolchain is very hard for many people to use without an editor/IDE.

The IDE that is for sale on the website is our own Mac OSX app for simplifying Swift for Arduino use, which we want to release to the mac app store for sale soon. But in theory you don’t need it to program for Swift on Arduino, it just wraps up a bundle with an editor, version 3.1.1 of swiftc for OSX, a version of llvm and a handy component library and makes it all hopefully much, much easier to use.

How do I build the AVR compatible version of the swift compiler?

Disclaimer: this is really only for propellerheads, it does not make a complete working tool and is only really for completeness because I don't want to mess with the readme file in github.com/carlos4242/swift.

The swift you build will just be a partial, non functioning compiler (it needs a standard library) and will be of little use except to compiler nerds.

old instructions

new instructions (S4A core team only)


Links

Swift: https://swift.org


LLVM: https://llvm.org