# esptool.py
A Python-based, open source, platform independent, utility to communicate with the ROM bootloader in Espressif ESP8266 & ESP32 chips.
esptool.py was started by Fredrik Ahlberg (@[themadinventor](https://github.com/themadinventor/)) as an unofficial community project. It is now also supported by Espressif. Current primary maintainer is Angus Gratton (@[projectgus](https://github.com/projectgus/)).
esptool.py is Free Software under a GPLv2 license.
[![Build Status](https://travis-ci.org/espressif/esptool.svg?branch=master)](https://travis-ci.org/espressif/esptool)
## Installation / dependencies
### Easy Installation
You will need [either Python 2.7 or Python 3.4 or newer](https://www.python.org/downloads/) installed on your system.
The latest stable esptool.py release can be installed from [pypi](http://pypi.python.org/pypi/esptool) via pip:
```
$ pip install esptool
```
With some Python installations this may not work and you'll receive an error, try `python -m pip install esptool` or `pip2 install esptool`.
After installing, you will have `esptool.py` installed into the default Python executables directory and you should be able to run it with the command `esptool.py`.
### Manual Installation
Manual installation allows you to run the latest development version from this repository.
esptool.py depends on [pySerial](https://github.com/pyserial/pyserial#readme) version 2.5 or newer for serial communication with the target device.
If you choose to install esptool.py system-wide by running `python setup.py install`, then this will be taken care of automatically.
If not using `setup.py`, then you'll have to install pySerial manually by running something like `pip install pyserial`, `easy_install pyserial` or `apt-get install python-serial`, depending on your platform. (The official pySerial installation instructions are [here](https://pyserial.readthedocs.org/en/latest/pyserial.html#installation)).
esptool.py also bundles the pyaes & ecdsa Python modules as "vendored" libraries. These modules are required when using the ESP32-only `espsecure.py` and `espefuse.py` tools. If you install esptool.py via `pip` or `setup.py` as shown above, then versions of these libraries will be installed from pypi. If you run esptool.py from the repository directory directly, it will use the "vendored" versions.
## Usage
Use `esptool.py -h` to see a summary of all available commands and command line options.
To see all options for a particular command, append `-h` to the command name. ie `esptool.py write_flash -h`.
## Common Options
### Serial Port
* The serial port is selected using the `-p` option, like `-p /dev/ttyUSB0` (Linux and macOS) or `-p COM1` (Windows).
* A default serial port can be specified by setting the `ESPTOOL_PORT` environment variable.
* If no `-p` option or `ESPTOOL_PORT` value is specified, `esptool.py` will enumerate all connected serial ports and try each one until it finds an Espressif device connected (new behaviour in v2.4.0).
Note: Windows and macOS may require drivers to be installed for a particular USB/serial adapter, before a serial port is available. Consult the documentation for your particular device. On macOS, you can also consult [System Information](https://support.apple.com/en-us/HT203001)'s list of USB devices to identify the manufacturer or device ID when the adapter is plugged in. On Windows, you can use [Windows Update or Device Manager](https://support.microsoft.com/en-us/help/15048/windows-7-update-driver-hardware-not-working-properly) to find a driver.
If using Cygwin or WSL on Windows, you have to convert the Windows-style name into an Unix-style path (`COM1` -> `/dev/ttyS0`, and so on). (This is not necessary if using esp-idf for ESP32 with the supplied Windows MSYS2 environment, this environment uses a native Windows Python which accepts COM ports as-is.)
In Linux, the current user may not have access to serial ports and a "Permission Denied" error will appear. On most Linux distributions, the solution is to add the user to the `dialout` group with a command like `sudo usermod -a -G dialout <USERNAME>`. Check your Linux distribution's documentation for more information.
### Baud rate
The default esptool.py baud rate is 115200bps. Different rates may be set using `-b 921600` (or another baudrate of your choice). A default baud rate can also be specified using the `ESPTOOL_BAUD` environment variable. This can speed up `write_flash` and `read_flash` operations.
The baud rate is limited to 115200 when esptool.py establishes the initial connection, higher speeds are only used for data transfers.
Most hardware configurations will work with `-b 230400`, some with `-b 460800`, `-b 921600` and/or `-b 1500000` or higher.
If you have connectivity problems then you can also set baud rates below 115200. You can also choose 74880, which is the usual baud rate used by the ESP8266 to output [boot log](#boot-log) information.
## Commands
### Write binary data to flash: write_flash
Binary data can be written to the ESP's flash chip via the serial `write_flash` command:
```
esptool.py --port COM4 write_flash 0x1000 my_app-0x01000.bin
```
Multiple flash addresses and file names can be given on the same command line:
```
esptool.py --port COM4 write_flash 0x00000 my_app.elf-0x00000.bin 0x40000 my_app.elf-0x40000.bin
```
The `--chip` argument is optional when writing to flash, esptool will detect the type of chip when it connects to the serial port.
The `--port` argument is documented under [Serial Port](#serial-port).
The next arguments to write_flash are one or more pairs of offset (address) and file name. When generating ESP8266 "version 1" images, the file names created by `elf2image` include the flash offsets as part of the file name. For other types of images, consult your SDK documentation to determine the files to flash at which offsets.
Numeric values passed to write_flash (and other commands) can be specified either in hex (ie 0x1000), or in decimal (ie 4096).
See the [Troubleshooting](#troubleshooting) section if the write_flash command is failing, or the flashed module fails to boot.
#### Setting flash mode and size
You may also need to specify arguments for [flash mode and flash size](#flash-modes), if you wish to override the defaults. For example:
```
esptool.py --port /dev/ttyUSB0 write_flash --flash_mode qio --flash_size 32m 0x0 bootloader.bin 0x1000 my_app.bin
```
Since esptool v2.0, these options are not often needed as the default is to keep the flash mode and size from the `.bin` image file, and to detect the flash size. See the [Flash Modes](#flash-modes) section for more details.
#### Compression
By default, the serial transfer data is compressed for better performance. The `-u/--no-compress` option disables this behaviour.
### Read Flash Contents: read_flash
The read_flash command allows reading back the contents of flash. The arguments to the command are an address, a size, and a filename to dump the output to. For example, to read a full 2MB of attached flash:
```
./esptool.py -p PORT -b 460800 read_flash 0 0x200000 flash_contents.bin
```
(Note that if `write_flash` updated the boot image's [flash mode and flash size](#flash-modes) during flashing then these bytes may be different when read back.)
### Erase Flash: erase_flash & erase region
To erase the entire flash chip (all data replaced with 0xFF bytes):
```
esptool.py erase_flash
```
To erase a region of the flash, starting at address 0x20000 with length 0x4000 bytes (16KB):
```
esptool.py erase_region 0x20000 0x4000
```
The address and length must both be multiples of the SPI flash erase sector size. This is 0x1000 (4096) bytes for supported flash chips.
### Read built-in MAC address: read_mac
```
esptool.py read_mac
```
### Read SPI flash id: flash_id
```
esptool.py flash_id
```
Example output:
```
Manufacturer: e0
Device: 4016
Detected flash size: 4MB
```
Refer to [flashrom source code](h
没有合适的资源?快使用搜索试试~ 我知道了~
ESP8266-RTOS-SDK release v3.4
共2000个文件
c:713个
h:653个
txt:255个
需积分: 1 0 下载量 44 浏览量
2024-09-07
22:21:03
上传
评论
收藏 194.97MB RAR 举报
温馨提示
esp8266 freertosSDK V3.4,乐鑫为开发者提供的物联网(IOT)应用开发平台,包括基础平台以及上层应用开发示例,如智能灯、智能开关等。使用FreeRTOS系统,引入OS多任务处理机制,用户可以使用FreeRTOS的标准接口实现资源管理、循环操作、任务内延时、任务间信息传递和同步等面向任务流程的设计方式,网络操作接口是标准的lwIP API,同时提供了BSD Socket API接口的封装实现,用户可以直接安装Socket API的使用方式来开发软件应用,也可以直接编译运行其他平台的标准Socket应用,有效降低平台切换的学习成本,引入了CJSON库,使用该库函数可以更加方便的实现对JSON数据包的解析。SDK中WiFi接口、SmartConfig接口、Sniffer相关接口、系统接口、定时器接口、FOTA接口和外围驱动接口,不支持AT实现。目前V3.4是乐鑫 最新的SDK。
资源推荐
资源详情
资源评论
收起资源包目录
ESP8266-RTOS-SDK release v3.4 (2000个子文件)
ffunicode.c 1.87MB
ssl_tls.c 312KB
ff.c 223KB
miniz.c 221KB
tasks.c 165KB
mdns.c 161KB
argtable3.c 151KB
ssl_srv.c 149KB
sockets.c 140KB
ssl_cli.c 121KB
testunity.c 121KB
certs.c 105KB
ssl_server2.c 105KB
ssl_ciphersuites.c 102KB
protobuf-c.c 93KB
ecp.c 93KB
queue.c 90KB
httpd.c 89KB
tcp.c 87KB
nd6.c 84KB
rsa.c 83KB
tcp_in.c 82KB
x509_crt.c 79KB
dhcp.c 78KB
test-generated-code2.c 77KB
snmp_msg.c 75KB
mdns.c 75KB
tcp_out.c 75KB
cJSON.c 72KB
aes.c 72KB
lcp.c 72KB
query_config.c 72KB
bignum.c 71KB
ssl_client2.c 70KB
http_parser.c 70KB
api_msg.c 69KB
mqtt_client.c 68KB
auth.c 63KB
ipcp.c 62KB
eap.c 61KB
ecp_curves.c 57KB
cipher_wrap.c 54KB
ip6.c 54KB
dns.c 53KB
ringbuf.c 53KB
test_tcp.c 53KB
manager.c 52KB
netif.c 51KB
esp_http_client.c 49KB
pbuf.c 49KB
unity.c 48KB
smtp.c 47KB
mqtt.c 47KB
test_event.c 47KB
ccp.c 47KB
ppp.c 47KB
error.c 46KB
pkparse.c 46KB
etharp.c 46KB
udp.c 44KB
api_lib.c 43KB
coap_io.c 43KB
ip4.c 42KB
esp_image_format.c 42KB
snmp_core.c 41KB
stream_buffer.c 41KB
unity.c 41KB
ipv6cp.c 41KB
altcp_tls_mbedtls.c 40KB
tcpip_adapter_lwip.c 40KB
port_tcp_master.c 40KB
makefsdata.c 40KB
vfs.c 40KB
pppol2tp.c 39KB
cJSON_Utils.c 39KB
test_dhcp.c 39KB
nconf.c 38KB
gconf.c 38KB
ecjpake.c 38KB
aria.c 38KB
dhcpserver.c 38KB
timers.c 38KB
pppoe.c 37KB
aes.c 37KB
camellia.c 36KB
mem.c 35KB
benchmark.c 35KB
linenoise.c 34KB
test_tcp_oos.c 34KB
cipher.c 34KB
lwiperf.c 33KB
lowpan6_common.c 33KB
ssl_lib.c 33KB
cmac.c 32KB
mdns_console.c 32KB
chap_ms.c 32KB
des.c 32KB
mbc_tcp_master.c 32KB
ecdsa.c 31KB
gcm.c 31KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
阿甘的小窝
- 粉丝: 31
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 技术资料分享Z-Stack-API-Chinese非常好的技术资料.zip
- 技术资料分享Z-Stack 开发指南非常好的技术资料.zip
- 技术资料分享Zigbee协议栈中文说明免费非常好的技术资料.zip
- 技术资料分享Zigbee协议栈及应用实现非常好的技术资料.zip
- 技术资料分享ZigBee协议栈的研究与实现非常好的技术资料.zip
- 技术资料分享ZigBee协议栈的分析与设计非常好的技术资料.zip
- 技术资料分享Zigbee协议栈OSAL层API函数(译)非常好的技术资料.zip
- 技术资料分享zigbee无信标网络设备的加入非常好的技术资料.zip
- 技术资料分享ZigBee问答之“KVP”、“MSG”非常好的技术资料.zip
- 技术资料分享ZigBee网络管理实验例程手册非常好的技术资料.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功