Skip to content

Commit 8b721a2

Browse files
committed
README for esp-rs/rust
1 parent f74729e commit 8b721a2

File tree

1 file changed

+10
-281
lines changed

1 file changed

+10
-281
lines changed

README.md

Lines changed: 10 additions & 281 deletions
Original file line numberDiff line numberDiff line change
@@ -1,281 +1,25 @@
1-
# The Rust Programming Language
1+
# The Rust Programming Language for Espressif chips
22

3-
[![Rust Community](https://img.shields.io/badge/Rust_Community%20-Join_us-brightgreen?style=plastic&logo=rust)](https://www.rust-lang.org/community)
3+
This fork enables projects to be built for the Xtensa-based ESP32, ESP32-SXX and ESP8266 using [Espressif's llvm fork](https://github.com/espressif/llvm-project). (RiscV chips like ESP32-CXX are already supported in stock Rust.)
44

5-
This is the main source code repository for [Rust]. It contains the compiler,
6-
standard library, and documentation.
5+
Moreover, this fork enables Rust STD support (networking, threads, and filesystem) for all chips in the ESP32 family (Xtensa and RiscV), by optionally linking with the ESP-IDF framework.
76

8-
[Rust]: https://www.rust-lang.org/
7+
The [esp-rs](https://github.com/esp-rs) organization has been formed to develop runtime, pac and hal crates for the Espressif chips (bare-metal as well as ESP-IDF based).
98

10-
**Note: this README is for _users_ rather than _contributors_.**
11-
If you wish to _contribute_ to the compiler, you should read
12-
[CONTRIBUTING.md](CONTRIBUTING.md) instead.
9+
Join in on the discussion: https://matrix.to/#/#esp-rs:matrix.org!
1310

14-
## Quick Start
11+
## Installation
1512

16-
Read ["Installation"] from [The Book].
13+
Please see the most up to date instructions in the [esp rust book](https://esp-rs.github.io/book/).
1714

18-
["Installation"]: https://doc.rust-lang.org/book/ch01-01-installation.html
19-
[The Book]: https://doc.rust-lang.org/book/index.html
15+
## Building from source
2016

21-
## Installing from Source
17+
If you wish to build this fork from source, the instructions are almost identical to the ones upstream ([follow here](https://github.com/rust-lang/rust#installing-from-source)), however before beginning the build, run the following `./configure` command:
2218

23-
The Rust build system uses a Python script called `x.py` to build the compiler,
24-
which manages the bootstrapping process. It lives at the root of the project.
25-
It also uses a file named `config.toml` to determine various configuration
26-
settings for the build. You can see a full list of options in
27-
`config.example.toml`.
28-
29-
The `x.py` command can be run directly on most Unix systems in the following
30-
format:
31-
32-
```sh
33-
./x.py <subcommand> [flags]
34-
```
35-
36-
This is how the documentation and examples assume you are running `x.py`.
37-
See the [rustc dev guide][rustcguidebuild] if this does not work on your
38-
platform.
39-
40-
More information about `x.py` can be found by running it with the `--help` flag
41-
or reading the [rustc dev guide][rustcguidebuild].
42-
43-
[gettingstarted]: https://rustc-dev-guide.rust-lang.org/getting-started.html
44-
[rustcguidebuild]: https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html#what-is-xpy
45-
46-
### Dependencies
47-
48-
Make sure you have installed the dependencies:
49-
50-
* `python` 3 or 2.7
51-
* `git`
52-
* A C compiler (when building for the host, `cc` is enough; cross-compiling may
53-
need additional compilers)
54-
* `curl` (not needed on Windows)
55-
* `pkg-config` if you are compiling on Linux and targeting Linux
56-
* `libiconv` (already included with glibc on Debian-based distros)
57-
58-
To build Cargo, you'll also need OpenSSL (`libssl-dev` or `openssl-devel` on
59-
most Unix distros).
60-
61-
If building LLVM from source, you'll need additional tools:
62-
63-
* `g++`, `clang++`, or MSVC with versions listed on
64-
[LLVM's documentation](https://llvm.org/docs/GettingStarted.html#host-c-toolchain-both-compiler-and-standard-library)
65-
* `ninja`, or GNU `make` 3.81 or later (Ninja is recommended, especially on
66-
Windows)
67-
* `cmake` 3.13.4 or later
68-
* `libstdc++-static` may be required on some Linux distributions such as Fedora
69-
and Ubuntu
70-
71-
On tier 1 or tier 2 with host tools platforms, you can also choose to download
72-
LLVM by setting `llvm.download-ci-llvm = true`.
73-
Otherwise, you'll need LLVM installed and `llvm-config` in your path.
74-
See [the rustc-dev-guide for more info][sysllvm].
75-
76-
[sysllvm]: https://rustc-dev-guide.rust-lang.org/building/new-target.html#using-pre-built-llvm
77-
78-
79-
### Building on a Unix-like system
80-
81-
#### Build steps
82-
83-
1. Clone the [source] with `git`:
84-
85-
```sh
86-
git clone https://github.com/rust-lang/rust.git
87-
cd rust
88-
```
89-
90-
[source]: https://github.com/rust-lang/rust
91-
92-
2. Configure the build settings:
93-
94-
```sh
95-
./configure
96-
```
97-
98-
If you plan to use `x.py install` to create an installation, it is
99-
recommended that you set the `prefix` value in the `[install]` section to a
100-
directory: `./configure --set install.prefix=<path>`
101-
102-
3. Build and install:
103-
104-
```sh
105-
./x.py build && ./x.py install
106-
```
107-
108-
When complete, `./x.py install` will place several programs into
109-
`$PREFIX/bin`: `rustc`, the Rust compiler, and `rustdoc`, the
110-
API-documentation tool. By default, it will also include [Cargo], Rust's
111-
package manager. You can disable this behavior by passing
112-
`--set build.extended=false` to `./configure`.
113-
114-
[Cargo]: https://github.com/rust-lang/cargo
115-
116-
#### Configure and Make
117-
118-
This project provides a configure script and makefile (the latter of which just
119-
invokes `x.py`). `./configure` is the recommended way to programatically
120-
generate a `config.toml`. `make` is not recommended (we suggest using `x.py`
121-
directly), but it is supported and we try not to break it unnecessarily.
122-
123-
```sh
124-
./configure
125-
make && sudo make install
126-
```
127-
128-
`configure` generates a `config.toml` which can also be used with normal `x.py`
129-
invocations.
130-
131-
### Building on Windows
132-
133-
On Windows, we suggest using [winget] to install dependencies by running the
134-
following in a terminal:
135-
136-
```powershell
137-
winget install -e Python.Python.3
138-
winget install -e Kitware.CMake
139-
winget install -e Git.Git
140-
```
141-
142-
Then edit your system's `PATH` variable and add: `C:\Program Files\CMake\bin`.
143-
See
144-
[this guide on editing the system `PATH`](https://www.java.com/en/download/help/path.html)
145-
from the Java documentation.
146-
147-
[winget]: https://github.com/microsoft/winget-cli
148-
149-
There are two prominent ABIs in use on Windows: the native (MSVC) ABI used by
150-
Visual Studio and the GNU ABI used by the GCC toolchain. Which version of Rust
151-
you need depends largely on what C/C++ libraries you want to interoperate with.
152-
Use the MSVC build of Rust to interop with software produced by Visual Studio
153-
and the GNU build to interop with GNU software built using the MinGW/MSYS2
154-
toolchain.
155-
156-
#### MinGW
157-
158-
[MSYS2][msys2] can be used to easily build Rust on Windows:
159-
160-
[msys2]: https://www.msys2.org/
161-
162-
1. Download the latest [MSYS2 installer][msys2] and go through the installer.
163-
164-
2. Run `mingw32_shell.bat` or `mingw64_shell.bat` from the MSYS2 installation
165-
directory (e.g. `C:\msys64`), depending on whether you want 32-bit or 64-bit
166-
Rust. (As of the latest version of MSYS2 you have to run `msys2_shell.cmd
167-
-mingw32` or `msys2_shell.cmd -mingw64` from the command line instead.)
168-
169-
3. From this terminal, install the required tools:
170-
171-
```sh
172-
# Update package mirrors (may be needed if you have a fresh install of MSYS2)
173-
pacman -Sy pacman-mirrors
174-
175-
# Install build tools needed for Rust. If you're building a 32-bit compiler,
176-
# then replace "x86_64" below with "i686". If you've already got Git, Python,
177-
# or CMake installed and in PATH you can remove them from this list.
178-
# Note that it is important that you do **not** use the 'python2', 'cmake',
179-
# and 'ninja' packages from the 'msys2' subsystem.
180-
# The build has historically been known to fail with these packages.
181-
pacman -S git \
182-
make \
183-
diffutils \
184-
tar \
185-
mingw-w64-x86_64-python \
186-
mingw-w64-x86_64-cmake \
187-
mingw-w64-x86_64-gcc \
188-
mingw-w64-x86_64-ninja
189-
```
190-
191-
4. Navigate to Rust's source code (or clone it), then build it:
192-
193-
```sh
194-
python x.py setup user && python x.py build && python x.py install
195-
```
196-
197-
#### MSVC
198-
199-
MSVC builds of Rust additionally require an installation of Visual Studio 2017
200-
(or later) so `rustc` can use its linker. The simplest way is to get
201-
[Visual Studio], check the "C++ build tools" and "Windows 10 SDK" workload.
202-
203-
[Visual Studio]: https://visualstudio.microsoft.com/downloads/
204-
205-
(If you're installing CMake yourself, be careful that "C++ CMake tools for
206-
Windows" doesn't get included under "Individual components".)
207-
208-
With these dependencies installed, you can build the compiler in a `cmd.exe`
209-
shell with:
210-
211-
```sh
212-
python x.py setup user
213-
python x.py build
21419
```
215-
216-
Right now, building Rust only works with some known versions of Visual Studio.
217-
If you have a more recent version installed and the build system doesn't
218-
understand, you may need to force rustbuild to use an older version.
219-
This can be done by manually calling the appropriate vcvars file before running
220-
the bootstrap.
221-
222-
```batch
223-
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
224-
python x.py build
20+
./configure --experimental-targets=Xtensa --release-channel=nightly --enable-extended --tools=clippy,cargo,rustfmt --enable-lld
22521
```
22622

227-
#### Specifying an ABI
228-
229-
Each specific ABI can also be used from either environment (for example, using
230-
the GNU ABI in PowerShell) by using an explicit build triple. The available
231-
Windows build triples are:
232-
- GNU ABI (using GCC)
233-
- `i686-pc-windows-gnu`
234-
- `x86_64-pc-windows-gnu`
235-
- The MSVC ABI
236-
- `i686-pc-windows-msvc`
237-
- `x86_64-pc-windows-msvc`
238-
239-
The build triple can be specified by either specifying `--build=<triple>` when
240-
invoking `x.py` commands, or by creating a `config.toml` file (as described in
241-
[Building on a Unix-like system](#building-on-a-unix-like-system)), and passing
242-
`--set build.build=<triple>` to `./configure`.
243-
244-
## Building Documentation
245-
246-
If you'd like to build the documentation, it's almost the same:
247-
248-
```sh
249-
./x.py doc
250-
```
251-
252-
The generated documentation will appear under `doc` in the `build` directory for
253-
the ABI used. That is, if the ABI was `x86_64-pc-windows-msvc`, the directory
254-
will be `build\x86_64-pc-windows-msvc\doc`.
255-
256-
## Notes
257-
258-
Since the Rust compiler is written in Rust, it must be built by a precompiled
259-
"snapshot" version of itself (made in an earlier stage of development).
260-
As such, source builds require an Internet connection to fetch snapshots, and an
261-
OS that can execute the available snapshot binaries.
262-
263-
See https://doc.rust-lang.org/nightly/rustc/platform-support.html for a list of
264-
supported platforms.
265-
Only "host tools" platforms have a pre-compiled snapshot binary available; to
266-
compile for a platform without host tools you must cross-compile.
267-
268-
You may find that other platforms work, but these are our officially supported
269-
build environments that are most likely to work.
270-
271-
## Getting Help
272-
273-
See https://www.rust-lang.org/community for a list of chat platforms and forums.
274-
275-
## Contributing
276-
277-
See [CONTRIBUTING.md](CONTRIBUTING.md).
278-
27923
## License
28024

28125
Rust is primarily distributed under the terms of both the MIT license and the
@@ -284,18 +28,3 @@ licenses.
28428

28529
See [LICENSE-APACHE](LICENSE-APACHE), [LICENSE-MIT](LICENSE-MIT), and
28630
[COPYRIGHT](COPYRIGHT) for details.
287-
288-
## Trademark
289-
290-
[The Rust Foundation][rust-foundation] owns and protects the Rust and Cargo
291-
trademarks and logos (the "Rust Trademarks").
292-
293-
If you want to use these names or brands, please read the
294-
[media guide][media-guide].
295-
296-
Third-party logos may be subject to third-party copyrights and trademarks. See
297-
[Licenses][policies-licenses] for details.
298-
299-
[rust-foundation]: https://foundation.rust-lang.org/
300-
[media-guide]: https://foundation.rust-lang.org/policies/logo-policy-and-media-guide/
301-
[policies-licenses]: https://www.rust-lang.org/policies/licenses

0 commit comments

Comments
 (0)