[swift-users] Swift in bare-metal embedded programming/Swift runtime

Rick Mann rmann at latencyzero.com
Tue Aug 9 15:10:52 CDT 2016


Is it possible to use Swift for bare-metal programming on embedded devices? These devices usually have memory-mapped registers that are read and written to affect the operation of the device. Some can be quite small (e.g. 8-bit registers, simple single physical memory address space), and others quite robust (full 32- or 64-bit machines with MMUs, etc.).

But bare metal development for all of them starts with emitting code with "raw" packaging (no Mach or ELF headers, etc.), and the ability to read and write specific memory addresses.

For the smaller devices, runtime library overhead is a concern (mostly due to code size). Is it possible to write swift code with no runtime library? I think this is possible in Rust (came up on another list).

Most such development is done in C, and there is always some form of library to take on some of the standard library tasks and stub out basic IO, as well as filling in gaps for larger variable sizes not directly supported by the hardware.

I imagine there's some runtime support for ARC, although maybe that's handled entirely in the compilation phase?

Anyway, I'd appreciate someone more knowledgable letting me know if this is something I should experiment with. Thanks!

-- 
Rick Mann
rmann at latencyzero.com




More information about the swift-users mailing list