82 Commits

Author SHA1 Message Date
radim.karnis
a7df5d3bee bugfix: Adjust wrapper scripts to not import themselves 2023-05-22 14:37:02 +00:00
radim.karnis
57ebe08d7a style: Remove unnecessary shebangs
Closes https://github.com/espressif/esptool/pull/822
2023-01-23 15:23:40 +01:00
radim.karnis
45c511de74 bugfix: Prevent importing wrapper scripts instead of modules
Closes https://github.com/espressif/esptool/issues/740

Closes https://github.com/espressif/esptool/pull/742
2022-05-24 09:10:55 +02:00
radim.karnis
30821a3f93 Make esptool callable as esptool.py even on Unix systems 2022-05-05 22:22:17 +02:00
radim.karnis
45f1da954e refactoring: Employ Black code formatting 2022-03-28 23:06:34 +02:00
radim.karnis
513898db2a refactoring: Restructure espefuse and espsecure 2022-03-28 23:05:04 +02:00
radim.karnis
aee798dbe4 refactoring: Separate executable logic 2022-03-28 23:05:04 +02:00
radim.karnis
4875e8906f refactoring: Initial structure 2022-03-28 23:05:02 +02:00
KonstantinKondrashov
66e1f163a4 espefuse: Show help when espefuse without commands 2022-03-04 18:54:41 +08:00
KonstantinKondrashov
5d0fae4a34 efuse: Support multiple cmds
Useful when we need to write eFuses with several different commands,
the BURN operation will be done once at the end.

espefuse.py -c esp32c2 --virt --do-not-confirm  \
    burn_key_digest secure_images/ecdsa256_secure_boot_signing_key_v2.pem  \
    burn_key BLOCK_KEY0 images/efuse/128bit_key XTS_AES_128_KEY_DERIVED_FROM_128_EFUSE_BITS
2022-03-03 00:07:52 +08:00
KonstantinKondrashov
dc90487b98 espefuse: Support esp32-c2 2022-02-07 20:53:13 +08:00
radim.karnis
aa608227b5 Update copyright dates 2022-01-10 11:29:08 +01:00
Konstantin Kondrashov
d29880b267 espefuse: execute_scripts can be run nested way, burn occurs once after the last script 2021-12-16 13:48:59 +00:00
laokaiyao
6b582c2b92 esp32h2: add esp32h2 beta2 target 2021-11-15 19:11:10 +08:00
Roland Dobai
269c38f908 Update license headers in the short SPDX format 2021-10-26 15:59:35 +02:00
Yegor Yefremov
df13de2788 Replace license header and copyright information with SPDX identifiers
This approach follows the one suggested by REUSE project.

https://reuse.software/spec/

Closes https://github.com/espressif/esptool/pull/476
2021-10-26 14:01:55 +02:00
radim.karnis
c28815b783 espefuse: Free the port after operations
Closes https://github.com/espressif/esptool/issues/671
2021-10-19 11:29:13 +02:00
KonstantinKondrashov
2583017317 espefuse: Fixes execute_scripts, it should call BURN once at the end 2021-08-19 22:10:28 +08:00
KonstantinKondrashov
ecb8275c49 espefuse.py: All arguments are avalible for using in operation_func 2021-07-12 15:48:09 +08:00
radim.karnis
3f6ff86ba5 esp32h2: Add espefuse support 2021-06-15 08:56:54 +02:00
Marius Vikhammer
b03a044d35 Replaced ESP32-S3 Beta 3 support with ESP32-S3 support
Adds basic support for flashing, stub and efuses for S3.
2021-06-03 10:01:06 +08:00
Marius Vikhammer
a605890d6f Support ESP32S3 Beta 3 2021-03-09 09:17:08 +08:00
radim.karnis
dd97d7cb68 Added custom commandline arg to main
Closes https://github.com/espressif/esptool/issues/563
2020-12-16 17:47:27 +01:00
KonstantinKondrashov
456384ca33 espefuse: Add support ESP32-S3BETA2 2020-10-14 13:02:24 +08:00
KonstantinKondrashov
bb8446418c espefuse: Add support ESP32-C3
- Added support ESP32-C3
- Updated ports for ESP32 and ESP32S2
2020-10-13 21:44:49 +08:00
Angus Gratton
07c1c8370e flake8: Update files to pass all flake8 conditions, including plugins and some previously excluded warnings 2020-10-05 11:55:15 +11:00
KonstantinKondrashov
1e68042925 espefuse: Add support virtual operations (without connecting to a chip) + HOST_TESTs
- added write/read protection feature
Closes: ESPTOOL-34
2020-08-19 14:52:06 +08:00
Angus Gratton
b8aaa0865c espefuse: Sort the categories in 'espefuse.py summary' output
When using set(), categories print in a non-deterministic order.

