-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rust8.html
302 lines (145 loc) · 30 KB
/
Rust8.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- iOS Safari -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<!-- Chrome, Firefox OS and Opera Status Bar Color -->
<meta name="theme-color" content="#FFFFFF">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.css">
<link rel="stylesheet" type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.19.0/themes/prism.min.css">
<link rel="stylesheet" type="text/css" href="css/SourceSansPro.css">
<link rel="stylesheet" type="text/css" href="css/theme.css">
<link rel="stylesheet" type="text/css" href="css/notablog.css">
<link rel="stylesheet" type="text/css" href="css/CustomSetting.css">
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text text-anchor=%22middle%22 dominant-baseline=%22middle%22 x=%2250%22 y=%2255%22 font-size=%2280%22>🥥</text></svg>">
<style>
:root {
font-size: 20px;
}
</style>
<title>使用 cargo run 和 espflash 烧写固件 | 413’s Website</title>
<meta property="og:type" content="blog">
<meta property="og:title" content="使用 cargo run 和 espflash 烧写固件">
<meta property="og:image" content="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text text-anchor=%22middle%22 dominant-baseline=%22middle%22 x=%2250%22 y=%2255%22 font-size=%2280%22>🦀</text></svg>">
<style>
.DateTagBar {
margin-top: 1.0rem;
}
</style>
</head>
<body>
<nav class="Navbar">
<a href="index.html">
<div class="Navbar__Btn">
<span><img class="inline-img-icon" src="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text text-anchor=%22middle%22 dominant-baseline=%22middle%22 x=%2250%22 y=%2255%22 font-size=%2280%22>🥥</text></svg>"></span>
<span>Home</span>
</div>
</a>
<span class="Navbar__Delim">·</span>
<a href="blog-collection.html">
<div class="Navbar__Btn">
<span><img class="inline-img-icon" src="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text text-anchor=%22middle%22 dominant-baseline=%22middle%22 x=%2250%22 y=%2255%22 font-size=%2280%22>🥅</text></svg>"></span>
<span>blog mark</span>
</div>
</a>
<span class="Navbar__Delim">·</span>
<a href="Note.html">
<div class="Navbar__Btn">
<span><img class="inline-img-icon" src="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text text-anchor=%22middle%22 dominant-baseline=%22middle%22 x=%2250%22 y=%2255%22 font-size=%2280%22>🎶</text></svg>"></span>
<span>Note</span>
</div>
</a>
<span class="Navbar__Delim">·</span>
<a href="reference.html">
<div class="Navbar__Btn">
<span><img class="inline-img-icon" src="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text text-anchor=%22middle%22 dominant-baseline=%22middle%22 x=%2250%22 y=%2255%22 font-size=%2280%22>😷</text></svg>"></span>
<span>杂项</span>
</div>
</a>
<span class="Navbar__Delim">·</span>
<a href="About.html">
<div class="Navbar__Btn">
<span><img class="inline-img-icon" src="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text text-anchor=%22middle%22 dominant-baseline=%22middle%22 x=%2250%22 y=%2255%22 font-size=%2280%22>😀</text></svg>"></span>
<span>About</span>
</div>
</a>
</nav>
<header class="Header">
<div class="Header__Spacer Header__Spacer--NoCover">
</div>
<div class="Header__Icon">
<span><img class="inline-img-icon" src="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text text-anchor=%22middle%22 dominant-baseline=%22middle%22 x=%2250%22 y=%2255%22 font-size=%2280%22>🦀</text></svg>"></span>
</div>
<h1 class="Header__Title">使用 cargo run 和 espflash 烧写固件</h1>
<div class="DateTagBar">
<span class="DateTagBar__Item DateTagBar__Date">Posted on Mon, Sep 2, 2024</span>
<span class="DateTagBar__Item DateTagBar__Tag DateTagBar__Tag--red">
<a href="tag/单片机.html">单片机</a>
</span>
<span class="DateTagBar__Item DateTagBar__Tag DateTagBar__Tag--purple">
<a href="tag/Rust.html">Rust</a>
</span>
</div>
</header>
<div id="content-html"></div>
<article id="https://www.notion.so/e3e099bee0f249f090161724c0cd9966" class="PageRoot PageRoot--FullWidth"><h2 id="https://www.notion.so/d231649270c047c9aa0b9f013f36269d" class="ColorfulBlock ColorfulBlock--ColorDefault Heading Heading--2"><a class="Anchor" href="#https://www.notion.so/d231649270c047c9aa0b9f013f36269d"><svg width="16" height="16" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">espflash 是固件烧录和终端监视工具,基于 esptool.py.</mark></span></span></h2><div id="https://www.notion.so/357487044b0a42db8954ee05d9f16b96" class="ColorfulBlock ColorfulBlock--ColorDefault Text"><p class="Text__Content"><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">参考:</mark></span><span class="SemanticString"><a class="SemanticString__Fragment SemanticString__Fragment--Link" href="https://github.com/esp-rs/espflash/tree/main/espflash#installation"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">https://github.com/esp-rs/espflash/tree/main/espflash#installation</mark></a></span></span></p></div><div id="https://www.notion.so/38d3996464b64a8db32d7ada2d155c15" class="ColorfulBlock ColorfulBlock--ColorDefault Text"><p class="Text__Content"><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">cargo-espflash vs espflash: cargo-espflash 是作为 cargo 的一个子命令来运行的,如 cargo espflash, 它支持 cargo 的 –bin/–expample 参数来快速指定 bin 和 example binary 名称。而 espflash 是一个单独工具,需要指定 bin 文件的具体路径:</mark></span></span></p></div><div id="https://www.notion.so/a377874ed0f6460b901f983a16528ef5" class="ColorfulBlock ColorfulBlock--ColorDefault Text"><p class="Text__Content"><span class="SemanticStringArray"></span></p></div><pre id="https://www.notion.so/743fbaefb96d45ebac8f86829763e88c" class="Code Code--NoWrap"><code><span class="SemanticStringArray"><span class="SemanticString"><span><span class="token assign-left variable">MCU</span><span class="token operator">=</span>esp32c3 <span class="token function">cargo</span> espflash flash <span class="token parameter variable">--target</span> riscv32imc-esp-espidf <span class="token parameter variable">--example</span> ledc_simple <span class="token parameter variable">--monitor</span>
<span class="token function">cargo</span> espflash flash <span class="token parameter variable">--example</span><span class="token operator">=</span>blinky <span class="token parameter variable">--monitor</span>
espflash flash target/debug/myapp <span class="token parameter variable">--monitor</span> </span></span></span></code></pre><div id="https://www.notion.so/82fb24229d1d4d5a9004d6efdbdbb7db" class="ColorfulBlock ColorfulBlock--ColorDefault Text"><p class="Text__Content"><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">espflash 使用 USB 串口(linux: /dev/ttyUSB0, macOS: /dev/cu.*) 来烧录芯片的 Flash,它会检查项目的依赖是否包含 esp-idf-sys 来判断是那种类型的应用,然后 </mark></span><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault"><code class="SemanticString__Fragment SemanticString__Fragment--Code">自动烧写不同的文件</code></mark></span><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault"> :</mark></span></span></p></div><ul class="BulletedListWrapper"><li id="https://www.notion.so/18461c8d62754332ba6475bae501f58b" class="BulletedList"><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">对于 std 应用,会烧写三个文件:应用 binary,bootloader.bin,partition-table.bin;</mark></span></span><ul class="BulletedListWrapper"><li id="https://www.notion.so/0b8289a388574831a626580ee2cdcc52" class="BulletedList"><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">bootloader.bin,partition-table.bin 是 esp-idf-sys build script 生成的。</mark></span></span></li></ul></li><li id="https://www.notion.so/d7a3a215928949a68dbfc304a1fe4fb0" class="BulletedList"><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">对于 no_std 应用,只烧写一个 elf 格式的应用 binary;</mark></span></span></li></ul><div id="https://www.notion.so/ef5ae8e64f5f4ba78ab26f21ad7d923e" class="ColorfulBlock ColorfulBlock--ColorDefault Text"><p class="Text__Content"><span class="SemanticStringArray"></span></p></div><pre id="https://www.notion.so/5a12f2af8cd4490bb9a951be7584f745" class="Code Code--NoWrap"><code><span class="SemanticStringArray"><span class="SemanticString"><span>zj@a:~/codes/esp32$ espflash <span class="token parameter variable">--help</span>
A command-line tool <span class="token keyword">for</span> flashing Espressif devices
Usage: espflash <span class="token operator"><</span>COMMAND<span class="token operator">></span>
Commands:
board-info Print information about a connected target device
completions Generate completions <span class="token keyword">for</span> the given shell
erase-flash Erase Flash entirely
erase-parts Erase specified partitions
erase-region Erase specified region
flash Flash an application <span class="token keyword">in</span> ELF <span class="token function">format</span> to a connected target device
monitor Open the serial monitor without flashing the connected target device
partition-table Convert partition tables between CSV and binary <span class="token function">format</span>
save-image Generate a binary application image and save it to a <span class="token builtin class-name">local</span> disk
write-bin Write a binary <span class="token function">file</span> to a specific address <span class="token keyword">in</span> a target device's flash
<span class="token builtin class-name">help</span> Print this message or the <span class="token builtin class-name">help</span> of the given subcommand<span class="token punctuation">(</span>s<span class="token punctuation">)</span>
Options:
-h, <span class="token parameter variable">--help</span> Print <span class="token builtin class-name">help</span>
-V, <span class="token parameter variable">--version</span> Print version
zj@a:~/codes/esp32$</span></span></span></code></pre><h3 id="https://www.notion.so/f65b88f6ea0d4b52a42eee9d826324e0" class="ColorfulBlock ColorfulBlock--ColorDefault Heading Heading--3"><a class="Anchor" href="#https://www.notion.so/f65b88f6ea0d4b52a42eee9d826324e0"><svg width="16" height="16" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">cargo run: 在项目的 .cargo/config.toml 中添加如下内容, 然后就可以执行 cargo run 来 flash 和 monitor 应用:</mark></span></span></h3><div id="https://www.notion.so/f107b78e3e53468ebcb69c24d56d2d60" class="ColorfulBlock ColorfulBlock--ColorDefault Text"><p class="Text__Content"><span class="SemanticStringArray"></span></p></div><pre id="https://www.notion.so/9d2d523328e8434c990e1806e378dcb7" class="Code Code--NoWrap"><code><span class="SemanticStringArray"><span class="SemanticString"><span><span class="token punctuation">[</span><span class="token table class-name">target.'cfg(any(target_arch = "riscv32", target_arch = "xtensa"))'</span><span class="token punctuation">]</span>
<span class="token key property">runner</span> <span class="token punctuation">=</span> <span class="token string">"espflash flash --baud=921600 --monitor"</span> </span></span></span></code></pre><h3 id="https://www.notion.so/d01b9f3f60f74bf99661d762815d4643" class="ColorfulBlock ColorfulBlock--ColorDefault Heading Heading--3"><a class="Anchor" href="#https://www.notion.so/d01b9f3f60f74bf99661d762815d4643"><svg width="16" height="16" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">espflash 配置文件 espflash.toml:</mark></span></span></h3><ul class="BulletedListWrapper"><li id="https://www.notion.so/a77c044d940e40c7b9953f3c8ed9fdf6" class="BulletedList"><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">具体配置参数:</mark></span><span class="SemanticString"><a class="SemanticString__Fragment SemanticString__Fragment--Link" href="https://github.com/esp-rs/espflash/blob/main/espflash/src/cli/config.rs#L77"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">https://github.com/esp-rs/espflash/blob/main/espflash/src/cli/config.rs#L77</mark></a></span></span></li></ul><div id="https://www.notion.so/5fd04d8ce52d4b46a858e030cf8939c5" class="ColorfulBlock ColorfulBlock--ColorDefault Text"><p class="Text__Content"><span class="SemanticStringArray"></span></p></div><pre id="https://www.notion.so/7c4593af9e9147f891c7a61251ddc6a0" class="Code Code--NoWrap"><code><span class="SemanticStringArray"><span class="SemanticString"><span><span class="token punctuation">[</span><span class="token table class-name">connection</span><span class="token punctuation">]</span>
<span class="token key property">serial</span> <span class="token punctuation">=</span> <span class="token string">"/dev/ttyUSB0"</span>
<span class="token key property">baudrate</span> <span class="token punctuation">=</span> <span class="token number">460800</span>
<span class="token key property">bootloader</span> <span class="token punctuation">=</span> <span class="token string">"path/to/custom/bootloader.bin"</span>
<span class="token key property">partition_table</span> <span class="token punctuation">=</span> <span class="token string">"path/to/custom/partition-table.bin"</span>
<span class="token punctuation">[</span><span class="token table class-name">flash</span><span class="token punctuation">]</span>
<span class="token key property">mode</span> <span class="token punctuation">=</span> <span class="token string">"qio"</span>
<span class="token key property">size</span> <span class="token punctuation">=</span> <span class="token string">"8MB"</span>
<span class="token key property">frequency</span> <span class="token punctuation">=</span> <span class="token string">"80MHz"</span></span></span></span></code></pre><div id="https://www.notion.so/5ac85eae871c486fa8931bfe60262180" class="ColorfulBlock ColorfulBlock--ColorDefault Text"><p class="Text__Content"><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">espflash.toml 文件位置:</mark></span></span></p></div><ol class="NumberedListWrapper"><li id="https://www.notion.so/4f7b924019454b1a9be7ace83147b63f" class="NumberedList" value="1"><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">项目目录(Cargo.toml 所在目录);</mark></span></span></li><li id="https://www.notion.so/ee75fe9c14874b45a9a68ee7a76b07d1" class="NumberedList" value="2"><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">workspace 根目录;</mark></span></span></li><li id="https://www.notion.so/409e6a6134964608b59abfc52ccd11d2" class="NumberedList" value="3"><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">$HOME/Library/Application Support/rs.esp.espflash/espflash.toml</mark></span></span></li></ol><div id="https://www.notion.so/ab32b6dbe42b40cebc7562827824c580" class="ColorfulBlock ColorfulBlock--ColorDefault Text"><p class="Text__Content"><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">monitor 日志格式:espflash 的 flash 和 monitor 子命令支持 -L/–log-format 参数指定日志格式:</mark></span></span></p></div><ol class="NumberedListWrapper"><li id="https://www.notion.so/762b3678d07047cea0d26d92d0e548f3" class="NumberedList" value="1"><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault"><code class="SemanticString__Fragment SemanticString__Fragment--Code">serial</code></mark></span><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">: Default logging format</mark></span></span></li><li id="https://www.notion.so/709ff1c5d3d74c94bb3d54482217ec33" class="NumberedList" value="2"><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault"><code class="SemanticString__Fragment SemanticString__Fragment--Code">defmt</code></mark></span><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault"> : Uses [defmt] logging framework. With logging format, logging strings have framing bytes to indicate that they are defmt messages.</mark></span></span><ul class="BulletedListWrapper"><li id="https://www.notion.so/684b8201f66444b5ac607cc8619e4eeb" class="BulletedList"><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">一般是在 no_std 应用中使用,需要和 esp-println crate 联合使用。</mark></span></span></li></ul></li></ol><div id="https://www.notion.so/7dc81d1c20e8418dbfff2436e0d4e181" class="ColorfulBlock ColorfulBlock--ColorDefault Text"><p class="Text__Content"><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">Establishing a serial connection with the ESP32-S3 target device could be done using </mark></span><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault"><code class="SemanticString__Fragment SemanticString__Fragment--Code">USB-to-UART bridge</code></mark></span><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault"> or </mark></span><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault"><code class="SemanticString__Fragment SemanticString__Fragment--Code">USB peripheral</code></mark></span><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault"> supported in ESP32-S3. For the ESP32-S3, </mark></span><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault"><code class="SemanticString__Fragment SemanticString__Fragment--Code">the USB peripheral</code></mark></span><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault"> is available, allowing you to flash the binaries </mark></span><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault"><code class="SemanticString__Fragment SemanticString__Fragment--Code">without the need for an external USB-to-UART bridge</code></mark></span><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">.</mark></span></span></p></div><div id="https://www.notion.so/1be893ef87364afd92facd5118615ede" class="ColorfulBlock ColorfulBlock--ColorDefault Text"><p class="Text__Content"><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">If you are flashing for the first time, you need to get the ESP32-S3 into </mark></span><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault"><code class="SemanticString__Fragment SemanticString__Fragment--Code">the download mode</code></mark></span><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault"> manually. To do so, press and </mark></span><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault"><code class="SemanticString__Fragment SemanticString__Fragment--Code">hold the BOOT button and then press the RESET button once</code></mark></span><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">. After that release the BOOT button.</mark></span></span></p></div><div id="https://www.notion.so/8cdc29ca3bf746af9daaf8d7bd17578f" class="ColorfulBlock ColorfulBlock--ColorDefault Text"><p class="Text__Content"><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">在线下载固件和烧写:esp-launchpad,它使用 USB-Serial-JTAG 接口, 例如在线下载和</mark></span><span class="SemanticString"><a class="SemanticString__Fragment SemanticString__Fragment--Link" href="https://espressif.github.io/esp-launchpad/?flashConfigURL=https://espressif.github.io/esp-box/launchpad.toml"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">烧写 esp-box 固件</mark></a></span></span></p></div><ul class="BulletedListWrapper"><li id="https://www.notion.so/fcc95aaeeaed451facdded9e7ed9e842" class="BulletedList"><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">如果烧写了 USB-OTG 应用(如摄像头),则可能不能找到设备,这时可以按住 BOOT 按钮的同时按 RST 按钮将芯片至于 download 模式,这时芯片内 USB PHY 会连接 USB-Serial-JTAG Controller。</mark></span></span></li></ul><div id="https://www.notion.so/d7c68ddfdda3482893e5a21654bc12ef" class="ColorfulBlock ColorfulBlock--ColorDefault Text"><p class="Text__Content"><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">probe-rs:embassy 使用 probe-rs 来烧写和调试:</mark></span></span></p></div><ol class="NumberedListWrapper"><li id="https://www.notion.so/4aee22539d0f47a6a03cc22750f7fe43" class="NumberedList" value="1"><span class="SemanticStringArray"><span class="SemanticString"><a class="SemanticString__Fragment SemanticString__Fragment--Link" href="https://embassy.dev/book/dev/getting_started.html"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">https://embassy.dev/book/dev/getting_started.html</mark></a></span></span></li><li id="https://www.notion.so/0a62e74099f94210990ee0c31bbece3b" class="NumberedList" value="2"><span class="SemanticStringArray"><span class="SemanticString"><a class="SemanticString__Fragment SemanticString__Fragment--Link" href="https://embassy.dev/book/dev/project_structure.html"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">https://embassy.dev/book/dev/project_structure.html</mark></a></span></span></li></ol><div id="https://www.notion.so/4d3beefec0e44176921a7520352da397" class="ColorfulBlock ColorfulBlock--ColorDefault Text"><p class="Text__Content"><span class="SemanticStringArray"></span></p></div><ul id="https://www.notion.so/a9a726cddcd9477d90a5d66704b12913" class="ColorfulBlock ColorfulBlock--ColorGray TableOfContents"><li class="TableOfContents__Item"><a href="#https://www.notion.so/d231649270c047c9aa0b9f013f36269d"><div style="margin-left:0px"><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">espflash 是固件烧录和终端监视工具,基于 esptool.py.</mark></span></span></div></a></li><li class="TableOfContents__Item"><a href="#https://www.notion.so/f65b88f6ea0d4b52a42eee9d826324e0"><div style="margin-left:24px"><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">cargo run: 在项目的 .cargo/config.toml 中添加如下内容, 然后就可以执行 cargo run 来 flash 和 monitor 应用:</mark></span></span></div></a></li><li class="TableOfContents__Item"><a href="#https://www.notion.so/d01b9f3f60f74bf99661d762815d4643"><div style="margin-left:24px"><span class="SemanticStringArray"><span class="SemanticString"><mark class="SemanticString__Fragment SemanticString__Fragment--HighlightedColor SemanticString__Fragment--ColorDefault">espflash 配置文件 espflash.toml:</mark></span></span></div></a></li></ul></article>
<aside class="Aside">
<a href="#content-html"><div id="up">👆</div></a>
<a href="#message-board"><div id="down">👇</div></a>
</aside>
<div id="message-board"></div>
<script src="https://utteranc.es/client.js"
repo="syx-413/syx-413.github.io"
issue-term="pathname"
theme="boxy-light"
crossorigin="anonymous"
async>
</script>
<footer class="Footer">
<div>
© 413’s Website 2020~2024
</div>
<div>
·
</div>
<div>
Powered by
<a href="https://github.com/syx-413" target="_blank" rel="noopener noreferrer"> notablog</a>.
</div>
</footer>
</body>
</html>