Swift for Nuttx RTOS

Hello,

I am new to swift, but do believe it has a bright future. My background is
Java developer. I recently get engaged with the drone autopilot software
PX4 which is written in C++ and runs on Nuttx RTOS.

Currently the PX4 can be programmed on Mac with C++. Nuttx does support
C/C++ libraries as built in.

This may be a strange question, but I would like to understand, since both
Mac OS and Nuttx RTOS are POSIX certified would it be possible in any way
to create a program using Swift language but compile to run it on Nuttx?

Is it something that would require a special compiler to be build
specifically for Nuttx, just like there is one for Swift for Linux? In my
understanding Swift compiles to a binary code and does work with C/C++.
What am I missing here? I googled and looks like I'm the only one
interested in such work.

Please explain. Thank you.

Igor

Hi Igor,

Currently Swift requires libraries such as libswiftCore to be compiled for the target platform before being able to compile Swift programs for that platform. This has a number of dependencies, including being able to build a custom build of clang and other support libraries such as dispatch and foundation.

While there is work that allows this project to be compiled for Linux platforms, and others are working on porting it to Android, and other more estoteric platforms, there's nothing been done so far (that I'm aware of) that has targetted Nuttx.

You are likely to have to do some work in order to get Swift building on Nuttx first - once that's done, you may be able to cross-compile programs from a Mac to do there.

Alex

···

On 5 Oct 2017, at 22:47, Igor Mironenko via swift-users <swift-users@swift.org> wrote:

This may be a strange question, but I would like to understand, since both Mac OS and Nuttx RTOS are POSIX certified would it be possible in any way to create a program using Swift language but compile to run it on Nuttx?

Is it something that would require a special compiler to be build specifically for Nuttx, just like there is one for Swift for Linux? In my understanding Swift compiles to a binary code and does work with C/C++. What am I missing here? I googled and looks like I'm the only one interested in such work.

Thanks Alex,

This is similar to what I though. Appreciate you taking time to explain.

···

On Oct 6, 2017, at 1:38 AM, Alex Blewitt <alblue@apple.com> wrote:

On 5 Oct 2017, at 22:47, Igor Mironenko via swift-users <swift-users@swift.org> wrote:

This may be a strange question, but I would like to understand, since both Mac OS and Nuttx RTOS are POSIX certified would it be possible in any way to create a program using Swift language but compile to run it on Nuttx?

Is it something that would require a special compiler to be build specifically for Nuttx, just like there is one for Swift for Linux? In my understanding Swift compiles to a binary code and does work with C/C++. What am I missing here? I googled and looks like I'm the only one interested in such work.

Hi Igor,

Currently Swift requires libraries such as libswiftCore to be compiled for the target platform before being able to compile Swift programs for that platform. This has a number of dependencies, including being able to build a custom build of clang and other support libraries such as dispatch and foundation.

While there is work that allows this project to be compiled for Linux platforms, and others are working on porting it to Android, and other more estoteric platforms, there's nothing been done so far (that I'm aware of) that has targetted Nuttx.

You are likely to have to do some work in order to get Swift building on Nuttx first - once that's done, you may be able to cross-compile programs from a Mac to do there.

Alex