As reported https://github.com/espressif/esp-idf/issues/5467#issuecomment-646906911
2020-06-30 15:38:56 +10:00
KonstantinKondrashov
cb5297f5bf espefuse: Add support ESP32-S2 and Refactoring
Refactors the espefuse.py and adds support ESP32-S2 chip.

CMDs|ESP32|ESP32-S2|Batch burn mode|
dump|+|+|
summary|+|+|
read_protect_efuse|+|+|+|
write_protect_efuse|+|+|+|
burn_efuse|+|+|+|
burn_key|+|+|+|
burn_block_data|+|+|+|
burn_key_digest|+|+|+|
get_custom_mac|+|-|not support|
burn_custom_mac|+|-|not support|
set_flash_voltage|+|+|
adc_info|+|+|
burn_bit|+|+|

- Refactored corresponding with the new structure (see picture above)
- Using the bitstring lib to operate fields and blocks easy.
- Reading only once all blocks at init time. (No need to read each field separately)
- Burning through burn_all(). It analyzes errors and the possibility to write the new value of blocks. This approach allows us to save necessary efuses or blocks and burn them in once time. Applying the coding scheme is done in burn_all(). Not necessary to do the special conversion as it was for burn_custom_mac.
- To burn the new value of efuses/blocks need to call: efuse1.save(new_value1) ... efuseN.save(new_valueN) efuses.burn_all().
- Added the new command - set_bit. ./espefuse.py set_bit BLOCK10 0 1 2 4 8 16 32 64 96 128 160 192 224 255
- Unlike the previous !40 (closed) MR this MR has support set_flash_voltage and adc_info commands. Need to check format with esp32_s2_calibration.pdf
- Added a check of the burn values of blocks and fields. The burn is going from HI_num block to LOW_num block. It allows to read back burn block/field and compare it with expected writing value.
- Improved the description of messages to give the user understanding of what is going on.
- Added the new feature to save the whole dump of blocks to files, and after to burn those files with burn_block_data. Useful for testing.
- Added debug mode: flag -d, --debug. Prints more msgs.
- Implemented the approach if we need to hid some fields from the user depend on another. (see MAC_VERSION, BLOCK2_VERSION - calibration ADC)
- read_protect_efuse, write_protect_efuse, burn_efuse, burn_key, burn_block_data, burn_key_digest support the batch burn mode.
- Updated test_espefuse.py (ESP32, ESP32-S2)

