-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[embedded] Add an initial docs/EmbeddedSwift/UserManual.md #70687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
docs/EmbeddedSwift/UserManual.md
Outdated
A basic way to build a set of Swift source files in Embedded Swift mode, is to simply give the compiler (1) a target triple, (2) the `-enable-experimental-feature Embedded` flag, (3) the set of source files that form the input module: | ||
|
||
```bash | ||
$ swiftc -target <target triple> -enable-experimental-feature Embedded \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will -wmo
become optional and/or default at some point? Otherwise if this stays as a required flag for embedded, it should be mentioned here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add it here. I think we should change the driver to turn WMO on for you, but let's not wait for that to happen.
docs/EmbeddedSwift/UserManual.md
Outdated
- **Not available yet (under development)**: The print() function for types other than StaticString and integers. | ||
- **Not available yet (under development)**: String. (StaticString **is** available). | ||
- **Not available yet (under development)**: Set. | ||
- **Not available yet (under development)**: Dictionary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- **Not available yet (under development)**: Dictionary. | |
- **Not available yet (under development)**: Dictionary. | |
- **Not available yet for `-none` triples**: Concurrency. |
docs/EmbeddedSwift/UserManual.md
Outdated
| *(basic dependencies, added by the compiler in various situations)* | `void *memset(void *, int, size_t);` | | ||
| instantiating a class, or using UnsafePointer.allocate() | `int posix_memalign(void **, size_t, size_t);`<br/>`void free(void *);` | | ||
| using print() | `int putchar(int);` | | ||
| using Hashable, Set, Dictionary, or random-number generating APIs | `void arc4random_buf(void *, size_t);` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are also atomic intrinsics that should be accounted for reference types (if used).
Plus we should likely add a section about the requirement expectations of these functions; e.g. that putchar actually takes a uint8? or that arc4random_buf MUST be cryptographically secure etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re. putchar taking uint8 -- that's an oversight on my side, we need to match the standard putchar. Fixing that here: #70685
@swift-ci please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
definitely a good enough start for us to merge and start iterating on. I think we will want to pull this out into its own repo in the future as a docc bundle. That will allow us to iterate faster
Several sections are missing, but I plan to finish them before merging.