Skip to content

[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

Merged
merged 3 commits into from
Feb 3, 2024

Conversation

kubamracek
Copy link
Contributor

Several sections are missing, but I plan to finish them before merging.

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 \
Copy link
Contributor

@MaxDesiatov MaxDesiatov Jan 3, 2024

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.

Copy link
Contributor Author

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.

- **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.
Copy link
Contributor

@MaxDesiatov MaxDesiatov Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **Not available yet (under development)**: Dictionary.
- **Not available yet (under development)**: Dictionary.
- **Not available yet for `-none` triples**: Concurrency.

@kubamracek kubamracek requested a review from DougGregor January 3, 2024 20:34
| *(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);` |
Copy link
Contributor

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.

Copy link
Contributor Author

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

@kubamracek
Copy link
Contributor Author

@swift-ci please smoke test

Copy link
Member

@rauhul rauhul left a 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

@kubamracek kubamracek enabled auto-merge February 3, 2024 20:51
@kubamracek kubamracek merged commit 2fa1022 into swiftlang:main Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants