Cortex M0


(Tanner) #1

Hello Swift Dev,

Does anyone know if it is possible to compile Swift 2.2 or 3.0 for the Cortex M0?


(Dmitri Gribenko) #2

We have an ARMv6 port, but I believe the primary limitation you will
run into is the code size and the required memory to hold all the
runtime tables. If we are talking about a system with 256 Kb of flash
and 32 Kb of RAM, it certainly won't fit even the hello world program.

Dmitri

···

On Tue, Mar 15, 2016 at 11:40 AM, Tanner Nelson via swift-dev <swift-dev@swift.org> wrote:

Hello Swift Dev,

Does anyone know if it is possible to compile Swift 2.2 or 3.0 for the Cortex M0?

--
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@gmail.com>*/


(William Dillon) #3

I’m no expert on the M0, but I looked it up. It seems to be Thumb(2) only, and I don’t think thumb support in linux is finished. This is of course in addition to the *significant* constraints that Dmitri noted.

- Will

···

On Mar 15, 2016, at 1:11 PM, Dmitri Gribenko via swift-dev <swift-dev@swift.org> wrote:

On Tue, Mar 15, 2016 at 11:40 AM, Tanner Nelson via swift-dev > <swift-dev@swift.org> wrote:

Hello Swift Dev,

Does anyone know if it is possible to compile Swift 2.2 or 3.0 for the Cortex M0?

We have an ARMv6 port, but I believe the primary limitation you will
run into is the code size and the required memory to hold all the
runtime tables. If we are talking about a system with 256 Kb of flash
and 32 Kb of RAM, it certainly won't fit even the hello world program.

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@gmail.com>*/
_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev


(Tanner) #4

Hello Swift Dev,

Does anyone know if it is possible to compile Swift 2.2 or 3.0 for the Cortex M0?

We have an ARMv6 port, but I believe the primary limitation you will
run into is the code size and the required memory to hold all the
runtime tables. If we are talking about a system with 256 Kb of flash

Very interesting. Where can I learn more about the runtime tables, etc that Swift products?

and 32 Kb of RAM, it certainly won't fit even the hello world program.

Good point. I'll stick to C for this task then.

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@gmail.com>*/

What in the world does this do?

···

On Mar 15, 2016, at 4:11 PM, Dmitri Gribenko <gribozavr@gmail.com> wrote:
On Tue, Mar 15, 2016 at 11:40 AM, Tanner Nelson via swift-dev > <swift-dev@swift.org> wrote:


(Tanner) #5

I’m no expert on the M0, but I looked it up. It seems to be Thumb(2) only, and I don’t think thumb support in linux is finished. This is of course in addition to the *significant* constraints that Dmitri noted.

Hopefully someday it will be possible to write iBeacon firmware in Swift :slight_smile: I know C++ has a lot of compiler flags to remove some exception and runtime type stuff to reduce file size.

···

On Mar 15, 2016, at 4:14 PM, William Dillon <william@housedillon.com> wrote:

- Will

On Mar 15, 2016, at 1:11 PM, Dmitri Gribenko via swift-dev <swift-dev@swift.org> wrote:

On Tue, Mar 15, 2016 at 11:40 AM, Tanner Nelson via swift-dev >> <swift-dev@swift.org> wrote:

Hello Swift Dev,

Does anyone know if it is possible to compile Swift 2.2 or 3.0 for the Cortex M0?

We have an ARMv6 port, but I believe the primary limitation you will
run into is the code size and the required memory to hold all the
runtime tables. If we are talking about a system with 256 Kb of flash
and 32 Kb of RAM, it certainly won't fit even the hello world program.

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@gmail.com>*/
_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev


(William Dillon) #6

YES, that would be awesome. I would die happy if I could use Swift (or a language substantially similar) on a PIC32 or MSP430, for example.

- Will

···

On Mar 15, 2016, at 1:22 PM, Tanner Nelson <me@tanner.xyz> wrote:

On Mar 15, 2016, at 4:14 PM, William Dillon <william@housedillon.com> wrote:

I’m no expert on the M0, but I looked it up. It seems to be Thumb(2) only, and I don’t think thumb support in linux is finished. This is of course in addition to the *significant* constraints that Dmitri noted.

Hopefully someday it will be possible to write iBeacon firmware in Swift :slight_smile: I know C++ has a lot of compiler flags to remove some exception and runtime type stuff to reduce file size.


(Dmitri Gribenko) #7

In the source. static variables in
https://github.com/apple/swift/blob/master/stdlib/public/runtime/Metadata.cpp

Dmitri

···

On Tue, Mar 15, 2016 at 1:19 PM, Tanner Nelson <me@tanner.xyz> wrote:

On Mar 15, 2016, at 4:11 PM, Dmitri Gribenko <gribozavr@gmail.com> wrote:

On Tue, Mar 15, 2016 at 11:40 AM, Tanner Nelson via swift-dev >> <swift-dev@swift.org> wrote:

Hello Swift Dev,

Does anyone know if it is possible to compile Swift 2.2 or 3.0 for the Cortex M0?

We have an ARMv6 port, but I believe the primary limitation you will
run into is the code size and the required memory to hold all the
runtime tables. If we are talking about a system with 256 Kb of flash

Very interesting. Where can I learn more about the runtime tables, etc that Swift products?

--
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@gmail.com>*/