> On Aug 15, 2016, at 3:36 PM, Rick Mann <rm...@latencyzero.com> wrote:
> 
> Well, even C++ requires some amount of run time. On a larger MCU, the runtime 
> shouldn't be a problem at all. What I want to do is minimize the amount of OS 
> I have to implement. For example, using newlib 
> (https://sourceware.org/newlib/ <https://sourceware.org/newlib/>), I can stub 
> out 20-odd functions, and everything gets statically linked into a monolithic 
> block of code that is a combination of my code, the runtime, and those 20-odd 
> function stubs. A special chunk of code, usually containing assembly 
> language, ensures the processor and MMU are properly set up just after boot, 
> and you're off to the races.
> 
> I imagine there will be additional burden to support threading and GCD (which 
> would be nice to have). But before that, supporting synchronization and 
> interrupt routines.
> 
> Ah, interrupt routines. Is there any way to mark a function as "naked" in 
> Swift? How would I request that feature?

This would require significant design work. The main problem is that the Swift 
runtime is not re-entrant, because typical malloc() implementations are not 
re-entrant, and also because of how metadata caching uses locks. So even if you 
could emit a function with the right calling convention, it wouldn't be safe to 
use as an interrupt handler.

Slava

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to