Closes: ESPTOOL-4, ESPTOOL-10
2020-04-24 15:23:22 +08:00
Supreet Deshpande
9f87460a29 feat/eco3_secure_boot_v2: Update Secure Boot V2 utilities 2020-02-21 17:22:06 +11:00
Angus Gratton
6ba165d802 espefuse/espsecure: Small fixes to secure boot v2 utilities 2020-01-30 11:22:36 +05:30
Angus Gratton
3be9dcca5d espefuse.py: Add UART_DOWNLOAD_DIS efuse 2020-01-30 11:22:36 +05:30
Angus Gratton
0a0f83b28f espefuse: Support burning key digest for Secure Boot V2 2020-01-30 11:22:36 +05:30
Roland Dobai
9d3e318a54 espefuse: Fix custom MAC burning with coding scheme 34
Closes https://github.com/espressif/esptool/issues/447
2019-08-14 17:25:57 +10:00
suda-morris
1a7dbf787e support detection of ESP32 revisions 2 & 3 2019-07-30 12:04:52 +08:00
Stanislas Bertrand ( Witekio )
996e8c3297 ESP Efuse : Get selected efuse value as JSON object (#436)
* ESP Efuse : Get selected efuse value as JSON object

* Add json format and export to file for efuse summary

* espefuse : summary - fix coding style
2019-07-11 17:47:18 +10:00
Angus Gratton
3b088c077e espefuse: Set efuse clock registers before burning 2019-04-17 10:15:05 +10:00
Angus Gratton
b4c418a5d9 espefuse: Change FLASH_CRYPT_CNT to 7 bits wide, 8th bit is ignored 2019-04-02 16:47:37 +11:00
Hemal Gujarathi
aa1a3d2917 esptool : support encrypted flash write command for app binary 2019-03-08 09:07:53 +08:00
Angus Gratton
33cabffb3e Fix over-indentations caught by newer pep8/flake8 version 2019-02-04 19:06:21 +11:00
Roland Dobai
61b208e235 espefuse: Add custom MAC into BLK3 2018-10-30 12:06:37 +01:00
Angus Gratton
8dee0921d7 espefuse.py: Add burn_block_data command for writing parts of efuse blocks 2018-10-12 12:47:20 +11:00
Angus Gratton
29e6251feb espefuse: Fix some incorrect read & write protect masks 2018-10-12 12:47:05 +11:00
Angus Gratton
fde8dd2bcf espefuse: Support for writing keys in 3/4 Coding Scheme & standardize key representations
* Add support for `burn_key` with 192-bit keys (3/4 Coding Scheme) and 256-bit (standard Coding
  Scheme)

Also fix some inconsistency in key data representation:

* The order of bytes used by hardware AES is reversed compared to conventional byte order
  in EFUSE registers. (This is true for both 256-bit and 192-bit keys.)
* So when flashing via `burn_key`, the byte order is automatically reversed before the key is
  written.
* Previously, "espefuse.py summary" would reverse the byte order when displaying block contents, for
  consistency with the original key file, but it now shows the "real" byte order (ie reversed
  bytes).
* EfuseKeyblockField class now has burn_key() & get_key() methods (work with a standard AES key
  format, ie swap bytes when reading/writing efuse). The original burn() and get() methods return
  the "real" byte order.
* For most users this won't make a difference as the key in efuse is read protected anyhow.
2018-10-12 12:47:05 +11:00
Angus Gratton
9718ebd457 espefuse summary: Display read-protected efuses as "?" not 0 2018-10-12 12:25:12 +11:00
Angus Gratton
86be858aa1 espefuse summary: Print a column heading above the summary output 2018-10-04 16:21:32 +10:00
Angus Gratton
9df8c5527c espefuse: Create EspEfuses class to encapsulate data about all efuses on chip 2018-10-04 16:21:32 +10:00
Angus Gratton
f2daa444c8 espefuse: Disable burning keys when 3/4 Coding Scheme is set 2018-09-27 10:07:55 +10:00
Tim Nordell
aff9476142 espefuse: Add support for external setting of baud rate
This additional command requires an external entity to already have
modified the baud rate of the ESP32 to match, or this has to be
against a "pass through" entity which runs at this higher baud rate.

Signed-off-by: Tim Nordell <tim.nordell@nimbelink.com>
2018-04-24 10:18:41 -05:00
Tim Nordell
74ad6824e0 esptool, espefuse: Add new argument "--before no_sync_no_reset"
We have a board designed which has the UART to the ESP32 as a passthrough from
another microcontroller.  As such, it's easier to send the sync sequence and
change the baud rate on the microcontroller side of things than to pass this
change through from the PC.  Adding this new option allows the intermediate
microcontroller to run the sync sequence and to set the appropriate baud rate
on the ESP32 side of things.  For this use case, we need to avoid sending the
change baud rate sequence (the PC baud rate is not necessarily the same as
the microcontroller <-> ESP32) and avoid sending the sync sequence.

Signed-off-by: Tim Nordell <tim.nordell@nimbelink.com>
2018-04-24 10:18:22 -05:00