├── .gitignore ├── CubicAIO_Tool.exe ├── CubicAIO_Tool.py ├── Holo.png ├── README.md ├── boot_app0.bin ├── bootloader_qio_80m.bin ├── cubictool.json ├── holo_256.ico ├── image ├── folder.png ├── img.png ├── php.png ├── python.png └── text_file.png ├── page ├── __init__.py ├── download_debug.py ├── filemanager.py ├── help.py ├── images_converter.py ├── setting.py └── videotool.py ├── partitions.bin ├── partitions ├── app3M_fat9M_16MB.csv ├── boot_app0.bin ├── default.bin ├── default.csv ├── default_16MB.csv ├── default_8MB.csv ├── default_ffat.csv ├── ffat.csv ├── huge_app.csv ├── large_spiffs_16MB.csv ├── min_spiffs.csv ├── minimal.csv ├── no_ota.csv ├── noota_3g.csv ├── noota_3gffat.csv └── noota_ffat.csv ├── tool_esptoolpy ├── .github │ ├── ISSUE_TEMPLATE │ │ ├── bug-report-no-hardware.md │ │ ├── config.yml │ │ ├── feature_request.md │ │ └── issue-with-attached-hardware.md │ ├── pull_request_template.md │ └── workflows │ │ ├── build_esptool.yml │ │ ├── issue_comment.yml │ │ ├── new_issues.yml │ │ ├── new_prs.yml │ │ ├── release_esptool_pypi.yml │ │ └── test_esptool.yml ├── .gitignore ├── .gitlab-ci.yml ├── .piopm ├── CONTRIBUTING.md ├── LICENSE ├── MANIFEST.in ├── README.md ├── __init__.py ├── build_tools │ ├── Sign-File.ps1 │ └── espressif.ico ├── cubic_tool.py ├── esp_rfc2217_server.py ├── espefuse.py ├── espressif │ ├── __init__.py │ └── efuse │ │ ├── __init__.py │ │ ├── base_fields.py │ │ ├── base_operations.py │ │ ├── emulate_efuse_controller_base.py │ │ ├── esp32 │ │ ├── __init__.py │ │ ├── emulate_efuse_controller.py │ │ ├── fields.py │ │ ├── mem_definition.py │ │ └── operations.py │ │ ├── esp32c3 │ │ ├── __init__.py │ │ ├── emulate_efuse_controller.py │ │ ├── fields.py │ │ ├── mem_definition.py │ │ └── operations.py │ │ ├── esp32s2 │ │ ├── __init__.py │ │ ├── emulate_efuse_controller.py │ │ ├── fields.py │ │ ├── mem_definition.py │ │ └── operations.py │ │ ├── esp32s3beta2 │ │ ├── __init__.py │ │ ├── emulate_efuse_controller.py │ │ ├── fields.py │ │ ├── mem_definition.py │ │ └── operations.py │ │ ├── esp32s3beta3 │ │ ├── __init__.py │ │ ├── emulate_efuse_controller.py │ │ ├── fields.py │ │ ├── mem_definition.py │ │ └── operations.py │ │ ├── mem_definition_base.py │ │ └── util.py ├── espsecure.py ├── esptool.py ├── flasher_stub │ ├── Makefile │ ├── README.md │ ├── compare_stubs.py │ ├── esptool_test_stub.py │ ├── include │ │ ├── miniz.h │ │ ├── rom_functions.h │ │ ├── slip.h │ │ ├── soc_support.h │ │ ├── stub_commands.h │ │ ├── stub_flasher.h │ │ ├── stub_io.h │ │ └── stub_write_flash.h │ ├── ld │ │ ├── rom_32.ld │ │ ├── rom_32c3.ld │ │ ├── rom_32c6_beta.ld │ │ ├── rom_32s2.ld │ │ ├── rom_32s3_beta_2.ld │ │ ├── rom_32s3_beta_3.ld │ │ ├── rom_8266.ld │ │ ├── stub_32.ld │ │ ├── stub_32c3.ld │ │ ├── stub_32c6_beta.ld │ │ ├── stub_32s2.ld │ │ ├── stub_32s3_beta_2.ld │ │ ├── stub_32s3_beta_3.ld │ │ └── stub_8266.ld │ ├── miniz.c │ ├── run_tests_with_stub.sh │ ├── slip.c │ ├── stub_commands.c │ ├── stub_flasher.c │ ├── stub_io.c │ ├── stub_write_flash.c │ └── wrap_stub.py ├── package.json ├── setup.cfg ├── setup.py └── test │ ├── .covconf │ ├── README.md │ ├── ci │ ├── multirun_with_pyenv.sh │ └── setup_ci_build_env.sh │ ├── ecdsa_secure_boot_signing_key2.pem │ ├── elf2image │ ├── esp32-app-cust-ver-info.elf │ ├── esp32-app-template.elf │ ├── esp32-bootloader.elf │ ├── esp32-too-many-sections.elf │ ├── esp32-too-many-sections │ │ └── Makefile │ ├── esp32-zephyr.elf │ ├── esp8266-nonossdkv12-example.elf │ ├── esp8266-nonossdkv20-at-v2.elf │ ├── esp8266-nonosssdk20-iotdemo.elf │ └── esp8266-openrtos-blink-v2.elf │ ├── images │ ├── aes_key.bin │ ├── bootloader_esp32.bin │ ├── bootloader_esp32c3.bin │ ├── bootloader_esp32s2.bin │ ├── bootloader_esp32s3beta2.bin │ ├── bootloader_esp32s3beta3.bin │ ├── efuse │ │ ├── 128bit │ │ ├── 192bit │ │ ├── 192bit_1 │ │ ├── 192bit_2 │ │ ├── 224bit │ │ ├── 256bit │ │ ├── 256bit_1 │ │ └── 256bit_2 │ ├── esp8266_deepsleep.bin │ ├── esp8266_sdk │ │ ├── 4096_user1.bin │ │ ├── blank.bin │ │ ├── boot_v1.4(b1).bin │ │ └── esp_init_data_default.bin │ ├── fifty_kb.bin │ ├── helloworld-esp32_edit.bin │ ├── nodemcu-master-7-modules-2017-01-19-11-10-03-integer.bin │ ├── one_kb.bin │ ├── one_kb_all_ef.bin │ ├── one_mb.bin │ ├── onebyte.bin │ ├── partitions_singleapp.bin │ ├── ram_helloworld │ │ ├── helloworld-esp32.bin │ │ ├── helloworld-esp8266.bin │ │ └── source │ │ │ ├── Makefile │ │ │ ├── ld │ │ │ ├── app_32.ld │ │ │ ├── app_32c3.ld │ │ │ ├── app_32s2.ld │ │ │ ├── app_32s3.ld │ │ │ └── app_8266.ld │ │ │ └── main.c │ ├── sector.bin │ ├── unaligned.bin │ └── zerolength.bin │ ├── secure_images │ ├── 256bit_iv.bin │ ├── 256bit_key.bin │ ├── bootloader-encrypted-aes-xts.bin │ ├── bootloader-encrypted-conf0.bin │ ├── bootloader-encrypted-conf3.bin │ ├── bootloader-encrypted-conf9.bin │ ├── bootloader-encrypted-confc.bin │ ├── bootloader-encrypted.bin │ ├── bootloader.bin │ ├── bootloader_digested.bin │ ├── bootloader_multi_signed_v2.bin │ ├── bootloader_signed.bin │ ├── bootloader_signed_v2.bin │ ├── bootloader_unsigned_v2.bin │ ├── digest_iv.bin │ ├── ecdsa_secure_boot_signing_key.pem │ ├── ecdsa_secure_boot_signing_key2.pem │ ├── ecdsa_secure_boot_signing_key_pkcs8.pem │ ├── ecdsa_secure_boot_signing_pubkey.pem │ ├── ecdsa_secure_boot_signing_pubkey2.pem │ ├── ef-flashencryption-key.bin │ ├── hello-world-signed-encrypted-aes-xts.bin │ ├── hello-world-signed-encrypted.bin │ ├── hello-world-signed.bin │ ├── rsa_public_key_digest.bin │ ├── rsa_secure_boot_signing_key.pem │ ├── rsa_secure_boot_signing_key2.pem │ ├── rsa_secure_boot_signing_key3.pem │ ├── rsa_secure_boot_signing_key4.pem │ ├── rsa_secure_boot_signing_pubkey.pem │ ├── rsa_secure_boot_signing_pubkey2.pem │ └── rsa_secure_boot_signing_pubkey4.pem │ ├── sitecustomize.py │ ├── test_espefuse.py │ ├── test_espefuse_host.py │ ├── test_espsecure.py │ ├── test_esptool.py │ ├── test_imagegen.py │ ├── test_merge_bin.py │ └── test_modules.py └── util ├── __init__.py ├── common.py ├── convertor_core.py ├── file_info.py ├── massagehead.py ├── robotsocket.py ├── tkutils.py └── widget_base.py /.gitignore: -------------------------------------------------------------------------------- 1 | ffmpeg.exe 2 | *__pycache__* 3 | OutFile 4 | build/ 5 | dist/ 6 | .idea/ 7 | __pycache__/ 8 | CubicAIO_Tool.spec -------------------------------------------------------------------------------- /CubicAIO_Tool.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/CubicAIO_Tool.exe -------------------------------------------------------------------------------- /CubicAIO_Tool.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | ################################################################################ 3 | # 4 | # Author: ClimbSnail(HQ) 5 | # original source is here. 6 | # https://github.com/ClimbSnail/HoloCubic_AIO_Tool 7 | # 8 | # 9 | ################################################################################ 10 | 11 | from util.common import * 12 | import util.massagehead as mh 13 | from page.videotool import VideoTool 14 | from page.download_debug import DownloadDebug 15 | from page.setting import Setting 16 | from page.help import Helper 17 | from page.images_converter import ImagesConverter 18 | from page.filemanager import FileManager 19 | 20 | import os 21 | import tkinter as tk 22 | import util.tkutils as tku 23 | from tkinter import ttk 24 | from tkinter import messagebox 25 | 26 | 27 | class Engine(object): 28 | """ 29 | 引擎 30 | """ 31 | 32 | def __init__(self, root): 33 | """ 34 | 引擎初始化 35 | :param root:窗体控件 36 | """ 37 | self.root = root 38 | self.root.protocol("WM_DELETE_WINDOW", self.on_closing) 39 | self.root.iconbitmap("./holo_256.ico") # 窗体图标 40 | # 文件转化的创建输出目录 41 | try: 42 | dir_path = os.path.join("OutFile", "Cache") 43 | os.makedirs(dir_path) 44 | except Exception as e: 45 | pass 46 | 47 | self.width = 700 48 | self.height = 500 49 | 50 | # tk.tab tab页面的管理器 51 | self.m_tab_manager = ttk.Notebook(self.root) 52 | 53 | # 下载调试页面 54 | self.m_debug_tab = tk.Frame(self.m_tab_manager, bg="white") 55 | self.m_tab_manager.add(self.m_debug_tab, text="下载调试") 56 | self.m_debug_tab_windows = DownloadDebug(self.m_debug_tab, self) 57 | 58 | # 参数设置页面 59 | self.m_setting_tab = tk.Frame(self.m_tab_manager, bg="white") 60 | self.m_tab_manager.add(self.m_setting_tab, text="参数设置") 61 | self.m_setting_tab_windows = Setting(self.m_setting_tab, self) 62 | 63 | # 文件管理页面 64 | self.m_file_tab = tk.Frame(self.m_tab_manager, bg="white") 65 | self.m_tab_manager.add(self.m_file_tab, text="文件管理") 66 | self.m_file_tab_windows = FileManager(self.m_file_tab, self) 67 | 68 | # 图片转换页面 69 | self.m_image_tab = tk.Frame(self.m_tab_manager, bg="white") 70 | self.m_tab_manager.add(self.m_image_tab, text="图片转换") 71 | self.m_image_tab_windows = ImagesConverter (self.m_image_tab, self) 72 | 73 | # 视频转码页面 74 | self.m_video_tab = tk.Frame(self.m_tab_manager, bg="white") 75 | self.m_tab_manager.add(self.m_video_tab, text="视频转码") 76 | self.m_video_tab_windows = VideoTool(self.m_video_tab, self) 77 | 78 | # 屏幕分享页面 79 | self.m_srceen_tab = tk.Frame(self.m_tab_manager, bg="white") 80 | self.m_tab_manager.add(self.m_srceen_tab, text="屏幕分享") 81 | 82 | # 帮助页面 83 | self.m_help_tab = tk.Frame(self.m_tab_manager, bg="white") 84 | self.m_tab_manager.add(self.m_help_tab, text="帮助") 85 | self.m_help_tab_windows = Helper(self.m_help_tab, self) 86 | 87 | self.m_tab_manager.pack(expand=True, fill=tk.BOTH) 88 | 89 | def OnThreadMessage(self, fromwho, towho, action, param = None): 90 | """ 91 | 引擎的调度函数 控件利用此函数可间接操作或者获取其他控件的对应资源 92 | :param fromwho:表示调用者 93 | :param towho:表示请求操作的控件 94 | :param action:表示请求操作的操作类型 95 | :param param:操作请求所携带的参数(根据具体请求来指定参数类型) 96 | """ 97 | print(fromwho, towho, action, param) 98 | #info = fromwho+" "+towho+" "+action+" "+param 99 | #self.OnThreadMessage(mh.M_ENGINE, mh.M_SYSINFO, mh.A_INFO_PRINT, info+"\n") 100 | 101 | if towho == mh.M_DOWNLOAD_DEBUG: # 下载模块操作请求 102 | self.m_debug_tab_windows.api(action, param) # 处理消息 103 | 104 | elif towho == mh.M_SETTING: # 设置模块操作请求 105 | self.m_modelManager.api(action, param) 106 | 107 | def on_closing(self): 108 | """ 109 | 关闭主窗口时要触发的函数 110 | :return: None 111 | """ 112 | if self.m_file_tab_windows != None: 113 | self.m_file_tab_windows.__del__() 114 | del self.m_file_tab_windows 115 | self.m_file_tab_windows = None 116 | 117 | # if messagebox.askokcancel("Quit", "Do you want to quit?"): 118 | self.root.destroy() 119 | 120 | if self.m_debug_tab_windows != None: 121 | del self.m_debug_tab_windows 122 | self.m_debug_tab_windows = None 123 | 124 | if self.m_setting_tab_windows != None: 125 | del self.m_setting_tab_windows 126 | self.m_setting_tab_windows = None 127 | 128 | def OnThreadMessage(self, fromwho, towho, action, param=None): 129 | """ 130 | 引擎的调度函数 控件利用此函数可间接操作或者获取其他控件的对应资源(用函数模拟网络通信模型) 131 | :param fromwho:表示调用者 132 | :param towho:表示请求操作的控件 133 | :param action:表示请求操作的操作类型 134 | :param param:操作请求所携带的参数(根据具体请求来指定参数类型) 135 | """ 136 | print(fromwho, towho, action, param) 137 | 138 | if towho == mh.M_ENGINE and action == mh.A_UPDATALANG: # 更新请求 139 | self.m_modelManager.api(mh.A_UPDATALANG) # 按钮语言更新 140 | 141 | def __del__(self): 142 | """ 143 | 释放资源 144 | """ 145 | # del self.m_debug_tab_windows 146 | self.m_debug_tab_windows = None 147 | 148 | if self.m_file_tab_windows != None: 149 | self.m_file_tab_windows.__del__() 150 | del self.m_file_tab_windows 151 | self.m_file_tab_windows = None 152 | 153 | 154 | if __name__ == '__main__': 155 | tool_windows = tk.Tk() # 创建窗口对象的背景色 156 | tool_windows.title("HoloCubic_AIO Tools" + "\t " + VERSION) # 窗口名 157 | tool_windows.geometry('1000x655+10+10') 158 | tool_windows.resizable(False, False) # 设置窗体不可改变大小 159 | engine = Engine(tool_windows) 160 | tku.center_window(tool_windows) # 将窗体移动到屏幕中央 161 | 162 | # 进入消息循环 父窗口进入事件循环,可以理解为保持窗口运行,否则界面不展示 163 | tool_windows.mainloop() 164 | -------------------------------------------------------------------------------- /Holo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/Holo.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 迁移通知 2 | 目前本项目最新源码已迁移至 https://github.com/ClimbSnail/HoloCubic_AIO/tree/main/AIO_Tool 3 | 4 | ## 项目为AIO固件配套上位机 5 | Holocubic_AIO开源地址 https://github.com/ClimbSnail/HoloCubic_AIO 6 | 7 | [^_^]: 8 | ![AIO_TOOL](Image/holocubic_aio_tool.png) 9 | 10 | ![AIO_TOOL](https://gitee.com/ClimbSnailQ/Project_Image/raw/master/OtherProject/holocubic_aio_tool.png) 11 | 12 | ## 重要问题 13 | 本工程包含了上位机所有代码及资源文件,但唯独缺少视频转化工具`ffmpeg`(文件太大),需要转化功能的可以自行访问`ffmpeg`原项目地址 https://github.com/FFmpeg/FFmpeg 下载,把其中的`ffmpeg.exe`文件放在本目录下即可。 14 | 15 | 16 | ### 打包成可执行程序 17 | 使用pyinstaller打包程序`pyinstaller --icon ./holo_256.ico -w -F CubicAIO_Tool.py` 18 | 19 | ## 开发笔记 20 | 21 | #### 关于烧录 22 | 对ESP32进行开发,将代码编译好了之后,可以提取后在其他设备使用ESP Flash Download Tool直接烧录。使用ESP Flash Download Tool烧录需要提前准备四个文件,其中包含两个启动引导文件`bootloader_dio_40m.bin`、`boot_app0.bin`,一个flash划分文件`partitions.bin`和一个固件文件`firmware.bin`(当然名字是可以更改的)。 23 | 24 | 下面说下这些文件的存放位置以及烧录地址: 25 | 26 | 以Windows为例() 27 | 1. `bootloader_dio_40m.bin`的位置为PlatformIO安装目录下的`.platformio\packages\framework-arduinoespressif32\tools\sdk\bin`目录下面,它的对应的烧录地址为0X1000。 28 | 2. `boot_app0.bin`的位置为PlatformIO安装目录下的`platformio\packages\framework-arduinoespressif32\tools\partitions`目录下面,它对应的烧录地址为0xe000 29 | 3. `partitions.bin`的位置为代码工程目录下的.pioenvs\[board]目录下面,它对应的烧录地址为0x8000。同时platformio\packages\framework-arduinoespressif32\tools\partitions目录下面的`partitions.csv`为编译的分区配置文件,会根据版型选择的不同有所不同,可以使用Excel打开进行编辑,然后在编译器内使用PIO进行重新编译即可,同时他也可以使用PIO包里面带的`gen_esp32part.py`脚本进行编译与反编译,操作方法为:python C:\SPB_Data\.platformio\packages\framework-arduinoespressif32\tools\gen_esp32part.py --verify xxx.csv xxx.bin(后面填写csv文件或者bin文件存放的位置,这里是将csv转换成bin,如果将位置对换,则可以将bin转换成csv) 30 | 4. `firmware.bin`的位置为代码工程目录下的`.pioenvs\[board]`目录下面,这个就是代码编译出来的固件,它对应的烧录地址为0x10000,如果分区文件未做修改的话(人为修改,或者更换编译平台),更新固件或者重新烧录只在对应地址开始需要烧录这一个文件即可。 31 | 32 | #### 烧录参考脚本 33 | 1. python tool-esptoolpy\esptool.py --port COM7 --baud 921600 write_flash -fm dio -fs 4MB 0x1000 bootloader_dio_40m.bin 0x00008000 partitions.bin 0x0000e000 boot_app0.bin 0x00010000 HoloCubic_AIO固件_v1.3.bin 34 | 2. 清空flash命令 python tool-esptoolpy\esptool.py erase_flash 35 | 36 | 可用波特率为: 37 | * 115200 38 | * 230400 39 | * 460800 40 | * 576000 41 | * 921600 42 | * 1152000 43 | 44 | 45 | #### 图片转化开发要点 46 | https://lvgl.io/assets/images/logo_lvgl.png 47 | 48 | 利用lvgl的官方转换器 https://lvgl.io/tools/imageconverter 图片则可以转换成(True color with alpha 选择Binary RGB565)bin文件存储到SD卡中 49 | 50 | ## 致谢 51 | * 固件下载工具 https://github.com/espressif/esptool 52 | * 视频转码工具 https://github.com/FFmpeg/FFmpeg 53 | * LVGL离线转换工具 https://github.com/W-Mai/lvgl_image_converter 54 | 55 | -------------------------------------------------------------------------------- /boot_app0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/boot_app0.bin -------------------------------------------------------------------------------- /bootloader_qio_80m.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/bootloader_qio_80m.bin -------------------------------------------------------------------------------- /cubictool.json: -------------------------------------------------------------------------------- 1 | { 2 | "ssid": { 3 | "namespace": "sys", 4 | "type": "String", 5 | "info": "\u63d0\u793a\u4fe1\u606f" 6 | }, 7 | "ssid_1": { 8 | "namespace": "sys", 9 | "type": "String", 10 | "info": "\u63d0\u793a\u4fe1\u606f" 11 | }, 12 | "password_1": { 13 | "namespace": "sys", 14 | "type": "String", 15 | "info": "\u63d0\u793a\u4fe1\u606f" 16 | }, 17 | "ssid_2": { 18 | "namespace": "sys", 19 | "type": "String", 20 | "info": "\u63d0\u793a\u4fe1\u606f" 21 | }, 22 | "password_2": { 23 | "namespace": "sys", 24 | "type": "String", 25 | "info": "\u63d0\u793a\u4fe1\u606f" 26 | }, 27 | "backLight": { 28 | "namespace": "sys", 29 | "type": "UChar", 30 | "info": "\u63d0\u793a\u4fe1\u606f" 31 | }, 32 | "rotation": { 33 | "namespace": "sys", 34 | "type": "UChar", 35 | "info": "\u63d0\u793a\u4fe1\u606f" 36 | }, 37 | "auto_mpu": { 38 | "namespace": "sys", 39 | "type": "UChar", 40 | "info": "\u63d0\u793a\u4fe1\u606f" 41 | }, 42 | "cityname": { 43 | "namespace": "zhixin", 44 | "type": "String", 45 | "info": "\u63d0\u793a\u4fe1\u606f" 46 | }, 47 | "language": { 48 | "namespace": "zhixin", 49 | "type": "String", 50 | "info": "\u63d0\u793a\u4fe1\u606f" 51 | }, 52 | "weather_key": { 53 | "namespace": "zhixin", 54 | "type": "String", 55 | "info": "\u63d0\u793a\u4fe1\u606f" 56 | }, 57 | "tianqi_aid": { 58 | "namespace": "tianqi", 59 | "type": "String", 60 | "info": "\u63d0\u793a\u4fe1\u606f" 61 | }, 62 | "tianqi_as": { 63 | "namespace": "tianqi", 64 | "type": "String", 65 | "info": "\u63d0\u793a\u4fe1\u606f" 66 | }, 67 | "tianqi_addr": { 68 | "namespace": "tianqi", 69 | "type": "String", 70 | "info": "\u63d0\u793a\u4fe1\u606f" 71 | }, 72 | "bili_uid": { 73 | "namespace": "other", 74 | "type": "String", 75 | "info": "\u63d0\u793a\u4fe1\u606f" 76 | } 77 | } -------------------------------------------------------------------------------- /holo_256.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/holo_256.ico -------------------------------------------------------------------------------- /image/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/image/folder.png -------------------------------------------------------------------------------- /image/img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/image/img.png -------------------------------------------------------------------------------- /image/php.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/image/php.png -------------------------------------------------------------------------------- /image/python.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/image/python.png -------------------------------------------------------------------------------- /image/text_file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/image/text_file.png -------------------------------------------------------------------------------- /page/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/page/__init__.py -------------------------------------------------------------------------------- /page/help.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | ################################################################################ 3 | # 4 | # Author: ClimbSnail(HQ) 5 | # original source is here. 6 | # https://github.com/ClimbSnail/HoloCubic_AIO_Tool 7 | # 8 | # 9 | ################################################################################ 10 | 11 | import tkinter as tk 12 | import util.tkutils as tku 13 | 14 | 15 | class Helper(object): 16 | """ 17 | 帮助信息页类 18 | """ 19 | 20 | def __init__(self, father, engine, lock=None): 21 | """ 22 | DownloadDebug初始化 23 | :param father:父类窗口 24 | :param engine:引擎对象,用于推送与其他控件的请求 25 | :param lock:线程锁 26 | :return:None 27 | """ 28 | self.m_engine = engine # 负责各个组件之间数据调度的引擎 29 | self.m_father = father # 保存父窗口 30 | self.init_info(self.m_father) 31 | 32 | def init_info(self, father): 33 | """ 34 | 初始化信息打印框 35 | :param father: 父容器 36 | :return: None 37 | """ 38 | info_width = father.winfo_width() 39 | info_height = father.winfo_height() / 2 40 | 41 | info = ''' 42 | 本上位机专门针对HoloCubic AIO固件开发,其中固件烧录功能兼容其他第三方固件。 43 | 44 | 加入AIO内测QQ群:755143193 获取最新版本及相关技术支持。 45 | 功能持续补充完善中,本上位机的所有源码均开源,欢迎大家学习, 46 | 也欢迎加入到AIO固件的开发队列。 47 | 48 | 观看演示链接: 49 | https://www.bilibili.com/video/BV1wS4y1R7YF?p=1 50 | 51 | 了解Holocubic AIO固件 52 | 请访问 https://github.com/ClimbSnail/HoloCubic_AIO (最新版本) 53 | 或者 https://gitee.com/ClimbSnailQ/HoloCubic_AIO 54 | 55 | 了解Holocubic硬件开源方案 56 | 请访问 https://github.com/peng-zhihui/HoloCubic 57 | ''' 58 | 59 | self.m_project_info = tk.Text(father, height=45, width=140) 60 | self.m_project_info.tag_configure('bold_italics', 61 | font=('Arial', 12, 'bold', 'italic')) 62 | self.m_project_info.tag_configure('big', font=('Verdana', 16, 'bold')) 63 | self.m_project_info.tag_configure('color', foreground='#476042', 64 | font=('Tempus Sans ITC', 12, 'bold')) 65 | 66 | self.m_project_info.pack() 67 | self.m_project_info.config(state=tk.NORMAL) 68 | self.m_project_info.insert(tk.END, info, 'big') 69 | self.m_project_info.config(state=tk.DISABLED) 70 | -------------------------------------------------------------------------------- /partitions.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/partitions.bin -------------------------------------------------------------------------------- /partitions/app3M_fat9M_16MB.csv: -------------------------------------------------------------------------------- 1 | # Name, Type, SubType, Offset, Size, Flags 2 | nvs, data, nvs, 0x9000, 0x5000, 3 | otadata, data, ota, 0xe000, 0x2000, 4 | app0, app, ota_0, 0x10000, 0x300000, 5 | app1, app, ota_1, 0x310000,0x300000, 6 | ffat, data, fat, 0x610000,0x9F0000, 7 | # to create/use ffat, see https://github.com/marcmerlin/esp32_fatfsimage 8 | -------------------------------------------------------------------------------- /partitions/boot_app0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/partitions/boot_app0.bin -------------------------------------------------------------------------------- /partitions/default.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/partitions/default.bin -------------------------------------------------------------------------------- /partitions/default.csv: -------------------------------------------------------------------------------- 1 | # Name, Type, SubType, Offset, Size, Flags 2 | nvs, data, nvs, 0x9000, 0x5000, 3 | otadata, data, ota, 0xe000, 0x2000, 4 | app0, app, ota_0, 0x10000, 0x140000, 5 | app1, app, ota_1, 0x150000,0x140000, 6 | spiffs, data, spiffs, 0x290000,0x170000, 7 | -------------------------------------------------------------------------------- /partitions/default_16MB.csv: -------------------------------------------------------------------------------- 1 | # Name, Type, SubType, Offset, Size, Flags 2 | nvs, data, nvs, 0x9000, 0x5000, 3 | otadata, data, ota, 0xe000, 0x2000, 4 | app0, app, ota_0, 0x10000, 0x640000, 5 | app1, app, ota_1, 0x650000,0x640000, 6 | spiffs, data, spiffs, 0xc90000,0x370000, 7 | -------------------------------------------------------------------------------- /partitions/default_8MB.csv: -------------------------------------------------------------------------------- 1 | # Name, Type, SubType, Offset, Size, Flags 2 | nvs, data, nvs, 0x9000, 0x5000, 3 | otadata, data, ota, 0xe000, 0x2000, 4 | app0, app, ota_0, 0x10000, 0x330000, 5 | app1, app, ota_1, 0x340000,0x330000, 6 | spiffs, data, spiffs, 0x670000,0x190000, 7 | -------------------------------------------------------------------------------- /partitions/default_ffat.csv: -------------------------------------------------------------------------------- 1 | # Name, Type, SubType, Offset, Size, Flags 2 | nvs, data, nvs, 0x9000, 0x5000, 3 | otadata, data, ota, 0xe000, 0x2000, 4 | app0, app, ota_0, 0x10000, 0x140000, 5 | app1, app, ota_1, 0x150000,0x140000, 6 | ffat, data, fat, 0x290000,0x170000, 7 | -------------------------------------------------------------------------------- /partitions/ffat.csv: -------------------------------------------------------------------------------- 1 | # Name, Type, SubType, Offset, Size, Flags 2 | nvs, data, nvs, 0x9000, 0x5000, 3 | otadata, data, ota, 0xe000, 0x2000, 4 | app0, app, ota_0, 0x10000, 0x200000, 5 | app1, app, ota_1, 0x210000,0x200000, 6 | ffat, data, fat, 0x410000,0xBF0000, 7 | # to create/use ffat, see https://github.com/marcmerlin/esp32_fatfsimage 8 | -------------------------------------------------------------------------------- /partitions/huge_app.csv: -------------------------------------------------------------------------------- 1 | # Name, Type, SubType, Offset, Size, Flags 2 | nvs, data, nvs, 0x9000, 0x5000, 3 | otadata, data, ota, 0xe000, 0x2000, 4 | app0, app, ota_0, 0x10000, 0x300000, 5 | spiffs, data, spiffs, 0x310000,0xF0000, 6 | -------------------------------------------------------------------------------- /partitions/large_spiffs_16MB.csv: -------------------------------------------------------------------------------- 1 | # Name, Type, SubType, Offset, Size, Flags 2 | nvs, data, nvs, 0x9000, 0x5000, 3 | otadata, data, ota, 0xe000, 0x2000, 4 | app0, app, ota_0, 0x10000, 0x480000, 5 | app1, app, ota_1, 0x490000,0x480000, 6 | spiffs, data, spiffs, 0x910000,0x6F0000, 7 | -------------------------------------------------------------------------------- /partitions/min_spiffs.csv: -------------------------------------------------------------------------------- 1 | # Name, Type, SubType, Offset, Size, Flags 2 | nvs, data, nvs, 0x9000, 0x5000, 3 | otadata, data, ota, 0xe000, 0x2000, 4 | app0, app, ota_0, 0x10000, 0x1E0000, 5 | app1, app, ota_1, 0x1F0000,0x1E0000, 6 | spiffs, data, spiffs, 0x3D0000,0x30000, 7 | -------------------------------------------------------------------------------- /partitions/minimal.csv: -------------------------------------------------------------------------------- 1 | # Name, Type, SubType, Offset, Size, Flags 2 | nvs, data, nvs, 0x9000, 0x5000, 3 | otadata, data, ota, 0xe000, 0x2000, 4 | app0, app, ota_0, 0x10000, 0x140000, 5 | spiffs, data, spiffs, 0x150000, 0xB0000, 6 | -------------------------------------------------------------------------------- /partitions/no_ota.csv: -------------------------------------------------------------------------------- 1 | # Name, Type, SubType, Offset, Size, Flags 2 | nvs, data, nvs, 0x9000, 0x5000, 3 | otadata, data, ota, 0xe000, 0x2000, 4 | app0, app, ota_0, 0x10000, 0x200000, 5 | spiffs, data, spiffs, 0x210000,0x1F0000, 6 | -------------------------------------------------------------------------------- /partitions/noota_3g.csv: -------------------------------------------------------------------------------- 1 | # Name, Type, SubType, Offset, Size, Flags 2 | nvs, data, nvs, 0x9000, 0x5000, 3 | otadata, data, ota, 0xe000, 0x2000, 4 | app0, app, ota_0, 0x10000, 0x100000, 5 | spiffs, data, spiffs, 0x110000,0x2F0000, 6 | -------------------------------------------------------------------------------- /partitions/noota_3gffat.csv: -------------------------------------------------------------------------------- 1 | # Name, Type, SubType, Offset, Size, Flags 2 | nvs, data, nvs, 0x9000, 0x5000, 3 | otadata, data, ota, 0xe000, 0x2000, 4 | app0, app, ota_0, 0x10000, 0x100000, 5 | ffat, data, fat, 0x110000,0x2F0000, 6 | # to create/use ffat, see https://github.com/marcmerlin/esp32_fatfsimage 7 | -------------------------------------------------------------------------------- /partitions/noota_ffat.csv: -------------------------------------------------------------------------------- 1 | # Name, Type, SubType, Offset, Size, Flags 2 | nvs, data, nvs, 0x9000, 0x5000, 3 | otadata, data, ota, 0xe000, 0x2000, 4 | app0, app, ota_0, 0x10000, 0x200000, 5 | ffat, data, fat, 0x210000,0x1F0000, 6 | # to create/use ffat, see https://github.com/marcmerlin/esp32_fatfsimage 7 | -------------------------------------------------------------------------------- /tool_esptoolpy/.github/ISSUE_TEMPLATE/bug-report-no-hardware.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report - no ESP chip involved 3 | about: Report bugs or crashes which don't use any attached hardware 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | * Operating system: 11 | * Python version: (`python -V` to check this) 12 | 13 | # Full esptool.py command line as run: 14 | 15 | Example: esptool.py version 16 | 17 | 18 | # Full output from esptool.py 19 | 20 | (please copy and paste all lines of output) 21 | 22 | 23 | # What is the expected behaviour? 24 | 25 | Example: Print the version number 26 | 27 | 28 | # Do you have any other information from investigating this? 29 | 30 | Example: I tried on my friend's Windows 10 PC and the command works there 31 | 32 | 33 | # Is there any other information you can think of which will help us reproduce this problem? 34 | 35 | Example: Only crashes on first day of the month 36 | -------------------------------------------------------------------------------- /tool_esptoolpy/.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: ESP8266 Forum 4 | url: https://bbs.espressif.com/ 5 | about: For questions about using esptool.py with ESP8266 6 | - name: ESP32 Forum 7 | url: https://esp32.com 8 | about: For questions about using esptool.py with ESP32 9 | 10 | -------------------------------------------------------------------------------- /tool_esptoolpy/.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /tool_esptoolpy/.github/ISSUE_TEMPLATE/issue-with-attached-hardware.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: ESP chip operation fails (can't flash, can't connect, etc) 3 | about: Report a problem working with attached hardware 4 | title: '' 5 | labels: operation-failure 6 | assignees: '' 7 | 8 | --- 9 | 10 | ----------------------------- Delete below ----------------------------- 11 | 12 | Most failures to connect, flash, etc. are problems with the hardware. 13 | 14 | Please check any guide that came with your hardware, and also check these troubleshooting steps: 15 | 16 | https://github.com/espressif/esptool/#troubleshooting 17 | 18 | If still experiencing the issue, please delete the text in this box and then provide as many details as possible below about your hardware and computer setup. 19 | 20 | ----------------------------- Delete above ----------------------------- 21 | 22 | 23 | # Operating system 24 | 25 | # Python version 26 | 27 | Can run `python -V` to check this. 28 | 29 | 30 | # What Chip 31 | 32 | (For example: ESP8266, ESP32-PICO-D4, ESP32-WROOM32 module, etc) 33 | 34 | 35 | # What development board or other hardware is the chip attached to 36 | 37 | (For example: DevKitC, NodeMCU board, plain module on breadboard, etc) 38 | 39 | If your hardware is custom or unusual, please attach a photo to the issue. 40 | 41 | 42 | # Is anything else attached to the development board, except for the serial flasher connections? 43 | 44 | Example: GPIO 18 & 19 are connected to I2C devices. 45 | 46 | 47 | # Are you running esptool.py from an IDE such as Arduino or Eclipse? 48 | 49 | Example: No IDE, Windows command prompt 50 | 51 | Example 2: Arduino ESP8266 IDE version 2.5.77 52 | 53 | 54 | # Full esptool.py command line that was run: 55 | 56 | esptool.py -p COM999 write_flash 0x0 bootloader.bin 57 | 58 | 59 | # Full output from esptool.py 60 | 61 | (Please copy and paste all lines of output here) 62 | 63 | 64 | # Do you have any other information from investigating this? 65 | 66 | Example: The command succeeds 1 in every 3 tries 67 | 68 | 69 | # Is there any other information you can think of which will help us reproduce this problem? 70 | 71 | Example: I also have a Windows 95 PC, esptool command works correctly on this PC. 72 | -------------------------------------------------------------------------------- /tool_esptoolpy/.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | (Please delete any lines which don't apply) 2 | 3 | # Description of change 4 | 5 | # This change fixes the following bug(s): 6 | 7 | (Please put issue URLs or #number-of-issue here.) 8 | 9 | # I have tested this change with the following hardware & software combinations: 10 | 11 | (Operating system(s), development board name(s), ESP8266 and/or ESP32.) 12 | 13 | # I have run the esptool.py automated integration tests with this change and the above hardware. The results were: 14 | 15 | (Details here: https://github.com/espressif/esptool/blob/master/CONTRIBUTING.md#automated-integration-tests ) 16 | -------------------------------------------------------------------------------- /tool_esptoolpy/.github/workflows/build_esptool.yml: -------------------------------------------------------------------------------- 1 | name: Build esptool 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build-esptool-binaries: 7 | name: Build esptool binaries for ${{ matrix.os }} 8 | runs-on: ${{ matrix.os }} 9 | strategy: 10 | matrix: 11 | os: [macos-latest, ubuntu-latest, windows-latest] 12 | include: 13 | - os: macos-latest 14 | TARGET: macos 15 | - os: ubuntu-latest 16 | TARGET: linux-amd64 17 | - os: windows-latest 18 | TARGET: win64 19 | EXTEN: .exe 20 | env: 21 | DISTPATH: esptool-${{ matrix.TARGET }} 22 | steps: 23 | - name: Checkout repository 24 | uses: actions/checkout@v1 25 | - name: Set up Python 3.8 26 | uses: actions/setup-python@v1 27 | with: 28 | python-version: 3.8 29 | - name: Install dependencies 30 | run: | 31 | python -m pip install --upgrade pip 32 | pip install pyinstaller 33 | pip install --user -e . 34 | - name: Build with PyInstaller 35 | run: | 36 | pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=build_tools/espressif.ico esptool.py 37 | pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=build_tools/espressif.ico espefuse.py 38 | pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=build_tools/espressif.ico espsecure.py 39 | pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=build_tools/espressif.ico esp_rfc2217_server.py 40 | - name: Sign binaries 41 | if: matrix.os == 'windows-latest' 42 | env: 43 | CERTIFICATE: ${{ secrets.CERTIFICATE }} 44 | CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }} 45 | shell: pwsh 46 | run: | 47 | ./build_tools/Sign-File.ps1 -Path ./${{ env.DISTPATH }}/esptool.exe 48 | ./build_tools/Sign-File.ps1 -Path ./${{ env.DISTPATH }}/espefuse.exe 49 | ./build_tools/Sign-File.ps1 -Path ./${{ env.DISTPATH }}/espsecure.exe 50 | ./build_tools/Sign-File.ps1 -Path ./${{ env.DISTPATH }}/esp_rfc2217_server.exe 51 | - name: Test binaries 52 | shell: bash 53 | run: | 54 | ./${{ env.DISTPATH }}/esptool${{ matrix.EXTEN }} -h 55 | ./${{ env.DISTPATH }}/espefuse${{ matrix.EXTEN }} -h 56 | ./${{ env.DISTPATH }}/espsecure${{ matrix.EXTEN }} -h 57 | ./${{ env.DISTPATH }}/esp_rfc2217_server${{ matrix.EXTEN }} -h 58 | - name: Add license and readme 59 | shell: bash 60 | run: mv LICENSE README.md ./${{ env.DISTPATH }} 61 | - name: Archive artifact 62 | uses: actions/upload-artifact@v2 63 | with: 64 | name: ${{ env.DISTPATH }} 65 | path: ${{ env.DISTPATH }} 66 | 67 | create_release: 68 | name: Create GitHub release 69 | if: startsWith(github.ref, 'refs/tags/') 70 | needs: build-esptool-binaries 71 | runs-on: ubuntu-latest 72 | outputs: 73 | upload_url: ${{ steps.create_release.outputs.upload_url }} 74 | VERSION: ${{ steps.get_version.outputs.VERSION }} 75 | steps: 76 | - name: Create release 77 | id: create_release 78 | uses: actions/create-release@v1 79 | env: 80 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 81 | with: 82 | tag_name: ${{ github.ref }} 83 | release_name: Version ${{ github.ref }} 84 | draft: true 85 | prerelease: false 86 | - name: Get version 87 | id: get_version 88 | run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} 89 | shell: bash 90 | 91 | upload_assets: 92 | name: Upload release assets 93 | if: startsWith(github.ref, 'refs/tags/') 94 | needs: create_release 95 | runs-on: ubuntu-latest 96 | strategy: 97 | matrix: 98 | TARGET: [macos, linux-amd64, win64] 99 | env: 100 | DISTPATH: esptool-${{ needs.create_release.outputs.VERSION }}-${{ matrix.TARGET }} 101 | steps: 102 | - name: Download built binaries 103 | uses: actions/download-artifact@v2 104 | - name: Rename and package binaries 105 | run: | 106 | mv esptool-${{ matrix.TARGET }} ${{ env.DISTPATH }} 107 | zip -r ${{ env.DISTPATH }}.zip ./${{ env.DISTPATH }}/* 108 | - name: Upload release assets 109 | id: upload-release-asset 110 | uses: actions/upload-release-asset@v1 111 | env: 112 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 113 | with: 114 | upload_url: ${{ needs.create_release.outputs.upload_url }} 115 | asset_path: "${{ env.DISTPATH }}.zip" 116 | asset_name: "${{ env.DISTPATH }}.zip" 117 | asset_content_type: application/zip 118 | -------------------------------------------------------------------------------- /tool_esptoolpy/.github/workflows/issue_comment.yml: -------------------------------------------------------------------------------- 1 | name: Sync issue comments to JIRA 2 | 3 | # This workflow will be triggered when new issue comment is created (including PR comments) 4 | on: issue_comment 5 | 6 | jobs: 7 | sync_issue_comments_to_jira: 8 | name: Sync Issue Comments to Jira 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@master 12 | - name: Sync issue comments to JIRA 13 | uses: espressif/github-actions/sync_issues_to_jira@master 14 | env: 15 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 16 | JIRA_PASS: ${{ secrets.JIRA_PASS }} 17 | JIRA_PROJECT: ESPTOOL 18 | JIRA_COMPONENT: GitHub 19 | JIRA_URL: ${{ secrets.JIRA_URL }} 20 | JIRA_USER: ${{ secrets.JIRA_USER }} 21 | -------------------------------------------------------------------------------- /tool_esptoolpy/.github/workflows/new_issues.yml: -------------------------------------------------------------------------------- 1 | name: Sync issues to Jira 2 | 3 | # This workflow will be triggered when a new issue is opened 4 | on: issues 5 | 6 | jobs: 7 | sync_issues_to_jira: 8 | name: Sync issues to Jira 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@master 12 | - name: Sync GitHub issues to Jira project 13 | uses: espressif/github-actions/sync_issues_to_jira@master 14 | env: 15 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 16 | JIRA_PASS: ${{ secrets.JIRA_PASS }} 17 | JIRA_PROJECT: ESPTOOL 18 | JIRA_COMPONENT: GitHub 19 | JIRA_URL: ${{ secrets.JIRA_URL }} 20 | JIRA_USER: ${{ secrets.JIRA_USER }} 21 | -------------------------------------------------------------------------------- /tool_esptoolpy/.github/workflows/new_prs.yml: -------------------------------------------------------------------------------- 1 | name: Sync remain PRs to Jira 2 | 3 | # This workflow will be triggered every hour, to sync remaining PRs (i.e. PRs with zero comment) to Jira project 4 | # Note that, PRs can also get synced when new PR comment is created 5 | on: 6 | schedule: 7 | - cron: "0 * * * *" 8 | 9 | jobs: 10 | sync_prs_to_jira: 11 | name: Sync PRs to Jira 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@master 15 | - name: Sync PRs to Jira project 16 | uses: espressif/github-actions/sync_issues_to_jira@master 17 | with: 18 | cron_job: true 19 | env: 20 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 21 | JIRA_PASS: ${{ secrets.JIRA_PASS }} 22 | JIRA_PROJECT: ESPTOOL 23 | JIRA_COMPONENT: GitHub 24 | JIRA_URL: ${{ secrets.JIRA_URL }} 25 | JIRA_USER: ${{ secrets.JIRA_USER }} 26 | -------------------------------------------------------------------------------- /tool_esptoolpy/.github/workflows/release_esptool_pypi.yml: -------------------------------------------------------------------------------- 1 | # This workflow will upload an esptool Python package when a release is created 2 | 3 | name: PyPI release 4 | 5 | on: 6 | release: 7 | types: [released] 8 | 9 | jobs: 10 | build_and_upload: 11 | 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - uses: actions/checkout@v2 16 | - name: Set up Python 3.7 17 | uses: actions/setup-python@v2 18 | with: 19 | python-version: '3.7' 20 | - name: Install dependencies 21 | run: | 22 | python -m pip install --upgrade pip 23 | pip install setuptools twine 24 | - name: Build and upload esptool ${{ github.event.release.tag_name }} 25 | env: 26 | TWINE_USERNAME: __token__ 27 | TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} 28 | run: | 29 | PUBLISHED_VERSION=$(curl https://pypi.org/pypi/esptool/json 2>/dev/null | jq -r '.info.version') 30 | CURRENT_VERSION=$(python setup.py --version 2>/dev/null) 31 | 32 | if [ "$PUBLISHED_VERSION" == "$CURRENT_VERSION" ]; then 33 | echo "Version ${PUBLISHED_VERSION} already published, skipping..." 34 | exit 1 35 | else 36 | echo "Packaging and publishing new esptool version: ${CURRENT_VERSION}" 37 | python setup.py sdist 38 | tar -ztvf dist/* 39 | twine upload dist/* 40 | fi 41 | -------------------------------------------------------------------------------- /tool_esptoolpy/.github/workflows/test_esptool.yml: -------------------------------------------------------------------------------- 1 | name: Test esptool 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | test_esptool: 7 | runs-on: ubuntu-latest 8 | 9 | strategy: 10 | matrix: 11 | python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9] 12 | 13 | steps: 14 | - name: Checkout ref commit 15 | uses: actions/checkout@v2 16 | 17 | - name: Set up Python ${{ matrix.python-version }} 18 | uses: actions/setup-python@v2 19 | with: 20 | python-version: ${{ matrix.python-version }} 21 | 22 | - name: Test python components (fast) 23 | run: | 24 | python setup.py build 25 | pip install -e .[dev] 26 | python test/test_imagegen.py 27 | python test/test_espsecure.py 28 | python test/test_merge_bin.py 29 | python test/test_modules.py 30 | 31 | - name: Lint with flake8 32 | run: python -m flake8 33 | 34 | - name: Check the installed versions can run 35 | run: | 36 | esptool.py --help 37 | espefuse.py --help 38 | espsecure.py --help 39 | 40 | - name: Build stub (Python 3.7 only) 41 | if: matrix.python-version == 3.7 42 | run: | 43 | export TOOLCHAIN_DIR=$HOME/toolchain 44 | 45 | export ESP8266_BINDIR=$TOOLCHAIN_DIR/xtensa-lx106-elf/bin 46 | export ESP32_BINDIR=$TOOLCHAIN_DIR/xtensa-esp32-elf/bin 47 | export ESP32S2_BINDIR=$TOOLCHAIN_DIR/xtensa-esp32s2-elf/bin 48 | export ESP32S3_BINDIR=$TOOLCHAIN_DIR/xtensa-esp32s3-elf/bin 49 | export ESP32C3_BINDIR=$TOOLCHAIN_DIR/riscv32-esp-elf/bin 50 | 51 | export PATH=$PATH:$ESP8266_BINDIR:$ESP32_BINDIR:$ESP32S2_BINDIR:$ESP32S3_BINDIR:$ESP32C3_BINDIR 52 | 53 | ./test/ci/setup_ci_build_env.sh 54 | make -C flasher_stub V=1 55 | cd flasher_stub && python ./compare_stubs.py 56 | -------------------------------------------------------------------------------- /tool_esptoolpy/.gitignore: -------------------------------------------------------------------------------- 1 | .pypirc 2 | __pycache__ 3 | *.pyc 4 | *~ 5 | GPATH 6 | GRTAGS 7 | GTAGS 8 | esptool.egg-info 9 | .eggs 10 | build 11 | dist 12 | local.mk 13 | 14 | .envrc 15 | report.xml 16 | -------------------------------------------------------------------------------- /tool_esptoolpy/.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | # Gitlab CI config 2 | # 3 | # Note: When updating, please also update esptool_tests.yml GH Actions workflow file 4 | stages: 5 | - test 6 | - report 7 | 8 | # cache the pip download directory in all jobs 9 | variables: 10 | PIP_CACHE_DIR: "$CI_PROJECT_DIR/pip-cache" 11 | 12 | cache: 13 | paths: 14 | - "$CI_PROJECT_DIR/pip-cache" 15 | 16 | .test_template: &test_template 17 | stage: test 18 | image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG 19 | tags: 20 | - host_test 21 | dependencies: [] 22 | 23 | version_check: 24 | <<: *test_template 25 | only: 26 | - tags 27 | script: 28 | - VERSION=$(python esptool.py version | head -n 1) 29 | - | 30 | if [[ "$VERSION" != *"$CI_COMMIT_TAG" ]] 31 | then 32 | echo "Version number and git tag do not match!" 33 | exit 1 34 | fi 35 | 36 | host_tests: 37 | <<: *test_template 38 | artifacts: 39 | when: always 40 | paths: 41 | - "**/.coverage*" 42 | - ".coverage*" 43 | expire_in: 1 week 44 | variables: 45 | PYTHONPATH: "$PYTHONPATH:${CI_PROJECT_DIR}/test" 46 | COVERAGE_PROCESS_START: "${CI_PROJECT_DIR}/test/.covconf" 47 | script: 48 | - ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/setup.py build 49 | - ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_imagegen.py 50 | - ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_espsecure.py 51 | - ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_merge_bin.py 52 | - ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_espefuse_host.py esp32 53 | - ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_espefuse_host.py esp32s2 54 | - ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_espefuse_host.py esp32s3beta2 55 | - ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_espefuse_host.py esp32s3beta3 56 | - ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_espefuse_host.py esp32c3 57 | - ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_modules.py 58 | 59 | check_python_style: 60 | <<: *test_template 61 | script: 62 | # this step installs any 'dev' dependencies (ie flake8) that might be missing in the CI image. 63 | # The runner should cache the downloads, so still quite fast. 64 | - ./test/ci/multirun_with_pyenv.sh pip install --user -e .[dev] 65 | - ./test/ci/multirun_with_pyenv.sh python -m flake8 66 | 67 | # Check all the scripts can run when installed under all Python versions 68 | check_installation_can_run: 69 | <<: *test_template 70 | artifacts: 71 | when: always 72 | paths: 73 | - "**/.coverage*" 74 | - ".coverage*" 75 | expire_in: 1 week 76 | script: 77 | - ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode setup.py install 78 | - ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode esptool.py --help 79 | - ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode espefuse.py --help 80 | - ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode espsecure.py --help 81 | 82 | # Check the stub can build and that a stub built in CI has the same contents 83 | # as the one embedded in esptool 84 | check_stub_build: 85 | <<: *test_template 86 | artifacts: 87 | when: always 88 | paths: 89 | - flasher_stub/build/ 90 | - "**/.coverage*" 91 | - ".coverage*" 92 | expire_in: 1 week 93 | variables: 94 | # using this directory as the CI image probably already has an ESP32, ESP32S2, ESP32S3 and ESP32C3 toolchain downloaded into here 95 | TOOLCHAIN_DIR: "/root/.espressif/dist" 96 | 97 | ESP8266_BINDIR: "${TOOLCHAIN_DIR}/xtensa-lx106-elf/bin" 98 | ESP32_BINDIR: "${TOOLCHAIN_DIR}/xtensa-esp32-elf/bin" 99 | ESP32S2_BINDIR: "${TOOLCHAIN_DIR}/xtensa-esp32s2-elf/bin" 100 | ESP32S3_BINDIR: "${TOOLCHAIN_DIR}/xtensa-esp32s3-elf/bin" 101 | ESP32C3_BINDIR: "${TOOLCHAIN_DIR}/riscv32-esp-elf/bin" 102 | 103 | TOOLCHAIN_PATHS: "${ESP8266_BINDIR}:${ESP32_BINDIR}:${ESP32S2_BINDIR}:${ESP32S3_BINDIR}:${ESP32C3_BINDIR}" 104 | script: 105 | - ./test/ci/setup_ci_build_env.sh 106 | - make -C flasher_stub V=1 PATH="${TOOLCHAIN_PATHS}:${PATH}" 107 | - cd flasher_stub && ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh -p 3.4.8 coverage run --parallel-mode ./compare_stubs.py 108 | 109 | .target_esptool_test: 110 | stage: test 111 | image: $CI_DOCKER_REGISTRY/rpi-test-env$BOT_DOCKER_IMAGE_TAG 112 | variables: 113 | PYTHONPATH: "$PYTHONPATH:${CI_PROJECT_DIR}/test" 114 | COVERAGE_PROCESS_START: "${CI_PROJECT_DIR}/test/.covconf" 115 | before_script: 116 | - ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh python -m pip install -e . 117 | artifacts: 118 | reports: 119 | junit: test/report.xml 120 | when: always 121 | paths: 122 | - test/*.out 123 | - "**/.coverage*" 124 | - ".coverage*" 125 | expire_in: 1 week 126 | 127 | target_esptool_test_esp32: 128 | extends: .target_esptool_test 129 | tags: 130 | - esptool_esp32_target 131 | script: 132 | - ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_esptool.py /dev/serial_ports/ESP32 esp32 115200 133 | 134 | target_esptool_test_esp32s2: 135 | extends: .target_esptool_test 136 | tags: 137 | - esptool_esp32s2_target 138 | script: 139 | - ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_esptool.py /dev/serial_ports/ESP32S2 esp32s2 115200 140 | 141 | target_esptool_test_esp32s2_usbcdc: 142 | extends: .target_esptool_test 143 | tags: 144 | - esptool_esp32s2_cdc_target 145 | script: 146 | - ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_esptool.py /dev/serial_ports/ESP32S2_USBCDC esp32s2 115200 147 | 148 | target_esptool_test_esp8266: 149 | extends: .target_esptool_test 150 | tags: 151 | - esptool_esp8266_target 152 | script: 153 | - ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_esptool.py /dev/serial_ports/ESP8266 esp8266 115200 154 | 155 | combine_reports: 156 | stage: report 157 | before_script: 158 | - ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh python -m pip install -e . 159 | artifacts: 160 | reports: 161 | cobertura: cobertura_report.xml 162 | when: always 163 | paths: 164 | - ".coverage*" 165 | - cobertura_report.xml 166 | - ./html_report/ 167 | expire_in: 1 week 168 | variables: 169 | LC_ALL: C.UTF-8 170 | script: 171 | # all .coverage files in sub-directories are moved to the parent dir first 172 | - find . -mindepth 2 -type f -name ".coverage*" -print -exec mv --backup=numbered {} . \; 173 | - ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh -p 3.4.8 coverage combine 174 | - ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh -p 3.4.8 coverage report 175 | - ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh -p 3.4.8 coverage html -d html_report 176 | - ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh -p 3.4.8 coverage xml -o cobertura_report.xml 177 | -------------------------------------------------------------------------------- /tool_esptoolpy/.piopm: -------------------------------------------------------------------------------- 1 | {"type": "tool", "name": "tool-esptoolpy", "version": "1.30100.210531", "spec": {"owner": "platformio", "id": 8161, "name": "tool-esptoolpy", "requirements": null, "url": null}} -------------------------------------------------------------------------------- /tool_esptoolpy/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to esptool.py 2 | 3 | ## Development Setup 4 | 5 | To also install additional tools needed for actually developing and testing esptool, run this command to install a development copy of esptool *plus* packages useful for development: 6 | 7 | ``` 8 | pip install --user -e .[dev] 9 | ``` 10 | 11 | (This command uses the "extras" feature of setuptools.) 12 | 13 | ## Reporting Issues 14 | 15 | Please report bugs in esptool.py if you find them. 16 | 17 | However, before reporting a bug please check through the following: 18 | 19 | * [Troubleshooting Section](https://github.com/espressif/esptool/#troubleshooting) - common problems and known issues 20 | 21 | * [Existing Open Issues](https://github.com/espressif/esptool/issues) - someone might have already encountered this. 22 | 23 | If you don't find anything, please [open a new issue](https://github.com/espressif/esptool/issues/new). 24 | 25 | ## Sending Feature Requests 26 | 27 | Feel free to post feature requests. It's helpful if you can explain exactly why the feature would be useful. 28 | 29 | There are usually some outstanding feature requests in the [existing issues list](https://github.com/espressif/esptool/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement), feel free to add comments to them. 30 | 31 | ## Sending Pull Requests 32 | 33 | Pull Requests with changes and fixes are also welcome! 34 | 35 | ### Code Style & Static Analysis 36 | 37 | esptool.py complies with Flake 8 and is valid Python 2 & Python 3 code (in the same source file.) 38 | 39 | When you submit a Pull Request, the GitHub Actions automated build system will run automated checks for this, using the [flake8 tool](http://flake8.readthedocs.io/en/latest/). To check your code locally before submitting, run `python -m flake8` (the flake8 tool is installed as part of the development requirements shown at the beginning of this document.) 40 | 41 | ### Automated Integration Tests 42 | 43 | The test directory contains an integration suite with some integration tests for esptool.py: 44 | 45 | * `test_imagegen.py` tests the elf2image command and is run automatically by GitHub Actions for each Pull Request. You can run this command locally to check for regressions in the elf2image functionality. 46 | 47 | * `test_esptool.py` is a [Python unittest](https://docs.python.org/3/library/unittest.html) file that contains integration tests to be run against real ESP8266 or ESP32 hardware. These tests need real hardware so are not run automatically by GitHub Actions, they need to be run locally: 48 | 49 | `test_esptool.py` takes a command line with the following format: 50 | 51 | `./test_esptool.py [optional test name(s)]` 52 | 53 | For example, to run all tests on an ESP32 board connected to /dev/ttyUSB0, at 230400bps: 54 | 55 | `./test_esptool.py /dev/ttyUSB0 esp32 230400` 56 | 57 | Or to run the TestFlashing suite only on an ESP8266 board connected to /dev/ttyUSB2` at 460800bps: 58 | 59 | `./test_esptool.py /dev/ttyUSB2 esp8266 460800 TestFlashing` 60 | 61 | (Note that some tests will fail at higher baud rates on some hardware.) 62 | -------------------------------------------------------------------------------- /tool_esptoolpy/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include README.md 2 | include LICENSE 3 | # sdist includes test/test*.py by default, but esptool.py tests 4 | # are so far only intended to run from the git repo itself 5 | prune test 6 | prune flasher_stub 7 | prune .github 8 | exclude .git* 9 | exclude MANIFEST* 10 | 11 | 12 | -------------------------------------------------------------------------------- /tool_esptoolpy/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/__init__.py -------------------------------------------------------------------------------- /tool_esptoolpy/build_tools/Sign-File.ps1: -------------------------------------------------------------------------------- 1 | [CmdletBinding()] 2 | param ( 3 | [Parameter()] 4 | [String] 5 | $Path 6 | ) 7 | 8 | 9 | function FindSignTool { 10 | $SignTool = "signtool.exe" 11 | if (Get-Command $SignTool -ErrorAction SilentlyContinue) { 12 | return $SignTool 13 | } 14 | $SignTool = "${env:ProgramFiles(x86)}\Windows Kits\10\bin\x64\signtool.exe" 15 | if (Test-Path -Path $SignTool -PathType Leaf) { 16 | return $SignTool 17 | } 18 | $SignTool = "${env:ProgramFiles(x86)}\Windows Kits\10\bin\x86\signtool.exe" 19 | if (Test-Path -Path $SignTool -PathType Leaf) { 20 | return $SignTool 21 | } 22 | "signtool.exe not found" 23 | Exit 1 24 | } 25 | 26 | function SignInstaller { 27 | param( 28 | [Parameter()] 29 | [String] 30 | $Path 31 | ) 32 | 33 | $SignTool = FindSignTool 34 | "Using: $SignTool" 35 | $CertificateFile = [system.io.path]::GetTempPath() + "certificate.pfx" 36 | 37 | if ($null -eq $env:CERTIFICATE) { 38 | "CERTIFICATE variable not set, unable to sign the file" 39 | Exit 1 40 | } 41 | 42 | if ("" -eq $env:CERTIFICATE) { 43 | "CERTIFICATE variable is empty, unable to sign the file" 44 | Exit 1 45 | } 46 | 47 | $SignParameters = @("sign", "/tr", 'http://timestamp.digicert.com', "/f", $CertificateFile) 48 | if ($env:CERTIFICATE_PASSWORD) { 49 | "CERTIFICATE_PASSWORD detected, using the password" 50 | $SignParameters += "/p" 51 | $SignParameters += $env:CERTIFICATE_PASSWORD 52 | } 53 | $SignParameters += $Path 54 | 55 | [byte[]]$CertificateBytes = [convert]::FromBase64String($env:CERTIFICATE) 56 | [IO.File]::WriteAllBytes($CertificateFile, $CertificateBytes) 57 | 58 | &$SignTool $SignParameters 59 | 60 | if (0 -eq $LASTEXITCODE) { 61 | Remove-Item $CertificateFile 62 | } else { 63 | Remove-Item $CertificateFile 64 | "Signing failed" 65 | Exit 1 66 | } 67 | 68 | } 69 | 70 | SignInstaller ${Path} 71 | -------------------------------------------------------------------------------- /tool_esptoolpy/build_tools/espressif.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/build_tools/espressif.ico -------------------------------------------------------------------------------- /tool_esptoolpy/cubic_tool.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | import serial 4 | from esptool import main 5 | 6 | VERSION = "Ver1.0" 7 | 8 | 9 | if __name__ == '__main__': 10 | try: 11 | com_obj_list = list(serial.tools.list_ports.comports()) 12 | 13 | select_com = None 14 | # 获取可用COM口名字 15 | com_list = [com_obj[0] for com_obj in com_obj_list] 16 | print(com_list) 17 | if len(com_list) == 1: 18 | select_com = com_list[0] 19 | else: 20 | select_com = input("input COM(例如 COM7): ") 21 | 22 | 23 | #列出文件夹下所有的目录与文件 24 | list_file = os.listdir("./") 25 | firmware_path = 'HoloCubic_AIO固件_v1.5.bin' 26 | for file_name in list_file: 27 | if 'HoloCubic_AIO' in file_name: 28 | firmware_path = file_name.strip() 29 | 30 | cmd = ['CubicTool.py', '--port', select_com, 31 | '--baud', '921600', 32 | 'write_flash', '-fm', 'dio', '-fs', '4MB', 33 | '0x1000', 'bootloader_dio_40m.bin', 34 | '0x00008000', 'partitions.bin', 35 | '0x0000e000', 'boot_app0.bin', 36 | '0x00010000', firmware_path] 37 | sys.argv = cmd 38 | main() 39 | except Exception as err: 40 | print(err) 41 | 42 | input("Enter") -------------------------------------------------------------------------------- /tool_esptoolpy/espefuse.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # efuse get/set utility 3 | # https://github.com/themadinventor/esptool 4 | # 5 | # Copyright (C) 2016 Espressif Systems (Shanghai) PTE LTD 6 | # 7 | # This program is free software; you can redistribute it and/or modify it under 8 | # the terms of the GNU General Public License as published by the Free Software 9 | # Foundation; either version 2 of the License, or (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, but WITHOUT 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 13 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License along with 16 | # this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 17 | # Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | from __future__ import division, print_function 19 | 20 | import argparse 21 | import os 22 | import sys 23 | from io import StringIO 24 | 25 | import espressif.efuse.esp32 as esp32_efuse 26 | import espressif.efuse.esp32c3 as esp32c3_efuse 27 | import espressif.efuse.esp32s2 as esp32s2_efuse 28 | import espressif.efuse.esp32s3beta2 as esp32s3beta2_efuse 29 | import espressif.efuse.esp32s3beta3 as esp32s3beta3_efuse 30 | 31 | import esptool 32 | 33 | 34 | def get_esp(port, baud, connect_mode, chip='auto', skip_connect=False, virt=False, debug=False, virt_efuse_file=None): 35 | if chip not in ['auto', 'esp32', 'esp32s2', 'esp32s3beta2', 'esp32s3beta3', 'esp32c3']: 36 | raise esptool.FatalError("get_esp: Unsupported chip (%s)" % chip) 37 | if virt: 38 | esp = { 39 | 'esp32': esp32_efuse, 40 | 'esp32s2': esp32s2_efuse, 41 | 'esp32s3beta2': esp32s3beta2_efuse, 42 | 'esp32s3beta3': esp32s3beta3_efuse, 43 | 'esp32c3': esp32c3_efuse, 44 | }.get(chip, esp32_efuse).EmulateEfuseController(virt_efuse_file, debug) 45 | else: 46 | if chip == 'auto' and not skip_connect: 47 | esp = esptool.ESPLoader.detect_chip(port, baud, connect_mode) 48 | else: 49 | esp = { 50 | 'esp32': esptool.ESP32ROM, 51 | 'esp32s2': esptool.ESP32S2ROM, 52 | 'esp32s3beta2': esptool.ESP32S3BETA2ROM, 53 | 'esp32s3beta3': esptool.ESP32S3BETA3ROM, 54 | 'esp32c3': esptool.ESP32C3ROM, 55 | }.get(chip, esptool.ESP32ROM)(port if not skip_connect else StringIO(), baud) 56 | if not skip_connect: 57 | esp.connect(connect_mode) 58 | return esp 59 | 60 | 61 | def get_efuses(esp, skip_connect=False, debug_mode=False, do_not_confirm=False): 62 | try: 63 | efuse = { 64 | 'ESP32': esp32_efuse, 65 | 'ESP32-S2': esp32s2_efuse, 66 | 'ESP32-S3(beta2)': esp32s3beta2_efuse, 67 | 'ESP32-S3(beta3)': esp32s3beta3_efuse, 68 | 'ESP32-C3': esp32c3_efuse, 69 | }[esp.CHIP_NAME] 70 | except KeyError: 71 | raise esptool.FatalError("get_efuses: Unsupported chip (%s)" % esp.CHIP_NAME) 72 | # dict mapping register name to its efuse object 73 | return (efuse.EspEfuses(esp, skip_connect, debug_mode, do_not_confirm), efuse.operations) 74 | 75 | 76 | def main(custom_commandline=None): 77 | """ 78 | Main function for espefuse 79 | 80 | custom_commandline - Optional override for default arguments parsing (that uses sys.argv), can be a list of custom arguments 81 | as strings. Arguments and their values need to be added as individual items to the list e.g. "--port /dev/ttyUSB1" thus 82 | becomes ['--port', '/dev/ttyUSB1']. 83 | """ 84 | init_parser = argparse.ArgumentParser(description='espefuse.py v%s - [ESP32/S2/S3BETA2/S3BETA3/C3] efuse get/set tool' % esptool.__version__, 85 | prog='espefuse', add_help=False) 86 | 87 | init_parser.add_argument('--chip', '-c', 88 | help='Target chip type', 89 | choices=['auto', 'esp32', 'esp32s2', 'esp32s3beta2', 'esp32s3beta3', 'esp32c3'], 90 | default=os.environ.get('ESPTOOL_CHIP', 'auto')) 91 | 92 | init_parser.add_argument('--baud', '-b', 93 | help='Serial port baud rate used when flashing/reading', 94 | type=esptool.arg_auto_int, 95 | default=os.environ.get('ESPTOOL_BAUD', esptool.ESPLoader.ESP_ROM_BAUD)) 96 | 97 | init_parser.add_argument('--port', '-p', 98 | help='Serial port device', 99 | default=os.environ.get('ESPTOOL_PORT', esptool.ESPLoader.DEFAULT_PORT)) 100 | 101 | init_parser.add_argument('--before', 102 | help='What to do before connecting to the chip', 103 | choices=['default_reset', 'no_reset', 'esp32r1', 'no_reset_no_sync'], 104 | default='default_reset') 105 | 106 | init_parser.add_argument('--debug', "-d", help='Show debugging information (loglevel=DEBUG)', action='store_true') 107 | init_parser.add_argument('--virt', help='For host tests, the tool will work in the virtual mode (without connecting to a chip).', action='store_true') 108 | init_parser.add_argument('--path-efuse-file', help='For host tests, saves efuse memory to file.', type=str, default=None) 109 | init_parser.add_argument('--do-not-confirm', help='Do not pause for confirmation before permanently writing efuses. Use with caution.', action='store_true') 110 | 111 | args1, remaining_args = init_parser.parse_known_args(custom_commandline) 112 | debug_mode = args1.debug or ("dump" in remaining_args) 113 | just_print_help = [True for arg in remaining_args if arg in ["--help", "-h"]] or remaining_args == [] 114 | esp = get_esp(args1.port, args1.baud, args1.before, args1.chip, just_print_help, args1.virt, args1.debug, args1.path_efuse_file) 115 | efuses, efuse_operations = get_efuses(esp, just_print_help, debug_mode, args1.do_not_confirm) 116 | 117 | parser = argparse.ArgumentParser(parents=[init_parser]) 118 | subparsers = parser.add_subparsers(dest='operation', help='Run espefuse.py {command} -h for additional help') 119 | 120 | efuse_operations.add_commands(subparsers, efuses) 121 | 122 | args = parser.parse_args(remaining_args) 123 | print('espefuse.py v%s' % esptool.__version__) 124 | if args.operation is None: 125 | parser.print_help() 126 | parser.exit(1) 127 | operation_func = vars(efuse_operations)[args.operation] 128 | 129 | # each 'operation' is a module-level function of the same name 130 | operation_func(esp, efuses, args) 131 | 132 | 133 | def _main(): 134 | try: 135 | main() 136 | except esptool.FatalError as e: 137 | print('\nA fatal error occurred: %s' % e) 138 | sys.exit(2) 139 | 140 | 141 | if __name__ == '__main__': 142 | _main() 143 | -------------------------------------------------------------------------------- /tool_esptoolpy/espressif/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/espressif/__init__.py -------------------------------------------------------------------------------- /tool_esptoolpy/espressif/efuse/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/espressif/efuse/__init__.py -------------------------------------------------------------------------------- /tool_esptoolpy/espressif/efuse/esp32/__init__.py: -------------------------------------------------------------------------------- 1 | from . import operations 2 | from .emulate_efuse_controller import EmulateEfuseController 3 | from .fields import EspEfuses 4 | -------------------------------------------------------------------------------- /tool_esptoolpy/espressif/efuse/esp32/emulate_efuse_controller.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # This file describes eFuses controller for ESP32 chip 3 | # 4 | # Copyright (C) 2020 Espressif Systems (Shanghai) PTE LTD 5 | # 6 | # This program is free software; you can redistribute it and/or modify it under 7 | # the terms of the GNU General Public License as published by the Free Software 8 | # Foundation; either version 2 of the License, or (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but WITHOUT 11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 12 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License along with 15 | # this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 16 | # Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | from __future__ import division, print_function 18 | 19 | import time 20 | 21 | from .mem_definition import EfuseDefineBlocks, EfuseDefineFields, EfuseDefineRegisters 22 | from ..emulate_efuse_controller_base import EmulateEfuseControllerBase, FatalError 23 | 24 | 25 | class EmulateEfuseController(EmulateEfuseControllerBase): 26 | """ The class for virtual efuse operations. Using for HOST_TEST. 27 | """ 28 | CHIP_NAME = "ESP32" 29 | mem = None 30 | debug = False 31 | Blocks = EfuseDefineBlocks 32 | Fields = EfuseDefineFields 33 | REGS = EfuseDefineRegisters 34 | 35 | def __init__(self, efuse_file=None, debug=False): 36 | super(EmulateEfuseController, self).__init__(efuse_file, debug) 37 | 38 | """ esptool method start >> """ 39 | 40 | def get_chip_description(self): 41 | return "revision 3" 42 | 43 | def get_crystal_freq(self): 44 | return 40 # MHz (common for all chips) 45 | 46 | """ << esptool method end """ 47 | 48 | def send_burn_cmd(self): 49 | def wait_idle(): 50 | deadline = time.time() + self.REGS.EFUSE_BURN_TIMEOUT 51 | while time.time() < deadline: 52 | if self.read_reg(self.REGS.EFUSE_REG_CMD) == 0: 53 | return 54 | raise FatalError("Timed out waiting for Efuse controller command to complete") 55 | self.write_reg(self.REGS.EFUSE_REG_CMD, self.REGS.EFUSE_CMD_WRITE) 56 | wait_idle() 57 | self.write_reg(self.REGS.EFUSE_REG_CONF, self.REGS.EFUSE_CONF_READ) 58 | self.write_reg(self.REGS.EFUSE_REG_CMD, self.REGS.EFUSE_CMD_READ) 59 | wait_idle() 60 | 61 | def handle_writing_event(self, addr, value): 62 | if addr == self.REGS.EFUSE_REG_CMD: 63 | if value == self.REGS.EFUSE_CMD_WRITE: 64 | self.write_reg(addr, 0) 65 | elif value == self.REGS.EFUSE_CMD_READ: 66 | self.copy_blocks_wr_regs_to_rd_regs() 67 | self.clean_blocks_wr_regs() 68 | self.check_rd_protection_area() 69 | self.write_reg(addr, 0) 70 | self.save_to_file() 71 | 72 | def read_raw_coding_scheme(self): 73 | return self.read_efuse(self.REGS.EFUSE_CODING_SCHEME_WORD) & self.REGS.EFUSE_CODING_SCHEME_MASK 74 | 75 | def write_raw_coding_scheme(self, value): 76 | self.write_efuse(self.REGS.EFUSE_CODING_SCHEME_WORD, value & self.REGS.EFUSE_CODING_SCHEME_MASK) 77 | self.send_burn_cmd() 78 | if value != self.read_raw_coding_scheme(): 79 | raise FatalError("Error during a burning process to set the new coding scheme") 80 | print("Set coding scheme = %d" % self.read_raw_coding_scheme()) 81 | 82 | def get_bitlen_of_block(self, blk, wr=False): 83 | if blk.id == 0: 84 | return 32 * blk.len 85 | else: 86 | coding_scheme = self.read_raw_coding_scheme() 87 | if coding_scheme == self.REGS.CODING_SCHEME_NONE: 88 | return 32 * blk.len 89 | elif coding_scheme == self.REGS.CODING_SCHEME_34: 90 | if wr: 91 | return 32 * 8 92 | else: 93 | return 32 * blk.len * 3 // 4 94 | else: 95 | raise FatalError("The {} coding scheme is not supported".format(coding_scheme)) 96 | 97 | def handle_coding_scheme(self, blk, data): 98 | # it verifies the coding scheme part of data and returns just data 99 | if blk.id != 0 and self.read_raw_coding_scheme() == self.REGS.CODING_SCHEME_34: 100 | # CODING_SCHEME 3/4 applied only for BLK1..3 101 | # Takes 24 byte sequence to be represented in 3/4 encoding, 102 | # returns 8 words suitable for writing "encoded" to an efuse block 103 | data.pos = 0 104 | for _ in range(0, 4): 105 | xor_res = 0 106 | mul_res = 0 107 | chunk_data = data.readlist('8*uint:8') 108 | chunk_data = chunk_data[::-1] 109 | for i in range(0, 6): 110 | byte_data = chunk_data[i] 111 | xor_res ^= byte_data 112 | mul_res += (i + 1) * bin(byte_data).count('1') 113 | if xor_res != chunk_data[6] or mul_res != chunk_data[7]: 114 | print("xor_res ", xor_res, chunk_data[6], "mul_res", mul_res, chunk_data[7]) 115 | raise FatalError("Error in coding scheme data") 116 | # cut the coded data 117 | for i in range(0, 4): 118 | del data[i * 6 * 8: (i * 6 * 8) + 16] 119 | return data 120 | -------------------------------------------------------------------------------- /tool_esptoolpy/espressif/efuse/esp32c3/__init__.py: -------------------------------------------------------------------------------- 1 | from . import operations 2 | from .emulate_efuse_controller import EmulateEfuseController 3 | from .fields import EspEfuses 4 | -------------------------------------------------------------------------------- /tool_esptoolpy/espressif/efuse/esp32c3/emulate_efuse_controller.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # This file describes eFuses controller for ESP32-C3 chip 3 | # 4 | # Copyright (C) 2020 Espressif Systems (Shanghai) PTE LTD 5 | # 6 | # This program is free software; you can redistribute it and/or modify it under 7 | # the terms of the GNU General Public License as published by the Free Software 8 | # Foundation; either version 2 of the License, or (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but WITHOUT 11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 12 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License along with 15 | # this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 16 | # Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | from __future__ import division, print_function 18 | 19 | import reedsolo 20 | 21 | from .mem_definition import EfuseDefineBlocks, EfuseDefineFields, EfuseDefineRegisters 22 | from ..emulate_efuse_controller_base import EmulateEfuseControllerBase, FatalError 23 | 24 | 25 | class EmulateEfuseController(EmulateEfuseControllerBase): 26 | """ The class for virtual ESP32 operation. Using for HOST_TEST. 27 | """ 28 | CHIP_NAME = "ESP32-C3" 29 | mem = None 30 | debug = False 31 | Blocks = EfuseDefineBlocks 32 | Fields = EfuseDefineFields 33 | REGS = EfuseDefineRegisters 34 | 35 | def __init__(self, efuse_file=None, debug=False): 36 | super(EmulateEfuseController, self).__init__(efuse_file, debug) 37 | self.write_reg(self.REGS.EFUSE_STATUS_REG, 1) 38 | 39 | """ esptool method start >>""" 40 | 41 | def get_chip_description(self): 42 | return "" 43 | 44 | def get_crystal_freq(self): 45 | return 40 # MHz (common for all chips) 46 | 47 | """ << esptool method end """ 48 | 49 | def handle_writing_event(self, addr, value): 50 | if addr == self.REGS.EFUSE_CMD_REG: 51 | if value & self.REGS.EFUSE_PGM_CMD: 52 | self.copy_blocks_wr_regs_to_rd_regs(updated_block=(value >> 2) & 0xF) 53 | self.clean_blocks_wr_regs() 54 | self.check_rd_protection_area() 55 | self.write_reg(addr, 0) 56 | self.write_reg(self.REGS.EFUSE_STATUS_REG, 1) 57 | elif value == self.REGS.EFUSE_READ_CMD: 58 | self.write_reg(addr, 0) 59 | self.write_reg(self.REGS.EFUSE_STATUS_REG, 1) 60 | self.save_to_file() 61 | 62 | def get_bitlen_of_block(self, blk, wr=False): 63 | if blk.id == 0: 64 | if wr: 65 | return 32 * 8 66 | else: 67 | return 32 * blk.len 68 | else: 69 | if wr: 70 | rs_coding = 32 * 3 71 | return 32 * 8 + rs_coding 72 | else: 73 | return 32 * blk.len 74 | 75 | def handle_coding_scheme(self, blk, data): 76 | if blk.id != 0: 77 | # CODING_SCHEME RS applied only for all blocks except BLK0. 78 | coded_bytes = 12 79 | data.pos = coded_bytes * 8 80 | plain_data = data.readlist('32*uint:8')[::-1] 81 | # takes 32 bytes 82 | # apply RS encoding 83 | rs = reedsolo.RSCodec(coded_bytes) 84 | # 32 byte of data + 12 bytes RS 85 | calc_encoded_data = list(rs.encode([x for x in plain_data])) 86 | data.pos = 0 87 | if calc_encoded_data != data.readlist('44*uint:8')[::-1]: 88 | raise FatalError("Error in coding scheme data") 89 | data = data[coded_bytes * 8:] 90 | if blk.len < 8: 91 | data = data[(8 - blk.len) * 32:] 92 | return data 93 | -------------------------------------------------------------------------------- /tool_esptoolpy/espressif/efuse/esp32s2/__init__.py: -------------------------------------------------------------------------------- 1 | from . import operations 2 | from .emulate_efuse_controller import EmulateEfuseController 3 | from .fields import EspEfuses 4 | -------------------------------------------------------------------------------- /tool_esptoolpy/espressif/efuse/esp32s2/emulate_efuse_controller.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # This file describes eFuses controller for ESP32-S2 chip 3 | # 4 | # Copyright (C) 2020 Espressif Systems (Shanghai) PTE LTD 5 | # 6 | # This program is free software; you can redistribute it and/or modify it under 7 | # the terms of the GNU General Public License as published by the Free Software 8 | # Foundation; either version 2 of the License, or (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but WITHOUT 11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 12 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License along with 15 | # this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 16 | # Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | from __future__ import division, print_function 18 | 19 | import reedsolo 20 | 21 | from .mem_definition import EfuseDefineBlocks, EfuseDefineFields, EfuseDefineRegisters 22 | from ..emulate_efuse_controller_base import EmulateEfuseControllerBase, FatalError 23 | 24 | 25 | class EmulateEfuseController(EmulateEfuseControllerBase): 26 | """ The class for virtual ESP32 operation. Using for HOST_TEST. 27 | """ 28 | CHIP_NAME = "ESP32-S2" 29 | mem = None 30 | debug = False 31 | Blocks = EfuseDefineBlocks 32 | Fields = EfuseDefineFields 33 | REGS = EfuseDefineRegisters 34 | 35 | def __init__(self, efuse_file=None, debug=False): 36 | super(EmulateEfuseController, self).__init__(efuse_file, debug) 37 | self.write_reg(self.REGS.EFUSE_STATUS_REG, 1) 38 | 39 | """ esptool method start >>""" 40 | 41 | def get_chip_description(self): 42 | return "" 43 | 44 | def get_crystal_freq(self): 45 | return 40 # MHz (common for all chips) 46 | 47 | """ << esptool method end """ 48 | 49 | def handle_writing_event(self, addr, value): 50 | if addr == self.REGS.EFUSE_CMD_REG: 51 | if value & self.REGS.EFUSE_PGM_CMD: 52 | self.copy_blocks_wr_regs_to_rd_regs(updated_block=(value >> 2) & 0xF) 53 | self.clean_blocks_wr_regs() 54 | self.check_rd_protection_area() 55 | self.write_reg(addr, 0) 56 | self.write_reg(self.REGS.EFUSE_STATUS_REG, 1) 57 | elif value == self.REGS.EFUSE_READ_CMD: 58 | self.write_reg(addr, 0) 59 | self.write_reg(self.REGS.EFUSE_STATUS_REG, 1) 60 | self.save_to_file() 61 | 62 | def get_bitlen_of_block(self, blk, wr=False): 63 | if blk.id == 0: 64 | if wr: 65 | return 32 * 8 66 | else: 67 | return 32 * blk.len 68 | else: 69 | if wr: 70 | rs_coding = 32 * 3 71 | return 32 * 8 + rs_coding 72 | else: 73 | return 32 * blk.len 74 | 75 | def handle_coding_scheme(self, blk, data): 76 | if blk.id != 0: 77 | # CODING_SCHEME RS applied only for all blocks except BLK0. 78 | coded_bytes = 12 79 | data.pos = coded_bytes * 8 80 | plain_data = data.readlist('32*uint:8')[::-1] 81 | # takes 32 bytes 82 | # apply RS encoding 83 | rs = reedsolo.RSCodec(coded_bytes) 84 | # 32 byte of data + 12 bytes RS 85 | calc_encoded_data = list(rs.encode([x for x in plain_data])) 86 | data.pos = 0 87 | if calc_encoded_data != data.readlist('44*uint:8')[::-1]: 88 | raise FatalError("Error in coding scheme data") 89 | data = data[coded_bytes * 8:] 90 | if blk.len < 8: 91 | data = data[(8 - blk.len) * 32:] 92 | return data 93 | -------------------------------------------------------------------------------- /tool_esptoolpy/espressif/efuse/esp32s3beta2/__init__.py: -------------------------------------------------------------------------------- 1 | from . import operations 2 | from .emulate_efuse_controller import EmulateEfuseController 3 | from .fields import EspEfuses 4 | -------------------------------------------------------------------------------- /tool_esptoolpy/espressif/efuse/esp32s3beta2/emulate_efuse_controller.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # This file describes eFuses controller for ESP32-S3(beta2) chip 3 | # 4 | # Copyright (C) 2020 Espressif Systems (Shanghai) PTE LTD 5 | # 6 | # This program is free software; you can redistribute it and/or modify it under 7 | # the terms of the GNU General Public License as published by the Free Software 8 | # Foundation; either version 2 of the License, or (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but WITHOUT 11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 12 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License along with 15 | # this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 16 | # Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | from __future__ import division, print_function 18 | 19 | import reedsolo 20 | 21 | from .mem_definition import EfuseDefineBlocks, EfuseDefineFields, EfuseDefineRegisters 22 | from ..emulate_efuse_controller_base import EmulateEfuseControllerBase, FatalError 23 | 24 | 25 | class EmulateEfuseController(EmulateEfuseControllerBase): 26 | """ The class for virtual ESP32-S3(beta2) operation. Using for HOST_TEST. 27 | """ 28 | CHIP_NAME = "ESP32-S3(beta2)" 29 | mem = None 30 | debug = False 31 | Blocks = EfuseDefineBlocks 32 | Fields = EfuseDefineFields 33 | REGS = EfuseDefineRegisters 34 | 35 | def __init__(self, efuse_file=None, debug=False): 36 | super(EmulateEfuseController, self).__init__(efuse_file, debug) 37 | self.write_reg(self.REGS.EFUSE_STATUS_REG, 1) 38 | 39 | """ esptool method start >>""" 40 | 41 | def get_chip_description(self): 42 | return "" 43 | 44 | def get_crystal_freq(self): 45 | return 40 # MHz (common for all chips) 46 | 47 | """ << esptool method end """ 48 | 49 | def handle_writing_event(self, addr, value): 50 | if addr == self.REGS.EFUSE_CMD_REG: 51 | if value & self.REGS.EFUSE_PGM_CMD: 52 | self.copy_blocks_wr_regs_to_rd_regs(updated_block=(value >> 2) & 0xF) 53 | self.clean_blocks_wr_regs() 54 | self.check_rd_protection_area() 55 | self.write_reg(addr, 0) 56 | self.write_reg(self.REGS.EFUSE_STATUS_REG, 1) 57 | elif value == self.REGS.EFUSE_READ_CMD: 58 | self.write_reg(addr, 0) 59 | self.write_reg(self.REGS.EFUSE_STATUS_REG, 1) 60 | self.save_to_file() 61 | 62 | def get_bitlen_of_block(self, blk, wr=False): 63 | if blk.id == 0: 64 | if wr: 65 | return 32 * 8 66 | else: 67 | return 32 * blk.len 68 | else: 69 | if wr: 70 | rs_coding = 32 * 3 71 | return 32 * 8 + rs_coding 72 | else: 73 | return 32 * blk.len 74 | 75 | def handle_coding_scheme(self, blk, data): 76 | if blk.id != 0: 77 | # CODING_SCHEME RS applied only for all blocks except BLK0. 78 | coded_bytes = 12 79 | data.pos = coded_bytes * 8 80 | plain_data = data.readlist('32*uint:8')[::-1] 81 | # takes 32 bytes 82 | # apply RS encoding 83 | rs = reedsolo.RSCodec(coded_bytes) 84 | # 32 byte of data + 12 bytes RS 85 | calc_encoded_data = list(rs.encode([x for x in plain_data])) 86 | data.pos = 0 87 | if calc_encoded_data != data.readlist('44*uint:8')[::-1]: 88 | raise FatalError("Error in coding scheme data") 89 | data = data[coded_bytes * 8:] 90 | if blk.len < 8: 91 | data = data[(8 - blk.len) * 32:] 92 | return data 93 | -------------------------------------------------------------------------------- /tool_esptoolpy/espressif/efuse/esp32s3beta3/__init__.py: -------------------------------------------------------------------------------- 1 | from . import operations 2 | from .emulate_efuse_controller import EmulateEfuseController 3 | from .fields import EspEfuses 4 | -------------------------------------------------------------------------------- /tool_esptoolpy/espressif/efuse/esp32s3beta3/emulate_efuse_controller.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # This file describes eFuses controller for ESP32-S3(beta3) chip 3 | # 4 | # Copyright (C) 2020 Espressif Systems (Shanghai) PTE LTD 5 | # 6 | # This program is free software; you can redistribute it and/or modify it under 7 | # the terms of the GNU General Public License as published by the Free Software 8 | # Foundation; either version 2 of the License, or (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but WITHOUT 11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 12 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License along with 15 | # this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 16 | # Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | from __future__ import division, print_function 18 | 19 | import reedsolo 20 | 21 | from .mem_definition import EfuseDefineBlocks, EfuseDefineFields, EfuseDefineRegisters 22 | from ..emulate_efuse_controller_base import EmulateEfuseControllerBase, FatalError 23 | 24 | 25 | class EmulateEfuseController(EmulateEfuseControllerBase): 26 | """ The class for virtual ESP32-S3(beta3) operation. Using for HOST_TEST. 27 | """ 28 | CHIP_NAME = "ESP32-S3(beta3)" 29 | mem = None 30 | debug = False 31 | Blocks = EfuseDefineBlocks 32 | Fields = EfuseDefineFields 33 | REGS = EfuseDefineRegisters 34 | 35 | def __init__(self, efuse_file=None, debug=False): 36 | super(EmulateEfuseController, self).__init__(efuse_file, debug) 37 | self.write_reg(self.REGS.EFUSE_STATUS_REG, 1) 38 | 39 | """ esptool method start >>""" 40 | 41 | def get_chip_description(self): 42 | return "" 43 | 44 | def get_crystal_freq(self): 45 | return 40 # MHz (common for all chips) 46 | 47 | """ << esptool method end """ 48 | 49 | def handle_writing_event(self, addr, value): 50 | if addr == self.REGS.EFUSE_CMD_REG: 51 | if value & self.REGS.EFUSE_PGM_CMD: 52 | self.copy_blocks_wr_regs_to_rd_regs(updated_block=(value >> 2) & 0xF) 53 | self.clean_blocks_wr_regs() 54 | self.check_rd_protection_area() 55 | self.write_reg(addr, 0) 56 | self.write_reg(self.REGS.EFUSE_STATUS_REG, 1) 57 | elif value == self.REGS.EFUSE_READ_CMD: 58 | self.write_reg(addr, 0) 59 | self.write_reg(self.REGS.EFUSE_STATUS_REG, 1) 60 | self.save_to_file() 61 | 62 | def get_bitlen_of_block(self, blk, wr=False): 63 | if blk.id == 0: 64 | if wr: 65 | return 32 * 8 66 | else: 67 | return 32 * blk.len 68 | else: 69 | if wr: 70 | rs_coding = 32 * 3 71 | return 32 * 8 + rs_coding 72 | else: 73 | return 32 * blk.len 74 | 75 | def handle_coding_scheme(self, blk, data): 76 | if blk.id != 0: 77 | # CODING_SCHEME RS applied only for all blocks except BLK0. 78 | coded_bytes = 12 79 | data.pos = coded_bytes * 8 80 | plain_data = data.readlist('32*uint:8')[::-1] 81 | # takes 32 bytes 82 | # apply RS encoding 83 | rs = reedsolo.RSCodec(coded_bytes) 84 | # 32 byte of data + 12 bytes RS 85 | calc_encoded_data = list(rs.encode([x for x in plain_data])) 86 | data.pos = 0 87 | if calc_encoded_data != data.readlist('44*uint:8')[::-1]: 88 | raise FatalError("Error in coding scheme data") 89 | data = data[coded_bytes * 8:] 90 | if blk.len < 8: 91 | data = data[(8 - blk.len) * 32:] 92 | return data 93 | -------------------------------------------------------------------------------- /tool_esptoolpy/espressif/efuse/mem_definition_base.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # This file describes eFuses fields and registers for ESP32 chip 3 | # 4 | # Copyright (C) 2020 Espressif Systems (Shanghai) PTE LTD 5 | # 6 | # This program is free software; you can redistribute it and/or modify it under 7 | # the terms of the GNU General Public License as published by the Free Software 8 | # Foundation; either version 2 of the License, or (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but WITHOUT 11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 12 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License along with 15 | # this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 16 | # Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | from __future__ import division, print_function 18 | 19 | from collections import namedtuple 20 | 21 | 22 | class EfuseRegistersBase(object): 23 | # Coding Scheme values 24 | CODING_SCHEME_NONE = 0 25 | CODING_SCHEME_34 = 1 26 | CODING_SCHEME_REPEAT = 2 27 | CODING_SCHEME_NONE_RECOVERY = 3 28 | CODING_SCHEME_RS = 4 29 | 30 | EFUSE_BURN_TIMEOUT = 0.250 # seconds 31 | 32 | 33 | class EfuseBlocksBase(object): 34 | 35 | BLOCKS = None 36 | NamedtupleBlock = namedtuple('Block', 'name alias id rd_addr wr_addr write_disable_bit read_disable_bit len key_purpose') 37 | 38 | @staticmethod 39 | def get(tuple_block): 40 | return EfuseBlocksBase.NamedtupleBlock._make(tuple_block) 41 | 42 | def get_blocks_for_keys(self): 43 | list_of_names = [] 44 | for block in self.BLOCKS: 45 | blk = self.get(block) 46 | if blk.id > 0: 47 | if blk.name: 48 | list_of_names.append(blk.name) 49 | if blk.alias: 50 | for alias in blk.alias: 51 | list_of_names.append(alias) 52 | return list_of_names 53 | 54 | 55 | class EfuseFieldsBase(object): 56 | 57 | NamedtupleField = namedtuple('Efuse', 'name category block word pos type write_disable_bit read_disable_bit class_type description dictionary') 58 | 59 | @staticmethod 60 | def get(tuple_field): 61 | return EfuseFieldsBase.NamedtupleField._make(tuple_field) 62 | -------------------------------------------------------------------------------- /tool_esptoolpy/espressif/efuse/util.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # This file consists of the common useful functions for eFuse 3 | # 4 | # Copyright (C) 2020 Espressif Systems (Shanghai) PTE LTD 5 | # 6 | # This program is free software; you can redistribute it and/or modify it under 7 | # the terms of the GNU General Public License as published by the Free Software 8 | # Foundation; either version 2 of the License, or (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but WITHOUT 11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 12 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License along with 15 | # this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 16 | # Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | from __future__ import division, print_function 18 | 19 | import esptool 20 | 21 | 22 | def hexify(bitstring, separator=""): 23 | try: 24 | as_bytes = tuple(ord(b) for b in bitstring) 25 | except TypeError: # python 3, items in bitstring already ints 26 | as_bytes = tuple(b for b in bitstring) 27 | return separator.join(("%02x" % b) for b in as_bytes) 28 | 29 | 30 | def popcnt(b): 31 | """ Return number of "1" bits set in 'b' """ 32 | return len([x for x in bin(b) if x == "1"]) 33 | 34 | 35 | def check_duplicate_name_in_list(name_list): 36 | duples_name = [name for i, name in enumerate(name_list) if name in name_list[:i]] 37 | if duples_name != []: 38 | raise esptool.FatalError("Found repeated {} in the name list".format(duples_name)) 39 | -------------------------------------------------------------------------------- /tool_esptoolpy/flasher_stub/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile to compile the flasher stub program 2 | # 3 | # Note that YOU DO NOT NEED TO COMPILE THIS IN ORDER TO JUST USE 4 | # esptool.py - a precompiled version is embedded in esptool.py, 5 | # so if you don't want to modify the stub code then you are good to go. 6 | # 7 | # See the comments in the top of the Makefile for parameters that 8 | # you probably want to override. 9 | # 10 | # Copyright (c) 2016 Cesanta Software Limited & Angus Gratton 11 | # All rights reserved 12 | # 13 | # 14 | # This program is free software; you can redistribute it and/or modify it under 15 | # the terms of the GNU General Public License as published by the Free Software 16 | # Foundation; either version 2 of the License, or (at your option) any later version. 17 | # 18 | # This program is distributed in the hope that it will be useful, but WITHOUT 19 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 20 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU General Public License along with 23 | # this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 24 | # Street, Fifth Floor, Boston, MA 02110-1301 USA. 25 | 26 | # Adapted from Cesanta's original Makefile at 27 | # https://github.com/cesanta/fnc/tree/master/common/platforms/esp8266/stubs 28 | 29 | # Override these variables on the command line 30 | # or set them in a local.mk 31 | -include local.mk 32 | 33 | # Prefix for each cross compiler (can include a directory path) 34 | # These can be overriden via environment variables or on the make command line 35 | CROSS_8266 ?= xtensa-lx106-elf- 36 | CROSS_32 ?= xtensa-esp32-elf- 37 | CROSS_32S2 ?= xtensa-esp32s2-elf- 38 | CROSS_32S3 ?= xtensa-esp32s3-elf- 39 | CROSS_32C3 ?= riscv32-esp-elf- 40 | CROSS_32C6BETA ?= riscv32-esp-elf- 41 | 42 | # Python command to invoke wrap_stub.py 43 | WRAP_STUB ?= ./wrap_stub.py 44 | 45 | # Pass V=1 to see the commands being executed by make 46 | ifneq ("$(V)","1") 47 | Q = @ 48 | endif 49 | 50 | STUB = stub_flasher 51 | SRCS = stub_flasher.c slip.c stub_commands.c stub_write_flash.c stub_io.c 52 | SRCS_8266 = miniz.c 53 | 54 | BUILD_DIR = build 55 | 56 | STUB_ELF_8266 = $(BUILD_DIR)/$(STUB)_8266.elf 57 | STUB_ELF_32 = $(BUILD_DIR)/$(STUB)_32.elf 58 | STUB_ELF_32S2 = $(BUILD_DIR)/$(STUB)_32s2.elf 59 | STUB_ELF_32S3_BETA_2 = $(BUILD_DIR)/$(STUB)_32s3beta2.elf 60 | STUB_ELF_32S3_BETA_3 = $(BUILD_DIR)/$(STUB)_32s3beta3.elf 61 | STUB_ELF_32C3 = $(BUILD_DIR)/$(STUB)_32c3.elf 62 | STUB_ELF_32C6BETA = $(BUILD_DIR)/$(STUB)_32c6beta.elf 63 | STUB_PY = $(BUILD_DIR)/$(STUB)_snippet.py 64 | 65 | .PHONY: all clean embed 66 | 67 | all: $(STUB_PY) 68 | 69 | $(BUILD_DIR): 70 | $(Q) mkdir $@ 71 | 72 | CFLAGS = -std=c99 -Wall -Werror -Os \ 73 | -mtext-section-literals -mlongcalls -nostdlib -fno-builtin -flto \ 74 | -Wl,-static -g -ffunction-sections -Wl,--gc-sections -Iinclude -Lld 75 | CFLAGS_ESP32C3 = -std=c99 -Wall -Werror -Os \ 76 | -march=rv32imc -msmall-data-limit=0 \ 77 | -nostdlib -fno-builtin -flto \ 78 | -Wl,-static -g -ffunction-sections -Wl,--gc-sections -Iinclude -Lld 79 | LDLIBS = -lgcc 80 | 81 | $(STUB_ELF_8266): $(SRCS) $(SRCS_8266) $(BUILD_DIR) ld/stub_8266.ld | Makefile 82 | @echo " CC(8266) $^ -> $@" 83 | $(Q) $(CROSS_8266)gcc $(CFLAGS) -DESP8266=1 -Tstub_8266.ld -Wl,-Map=$(@:.elf=.map) -o $@ $(filter %.c, $^) $(LDLIBS) 84 | 85 | $(STUB_ELF_32): $(SRCS) $(BUILD_DIR) ld/stub_32.ld | Makefile 86 | @echo " CC(32) $^ -> $@" 87 | $(Q) $(CROSS_32)gcc $(CFLAGS) -DESP32=1 -Tstub_32.ld -Wl,-Map=$(@:.elf=.map) -o $@ $(filter %.c, $^) $(LDLIBS) 88 | 89 | $(STUB_ELF_32S2): $(SRCS) $(BUILD_DIR) ld/stub_32s2.ld 90 | @echo " CC(32S2) $^ -> $@" 91 | $(Q) $(CROSS_32S2)gcc $(CFLAGS) -DESP32S2=1 -Tstub_32s2.ld -Wl,-Map=$(@:.elf=.map) -o $@ $(filter %.c, $^) $(LDLIBS) 92 | 93 | $(STUB_ELF_32S3_BETA_2): $(SRCS) $(BUILD_DIR) ld/stub_32s3_beta_2.ld 94 | @echo " CC(32S3) $^ -> $@" 95 | $(Q) $(CROSS_32S3)gcc $(CFLAGS) -DESP32S3=1 -Tstub_32s3_beta_2.ld -Wl,-Map=$(@:.elf=.map) -o $@ $(filter %.c, $^) $(LDLIBS) 96 | 97 | $(STUB_ELF_32S3_BETA_3): $(SRCS) $(BUILD_DIR) ld/stub_32s3_beta_3.ld 98 | @echo " CC(32S3) $^ -> $@" 99 | $(Q) $(CROSS_32S3)gcc $(CFLAGS) -DESP32S3=1 -Tstub_32s3_beta_3.ld -Wl,-Map=$(@:.elf=.map) -o $@ $(filter %.c, $^) $(LDLIBS) 100 | 101 | $(STUB_ELF_32C3): $(SRCS) $(BUILD_DIR) ld/stub_32c3.ld 102 | @echo " CC(32C3) $^ -> $@" 103 | $(Q) $(CROSS_32C3)gcc $(CFLAGS_ESP32C3) -DESP32C3=1 -Tstub_32c3.ld -Wl,-Map=$(@:.elf=.map) -o $@ $(filter %.c, $^) $(LDLIBS) 104 | 105 | $(STUB_ELF_32C6BETA): $(SRCS) $(BUILD_DIR) ld/stub_32c6_beta.ld 106 | @echo " CC(32C6) $^ -> $@" 107 | $(Q) $(CROSS_32C6BETA)gcc $(CFLAGS_ESP32C3) -DESP32C6=1 -Tstub_32c6_beta.ld -Wl,-Map=$(@:.elf=.map) -o $@ $(filter %.c, $^) $(LDLIBS) 108 | 109 | $(STUB_PY): $(STUB_ELF_8266) $(STUB_ELF_32) $(STUB_ELF_32S2) $(STUB_ELF_32S3_BETA_2) $(STUB_ELF_32S3_BETA_3) $(STUB_ELF_32C3) $(STUB_ELF_32C6BETA) wrap_stub.py 110 | @echo " WRAP $^ -> $@" 111 | $(Q) $(WRAP_STUB) --out-file $@ $(filter %.elf,$^) 112 | 113 | embed: $(STUB_ELF_8266) $(STUB_ELF_32) $(STUB_ELF_32S2) $(STUB_ELF_32S3_BETA_2) $(STUB_ELF_32S3_BETA_3) $(STUB_ELF_32C3) $(STUB_ELF_32C6BETA) wrap_stub.py 114 | @echo " WRAP $^ -> esptool.py" 115 | $(Q) $(WRAP_STUB) $(filter %.elf,$^) 116 | 117 | clean: 118 | $(Q) rm -rf $(BUILD_DIR) 119 | -------------------------------------------------------------------------------- /tool_esptoolpy/flasher_stub/README.md: -------------------------------------------------------------------------------- 1 | This is the source of the software flasher stub. 2 | 3 | esptool.py loads the flasher stub into memory and executes it to: 4 | 5 | * Add features that the ESP8266 & ESP32 bootloader ROMs do not have. 6 | 7 | * Add features to the ESP8266 bootloader ROM which are only in the ESP32 ROM. 8 | 9 | * Improve flashing performance over the ROM bootloaders. 10 | 11 | * Work around bugs in the ESP8266 ROM bootloader. 12 | 13 | Thanks to [Cesanta](http://cesanta.com/) who provided the original ESP8266 stub loader upon which this loader is based. 14 | 15 | # To Use 16 | 17 | The stub loader is already automatically integrated into esptool.py. You don't need to do anything special to use it. 18 | 19 | # To Build 20 | 21 | If you want to build the stub to test modifications or updates, here's how: 22 | 23 | * You will need both an ESP8266 gcc toolchain (xtensa-lx106-elf-) and an ESP32 toolchain (xtensa-esp32-elf-) on your PATH. 24 | 25 | * Set the environment variables SDK_PATH to the path to an ESP8266 IoT NON-OS SDK directory (last stub was built with SDK v1.5.1). 26 | 27 | * Set the environment variable IDF_PATH to the path to an ESP-IDF directory. 28 | 29 | * Set any other environment variables you'd like to override in the Makefile. 30 | 31 | * To build type `make` 32 | 33 | # To Test 34 | 35 | To test the built stub, you can run `make embed`, which will update the stubs in `esptool.py` to the newly compiled ones. Or there are some convenience wrappers to make testing quicker to iterate on: 36 | 37 | * Running `esptool_test_stub.py` is the same as running `esptool.py`, only it uses the just-compiled stubs from the build directory. 38 | 39 | * Running `run_tests_with_stub.py` is the same as running `test/test_esptool.py`, only it uses the just-compiled stubs from the build directory. 40 | -------------------------------------------------------------------------------- /tool_esptoolpy/flasher_stub/compare_stubs.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from __future__ import division, print_function 3 | 4 | import sys 5 | 6 | # Compare the esptool stub loaders to freshly built ones 7 | # in the build directory 8 | # 9 | # (Used by CI to verify the stubs are up to date.) 10 | 11 | 12 | def verbose_diff(new, old): 13 | for k in ["data_start", "text_start"]: 14 | if new[k] != old[k]: 15 | print("New %s 0x%x old 0%x" % (k, new[k], old[k])) 16 | 17 | for k in ["data", "text"]: 18 | if len(new[k]) != len(old[k]): 19 | print("New %s %d bytes, old stub code %d bytes" % (k, len(new[k]), len(old[k]))) 20 | if new[k] != old[k]: 21 | print("%s is different" % k) 22 | if len(new[k]) == len(old[k]): 23 | for b in range(len(new[k])): 24 | if new[k][b] != old[k][b]: 25 | print(" Byte 0x%x: new 0x%02x old 0x%02x" % (b, ord(new[k][b]), ord(old[k][b]))) 26 | 27 | 28 | if __name__ == "__main__": 29 | same = True 30 | sys.path.append("..") 31 | import esptool 32 | 33 | old_8266_stub = esptool.ESP8266ROM.STUB_CODE 34 | old_32_stub = esptool.ESP32ROM.STUB_CODE 35 | old_32s2_stub = esptool.ESP32S2ROM.STUB_CODE 36 | old_32s3_beta2_stub = esptool.ESP32S3BETA2ROM.STUB_CODE 37 | old_32s3_beta3_stub = esptool.ESP32S3BETA3ROM.STUB_CODE 38 | old_32c3_stub = esptool.ESP32C3ROM.STUB_CODE 39 | old_32c6beta_stub = esptool.ESP32C6BETAROM.STUB_CODE 40 | 41 | # hackiness: importing this module updates the loaded esptool module with the new stubs 42 | import esptool_test_stub # noqa 43 | 44 | if esptool.ESP8266ROM.STUB_CODE != old_8266_stub: 45 | print("ESP8266 stub code in esptool.py is different to just-built stub") 46 | verbose_diff(esptool.ESP8266ROM.STUB_CODE, old_8266_stub) 47 | same = False 48 | if esptool.ESP32ROM.STUB_CODE != old_32_stub: 49 | print("ESP32 stub code in esptool.py is different to just-built stub.") 50 | verbose_diff(esptool.ESP32ROM.STUB_CODE, old_32_stub) 51 | same = False 52 | if esptool.ESP32S2ROM.STUB_CODE != old_32s2_stub: 53 | print("ESP32S2 stub code in esptool.py is different to just-built stub.") 54 | verbose_diff(esptool.ESP32S2ROM.STUB_CODE, old_32s2_stub) 55 | same = False 56 | if esptool.ESP32S3BETA2ROM.STUB_CODE != old_32s3_beta2_stub: 57 | print("ESP32S3 stub code in esptool.py is different to just-built stub.") 58 | verbose_diff(esptool.ESP32S3BETA2ROM.STUB_CODE, old_32s3_beta2_stub) 59 | same = False 60 | if esptool.ESP32S3BETA3ROM.STUB_CODE != old_32s3_beta3_stub: 61 | print("ESP32S3 stub code in esptool.py is different to just-built stub.") 62 | verbose_diff(esptool.ESP32S3BETA3ROM.STUB_CODE, old_32s3_beta3_stub) 63 | same = False 64 | if esptool.ESP32C3ROM.STUB_CODE != old_32c3_stub: 65 | print("ESP32C3 stub code in esptool.py is different to just-built stub.") 66 | verbose_diff(esptool.ESP32C3ROM.STUB_CODE, old_32c3_stub) 67 | same = False 68 | if esptool.ESP32C6BETAROM.STUB_CODE != old_32c6beta_stub: 69 | print("ESP32C6 stub code in esptool.py is different to just-built stub.") 70 | verbose_diff(esptool.ESP32C6BETAROM.STUB_CODE, old_32c6beta_stub) 71 | same = False 72 | if same: 73 | print("Stub code is the same") 74 | 75 | sys.exit(0 if same else 1) 76 | -------------------------------------------------------------------------------- /tool_esptoolpy/flasher_stub/esptool_test_stub.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Trivial wrapper program to run esptool.py using the just-compiled 4 | # flasher stub in the build/ subdirectory 5 | # 6 | # For use when developing new flasher_stubs, not important otherwise. 7 | # 8 | # Copyright (C) 2014-2016 Fredrik Ahlberg, Angus Gratton, other contributors as noted. 9 | # 10 | # This program is free software; you can redistribute it and/or modify it under 11 | # the terms of the GNU General Public License as published by the Free Software 12 | # Foundation; either version 2 of the License, or (at your option) any later version. 13 | # 14 | from __future__ import division, print_function 15 | 16 | import os.path 17 | import sys 18 | 19 | THIS_DIR = os.path.dirname(sys.argv[0]) 20 | 21 | sys.path.append("..") 22 | import esptool # noqa: E402 23 | 24 | 25 | # Python hackiness: evaluate the snippet in the context of the esptool module, so it 26 | # edits the esptool's global variables 27 | exec(open("%s/build/stub_flasher_snippet.py" % THIS_DIR).read(), esptool.__dict__, esptool.__dict__) 28 | 29 | 30 | if __name__ == "__main__": 31 | try: 32 | esptool.main() 33 | except esptool.FatalError as e: 34 | print('\nA fatal error occurred: %s' % e) 35 | sys.exit(2) 36 | -------------------------------------------------------------------------------- /tool_esptoolpy/flasher_stub/include/slip.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Cesanta Software Limited & (c) 2016-2019 Espressif Systems (Shanghai) PTE LTD 3 | * All rights reserved 4 | * 5 | * This program is free software; you can redistribute it and/or modify it under 6 | * the terms of the GNU General Public License as published by the Free Software 7 | * Foundation; either version 2 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 15 | * Street, Fifth Floor, Boston, MA 02110-1301 USA. 16 | */ 17 | 18 | #ifndef SLIP_H_ 19 | #define SLIP_H_ 20 | 21 | #include 22 | 23 | /* Send the SLIP frame begin/end delimiter. */ 24 | void SLIP_send_frame_delimiter(void); 25 | 26 | /* Send a single character of SLIP frame data, escaped as per SLIP escaping. */ 27 | void SLIP_send_frame_data(char ch); 28 | 29 | /* Send some SLIP frame data, escaped as per SLIP escaping. */ 30 | void SLIP_send_frame_data_buf(const void *buf, uint32_t size); 31 | 32 | /* Send a full SLIP frame, with specified contents. */ 33 | void SLIP_send(const void *pkt, uint32_t size); 34 | 35 | typedef enum { 36 | SLIP_NO_FRAME, 37 | SLIP_FRAME, 38 | SLIP_FRAME_ESCAPING 39 | } slip_state_t; 40 | 41 | int16_t SLIP_recv_byte(char byte, slip_state_t *state); 42 | 43 | #define SLIP_FINISHED_FRAME -2 44 | #define SLIP_NO_BYTE -1 45 | 46 | /* Receive a SLIP frame, with specified contents. */ 47 | uint32_t SLIP_recv(void *pkt, uint32_t max_len); 48 | 49 | #endif /* SLIP_H_ */ 50 | -------------------------------------------------------------------------------- /tool_esptoolpy/flasher_stub/include/stub_commands.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019 Espressif Systems (Shanghai) PTE LTD 3 | * All rights reserved 4 | * 5 | * This file is part of the esptool.py binary flasher stub. 6 | * 7 | * This program is free software; you can redistribute it and/or modify it under 8 | * the terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 17 | * Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | /* Flasher command handlers, called from stub_flasher.c 21 | 22 | Commands related to writing flash are in stub_write_flash_xxx. 23 | */ 24 | #pragma once 25 | #include "stub_flasher.h" 26 | #include "rom_functions.h" 27 | #include 28 | 29 | int handle_flash_erase(uint32_t addr, uint32_t len); 30 | 31 | void handle_flash_read(uint32_t addr, uint32_t len, uint32_t block_size, uint32_t max_in_flight); 32 | 33 | int handle_flash_get_md5sum(uint32_t addr, uint32_t len); 34 | 35 | int handle_flash_read_chip_id(); 36 | 37 | esp_command_error handle_spi_set_params(uint32_t *args, int *status); 38 | 39 | esp_command_error handle_spi_attach(uint32_t hspi_config_arg); 40 | 41 | esp_command_error handle_mem_begin(uint32_t size, uint32_t offset); 42 | 43 | esp_command_error handle_mem_data(void *data, uint32_t length); 44 | 45 | esp_command_error handle_mem_finish(void); 46 | 47 | typedef struct { 48 | uint32_t addr; 49 | uint32_t value; 50 | uint32_t mask; 51 | uint32_t delay_us; 52 | } write_reg_args_t; 53 | 54 | esp_command_error handle_write_reg(const write_reg_args_t *cmd_buf, uint32_t num_commands); 55 | 56 | /* Enabling 32-bit flash memory addressing for ESP32S3 */ 57 | #if defined(ESP32S3) 58 | esp_rom_spiflash_result_t SPIRead4B(int spi_num, SpiFlashRdMode mode, uint32_t flash_addr, uint8_t* buf, int len); 59 | #endif // ESP32S3 60 | -------------------------------------------------------------------------------- /tool_esptoolpy/flasher_stub/include/stub_flasher.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Cesanta Software Limited and 2016-2019 Espressif Systems (Shanghai) PTE LTD 3 | * 4 | * All rights reserved 5 | * 6 | * This program is free software; you can redistribute it and/or modify it under 7 | * the terms of the GNU General Public License as published by the Free Software 8 | * Foundation; either version 2 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 12 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 16 | * Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #ifndef STUB_FLASHER_H_ 20 | #define STUB_FLASHER_H_ 21 | 22 | #include 23 | 24 | /* Maximum write block size, used for various buffers. */ 25 | #define MAX_WRITE_BLOCK 0x4000 26 | 27 | /* Flash geometry constants */ 28 | #define FLASH_SECTOR_SIZE 4096 29 | #define FLASH_BLOCK_SIZE 65536 30 | #define FLASH_PAGE_SIZE 256 31 | #define FLASH_STATUS_MASK 0xFFFF 32 | #define SECTORS_PER_BLOCK (FLASH_BLOCK_SIZE / FLASH_SECTOR_SIZE) 33 | 34 | /* 32-bit addressing is supported only by ESP32S3 */ 35 | #if defined(ESP32S3) 36 | #define FLASH_MAX_SIZE 64*1024*1024 37 | #else 38 | #define FLASH_MAX_SIZE 16*1024*1024 39 | #endif 40 | 41 | /* Full set of protocol commands */ 42 | typedef enum { 43 | /* Commands supported by the ESP8266 & ESP32 bootloaders */ 44 | ESP_FLASH_BEGIN = 0x02, 45 | ESP_FLASH_DATA = 0x03, 46 | ESP_FLASH_END = 0x04, 47 | ESP_MEM_BEGIN = 0x05, 48 | ESP_MEM_END = 0x06, 49 | ESP_MEM_DATA = 0x07, 50 | ESP_SYNC = 0x08, 51 | ESP_WRITE_REG = 0x09, 52 | ESP_READ_REG = 0x0a, 53 | 54 | /* Commands supported by the ESP32 bootloader */ 55 | ESP_SPI_SET_PARAMS = 0x0b, 56 | ESP_PIN_READ = 0x0c, /* ??? */ 57 | ESP_SPI_ATTACH = 0x0d, 58 | ESP_SPI_READ = 0x0e, 59 | ESP_SET_BAUD = 0x0f, 60 | ESP_FLASH_DEFLATED_BEGIN = 0x10, 61 | ESP_FLASH_DEFLATED_DATA = 0x11, 62 | ESP_FLASH_DEFLATED_END = 0x12, 63 | ESP_FLASH_VERIFY_MD5 = 0x13, 64 | 65 | /* Stub-only commands */ 66 | ESP_ERASE_FLASH = 0xD0, 67 | ESP_ERASE_REGION = 0xD1, 68 | ESP_READ_FLASH = 0xD2, 69 | ESP_RUN_USER_CODE = 0xD3, 70 | 71 | /* Flash encryption debug mode supported command */ 72 | ESP_FLASH_ENCRYPT_DATA = 0xD4, 73 | } esp_command; 74 | 75 | /* Command request header */ 76 | typedef struct __attribute__((packed)) { 77 | uint8_t zero; 78 | uint8_t op; /* maps to esp_command enum */ 79 | uint16_t data_len; 80 | int32_t checksum; 81 | uint8_t data_buf[32]; /* actually variable length, determined by data_len */ 82 | } esp_command_req_t; 83 | 84 | /* Command response header */ 85 | typedef struct __attribute__((packed)) { 86 | uint8_t resp; /* should be '1' */ 87 | uint8_t op_ret; /* Should match 'op' */ 88 | uint16_t len_ret; /* Length of result data (can be ignored as SLIP framing helps) */ 89 | int32_t value; /* 32-bit response used by some commands */ 90 | } esp_command_response_t; 91 | 92 | 93 | /* command response has some (optional) data after it, then 2 (or 4 on ESP32 ROM) 94 | bytes of status. 95 | */ 96 | typedef struct __attribute__((packed)) { 97 | uint8_t error; /* non-zero = failed */ 98 | uint8_t status; /* status of a failure */ 99 | } esp_command_data_status_t; 100 | 101 | /* Error codes */ 102 | typedef enum { 103 | ESP_OK = 0, 104 | 105 | ESP_BAD_DATA_LEN = 0xC0, 106 | ESP_BAD_DATA_CHECKSUM = 0xC1, 107 | ESP_BAD_BLOCKSIZE = 0xC2, 108 | ESP_INVALID_COMMAND = 0xC3, 109 | ESP_FAILED_SPI_OP = 0xC4, 110 | ESP_FAILED_SPI_UNLOCK = 0xC5, 111 | ESP_NOT_IN_FLASH_MODE = 0xC6, 112 | ESP_INFLATE_ERROR = 0xC7, 113 | ESP_NOT_ENOUGH_DATA = 0xC8, 114 | ESP_TOO_MUCH_DATA = 0xC9, 115 | 116 | ESP_CMD_NOT_IMPLEMENTED = 0xFF, 117 | } esp_command_error; 118 | 119 | #endif /* STUB_FLASHER_H_ */ 120 | -------------------------------------------------------------------------------- /tool_esptoolpy/flasher_stub/include/stub_io.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Cesanta Software Limited and 2016-2020 Espressif Systems (Shanghai) PTE LTD 3 | * 4 | * All rights reserved 5 | * 6 | * This program is free software; you can redistribute it and/or modify it under 7 | * the terms of the GNU General Public License as published by the Free Software 8 | * Foundation; either version 2 of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 12 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 16 | * Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | /* Call to initialize the I/O (either UART or USB CDC at this point). 25 | * The argument is a callback function which will handle received characters, 26 | * when asynchronous (interrupt-driven) RX is used. 27 | * It will be called in an interrupt context. 28 | */ 29 | void stub_io_init(void(*rx_cb_func)(char)); 30 | 31 | /* Enable or disable asynchronous (interrupt-driven) RX, for UART or USB. 32 | * Currently needed only for the read_flash command. 33 | */ 34 | void stub_rx_async_enable(bool enable); 35 | 36 | /* Wrapper for either uart_tx_one_char or the USB CDC output function. 37 | * (uart_tx_one_char in ROM can also handle USB CDC, but it is really 38 | * slow because it flushes the FIFO after every byte). 39 | */ 40 | void stub_tx_one_char(char c); 41 | 42 | /* A blocking (polling) function to receive one character. 43 | * Should only be used when async (interrupt-driven) RX is disabled. 44 | * Currently only needed for the read_flash command. 45 | */ 46 | char stub_rx_one_char(void); 47 | 48 | /* Returns after making sure that all output has been sent to the host */ 49 | void stub_tx_flush(void); 50 | 51 | /* Updates the baud rate divider based on the current baud rate (from host perspective) 52 | * and the requested baud rate. 53 | * No-op for USB CDC. 54 | */ 55 | void stub_io_set_baudrate(uint32_t current_baud, uint32_t new_baud); 56 | 57 | /* To be called periodically while waiting for a command. 58 | * No-op for UART, handles DTR/RTS reset for USB CDC. 59 | */ 60 | void stub_io_idle_hook(void); 61 | 62 | 63 | -------------------------------------------------------------------------------- /tool_esptoolpy/flasher_stub/include/stub_write_flash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019 Espressif Systems (Shanghai) PTE LTD 3 | * All rights reserved 4 | * 5 | * This file is part of the esptool.py binary flasher stub. 6 | * 7 | * This program is free software; you can redistribute it and/or modify it under 8 | * the terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 17 | * Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | /* Flasher commands related to writing flash */ 21 | #pragma once 22 | #include "stub_flasher.h" 23 | #include 24 | #include "rom_functions.h" 25 | 26 | bool is_in_flash_mode(void); 27 | 28 | esp_command_error get_flash_error(void); 29 | 30 | esp_command_error handle_flash_begin(uint32_t total_size, uint32_t offset); 31 | 32 | esp_command_error handle_flash_deflated_begin(uint32_t uncompressed_size, uint32_t compressed_size, uint32_t offset); 33 | 34 | void handle_flash_data(void *data_buf, uint32_t length); 35 | 36 | #if !ESP8266 37 | void handle_flash_encrypt_data(void *data_buf, uint32_t length); 38 | #endif 39 | 40 | void handle_flash_deflated_data(void *data_buf, uint32_t length); 41 | 42 | /* same command used for deflated or non-deflated mode */ 43 | esp_command_error handle_flash_end(void); 44 | 45 | /* Enabling 32-bit flash memory addressing for ESP32S3 */ 46 | #if defined(ESP32S3) 47 | esp_rom_spiflash_result_t page_program_internal(int spi_num, SpiFlashRdMode mode, uint32_t spi_addr, uint8_t* addr_source, uint32_t byte_length); 48 | 49 | esp_rom_spiflash_result_t SPIWrite4B(int spi_num, SpiFlashRdMode mode, uint32_t target, uint8_t *src_addr, int32_t len); 50 | #endif // ESP32S3 51 | -------------------------------------------------------------------------------- /tool_esptoolpy/flasher_stub/ld/stub_32.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Cesanta Software Limited 3 | * All rights reserved 4 | * 5 | * This program is free software; you can redistribute it and/or modify it under 6 | * the terms of the GNU General Public License as published by the Free Software 7 | * Foundation; either version 2 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 15 | * Street, Fifth Floor, Boston, MA 02110-1301 USA. 16 | */ 17 | 18 | /* Note: stub is deliberately loaded close to the very top 19 | of available RAM, to reduce change of colliding with anything 20 | else... */ 21 | MEMORY { 22 | iram : org = 0x400BE000, len = 0x1000 23 | dram : org = 0x3ffcc000, len = 0x14000 24 | } 25 | 26 | ENTRY(stub_main) 27 | 28 | SECTIONS { 29 | .text : ALIGN(4) { 30 | *(.literal) 31 | *(.text .text.*) 32 | } > iram 33 | 34 | .bss : ALIGN(4) { 35 | _bss_start = ABSOLUTE(.); 36 | *(.bss) 37 | _bss_end = ABSOLUTE(.); 38 | } > dram 39 | 40 | .data : ALIGN(4) { 41 | *(.data) 42 | *(.rodata .rodata.*) 43 | } > dram 44 | } 45 | 46 | INCLUDE "rom_32.ld" 47 | -------------------------------------------------------------------------------- /tool_esptoolpy/flasher_stub/ld/stub_32c3.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Espressif Systems (Shanghai) PTE LTD 3 | * All rights reserved 4 | * 5 | * This program is free software; you can redistribute it and/or modify it under 6 | * the terms of the GNU General Public License as published by the Free Software 7 | * Foundation; either version 2 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 15 | * Street, Fifth Floor, Boston, MA 02110-1301 USA. 16 | */ 17 | 18 | MEMORY { 19 | iram : org = 0x40380000, len = 0x4000 20 | dram : org = 0x3FC84000, len = 0x18000 21 | } 22 | 23 | ENTRY(stub_main) 24 | 25 | SECTIONS { 26 | .text : ALIGN(4) { 27 | *(.literal) 28 | *(.text .text.*) 29 | } > iram 30 | 31 | .bss : ALIGN(4) { 32 | _bss_start = ABSOLUTE(.); 33 | *(.bss) 34 | _bss_end = ABSOLUTE(.); 35 | } > dram 36 | 37 | .data : ALIGN(4) { 38 | *(.data) 39 | *(.rodata .rodata.*) 40 | } > dram 41 | } 42 | 43 | INCLUDE "rom_32c3.ld" 44 | -------------------------------------------------------------------------------- /tool_esptoolpy/flasher_stub/ld/stub_32c6_beta.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Espressif Systems (Shanghai) PTE LTD 3 | * All rights reserved 4 | * 5 | * This program is free software; you can redistribute it and/or modify it under 6 | * the terms of the GNU General Public License as published by the Free Software 7 | * Foundation; either version 2 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 15 | * Street, Fifth Floor, Boston, MA 02110-1301 USA. 16 | */ 17 | 18 | MEMORY { 19 | iram : org = 0x40380000, len = 0x4000 20 | dram : org = 0x3FC84000, len = 0x18000 21 | } 22 | 23 | ENTRY(stub_main) 24 | 25 | SECTIONS { 26 | .text : ALIGN(4) { 27 | *(.literal) 28 | *(.text .text.*) 29 | } > iram 30 | 31 | .bss : ALIGN(4) { 32 | _bss_start = ABSOLUTE(.); 33 | *(.bss) 34 | _bss_end = ABSOLUTE(.); 35 | } > dram 36 | 37 | .data : ALIGN(4) { 38 | *(.data) 39 | *(.rodata .rodata.*) 40 | } > dram 41 | } 42 | 43 | INCLUDE "rom_32c6_beta.ld" 44 | -------------------------------------------------------------------------------- /tool_esptoolpy/flasher_stub/ld/stub_32s2.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Espressif Systems (Shanghai) PTE LTD 3 | * All rights reserved 4 | * 5 | * This program is free software; you can redistribute it and/or modify it under 6 | * the terms of the GNU General Public License as published by the Free Software 7 | * Foundation; either version 2 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 15 | * Street, Fifth Floor, Boston, MA 02110-1301 USA. 16 | */ 17 | 18 | MEMORY { 19 | iram : org = 0x40028000, len = 0x18000 20 | dram : org = 0x3FFD0000, len = 0x28000 21 | } 22 | 23 | ENTRY(stub_main) 24 | 25 | SECTIONS { 26 | .text : ALIGN(4) { 27 | *(.literal) 28 | *(.text .text.*) 29 | } > iram 30 | 31 | .bss : ALIGN(4) { 32 | _bss_start = ABSOLUTE(.); 33 | *(.bss) 34 | _bss_end = ABSOLUTE(.); 35 | } > dram 36 | 37 | .data : ALIGN(4) { 38 | *(.data) 39 | *(.rodata .rodata.*) 40 | } > dram 41 | } 42 | 43 | INCLUDE "rom_32s2.ld" 44 | -------------------------------------------------------------------------------- /tool_esptoolpy/flasher_stub/ld/stub_32s3_beta_2.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Espressif Systems (Shanghai) PTE LTD 3 | * All rights reserved 4 | * 5 | * This program is free software; you can redistribute it and/or modify it under 6 | * the terms of the GNU General Public License as published by the Free Software 7 | * Foundation; either version 2 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 15 | * Street, Fifth Floor, Boston, MA 02110-1301 USA. 16 | */ 17 | 18 | MEMORY { 19 | iram : org = 0x40378000, len = 0x18000 20 | dram : org = 0x3FCA0000, len = 0x28000 21 | } 22 | 23 | ENTRY(stub_main) 24 | 25 | SECTIONS { 26 | .text : ALIGN(4) { 27 | *(.literal) 28 | *(.text .text.*) 29 | } > iram 30 | 31 | .bss : ALIGN(4) { 32 | _bss_start = ABSOLUTE(.); 33 | *(.bss) 34 | _bss_end = ABSOLUTE(.); 35 | } > dram 36 | 37 | .data : ALIGN(4) { 38 | *(.data) 39 | *(.rodata .rodata.*) 40 | } > dram 41 | } 42 | 43 | INCLUDE "rom_32s3_beta_2.ld" 44 | -------------------------------------------------------------------------------- /tool_esptoolpy/flasher_stub/ld/stub_32s3_beta_3.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Espressif Systems (Shanghai) PTE LTD 3 | * All rights reserved 4 | * 5 | * This program is free software; you can redistribute it and/or modify it under 6 | * the terms of the GNU General Public License as published by the Free Software 7 | * Foundation; either version 2 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 15 | * Street, Fifth Floor, Boston, MA 02110-1301 USA. 16 | */ 17 | 18 | MEMORY { 19 | iram : org = 0x40378000, len = 0x18000 20 | dram : org = 0x3FCA0000, len = 0x28000 21 | } 22 | 23 | ENTRY(stub_main) 24 | 25 | SECTIONS { 26 | .text : ALIGN(4) { 27 | *(.literal) 28 | *(.text .text.*) 29 | } > iram 30 | 31 | .bss : ALIGN(4) { 32 | _bss_start = ABSOLUTE(.); 33 | *(.bss) 34 | _bss_end = ABSOLUTE(.); 35 | } > dram 36 | 37 | .data : ALIGN(4) { 38 | *(.data) 39 | *(.rodata .rodata.*) 40 | } > dram 41 | } 42 | 43 | INCLUDE "rom_32s3_beta_3.ld" 44 | -------------------------------------------------------------------------------- /tool_esptoolpy/flasher_stub/ld/stub_8266.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Cesanta Software Limited 3 | * All rights reserved 4 | * 5 | * This program is free software; you can redistribute it and/or modify it under 6 | * the terms of the GNU General Public License as published by the Free Software 7 | * Foundation; either version 2 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 15 | * Street, Fifth Floor, Boston, MA 02110-1301 USA. 16 | */ 17 | 18 | /* Note: stub is deliberately loaded close to the very top 19 | of available RAM, to reduce change of colliding with anything 20 | else... */ 21 | MEMORY { 22 | iram : org = 0x4010D000, len = 0x2100 23 | dram : org = 0x3FFE8100, len = 0x13f00 24 | } 25 | 26 | ENTRY(stub_main_8266) 27 | 28 | SECTIONS { 29 | .text : ALIGN(4) { 30 | *(.literal) 31 | *(.text .text.*) 32 | } > iram 33 | 34 | .bss : ALIGN(4) { 35 | _bss_start = ABSOLUTE(.); 36 | *(.bss) 37 | _bss_end = ABSOLUTE(.); 38 | } > dram 39 | 40 | .data : ALIGN(4) { 41 | *(.data) 42 | *(.rodata .rodata.*) 43 | } > dram 44 | } 45 | 46 | INCLUDE "rom_8266.ld" 47 | 48 | PROVIDE(SPIFlashModeConfig = 0x40004568); 49 | PROVIDE(SPIParamCfg = 0x40004c2c); 50 | -------------------------------------------------------------------------------- /tool_esptoolpy/flasher_stub/run_tests_with_stub.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Run test/test_esptool.py using the newly compiled stub, for quick tests 4 | # 5 | # Usage same as test/test_esptool.py 6 | [ -z $PYTHON ] && PYTHON=python 7 | 8 | THISDIR=`realpath -m $(dirname $0)` 9 | 10 | export ESPTOOL_PY="${THISDIR}/esptool_test_stub.py" 11 | ${PYTHON} ${THISDIR}/../test/test_esptool.py $@ 12 | -------------------------------------------------------------------------------- /tool_esptoolpy/flasher_stub/slip.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Cesanta Software Limited & Espressif Systems (Shanghai) PTE LTD 3 | * All rights reserved 4 | * 5 | * This program is free software; you can redistribute it and/or modify it under 6 | * the terms of the GNU General Public License as published by the Free Software 7 | * Foundation; either version 2 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 15 | * Street, Fifth Floor, Boston, MA 02110-1301 USA. 16 | */ 17 | 18 | #include 19 | #include "slip.h" 20 | #include "stub_io.h" 21 | 22 | void SLIP_send_frame_delimiter(void) { 23 | stub_tx_one_char('\xc0'); 24 | } 25 | 26 | void SLIP_send_frame_data(char ch) { 27 | if(ch == '\xc0') { 28 | stub_tx_one_char('\xdb'); 29 | stub_tx_one_char('\xdc'); 30 | } else if (ch == '\xdb') { 31 | stub_tx_one_char('\xdb'); 32 | stub_tx_one_char('\xdd'); 33 | } else { 34 | stub_tx_one_char(ch); 35 | } 36 | } 37 | 38 | void SLIP_send_frame_data_buf(const void *buf, uint32_t size) { 39 | const uint8_t *buf_c = (const uint8_t *)buf; 40 | for(int i = 0; i < size; i++) { 41 | SLIP_send_frame_data(buf_c[i]); 42 | } 43 | } 44 | 45 | void SLIP_send(const void *pkt, uint32_t size) { 46 | SLIP_send_frame_delimiter(); 47 | SLIP_send_frame_data_buf(pkt, size); 48 | SLIP_send_frame_delimiter(); 49 | } 50 | 51 | int16_t SLIP_recv_byte(char byte, slip_state_t *state) 52 | { 53 | if (byte == '\xc0') { 54 | if (*state == SLIP_NO_FRAME) { 55 | *state = SLIP_FRAME; 56 | return SLIP_NO_BYTE; 57 | } else { 58 | *state = SLIP_NO_FRAME; 59 | return SLIP_FINISHED_FRAME; 60 | } 61 | } 62 | 63 | switch(*state) { 64 | case SLIP_NO_FRAME: 65 | return SLIP_NO_BYTE; 66 | case SLIP_FRAME: 67 | if (byte == '\xdb') { 68 | *state = SLIP_FRAME_ESCAPING; 69 | return SLIP_NO_BYTE; 70 | } 71 | return byte; 72 | case SLIP_FRAME_ESCAPING: 73 | if (byte == '\xdc') { 74 | *state = SLIP_FRAME; 75 | return '\xc0'; 76 | } 77 | if (byte == '\xdd') { 78 | *state = SLIP_FRAME; 79 | return '\xdb'; 80 | } 81 | return SLIP_NO_BYTE; /* actually a framing error */ 82 | } 83 | return SLIP_NO_BYTE; /* actually a framing error */ 84 | } 85 | 86 | /* This function is needed for the synchornous I/O case, 87 | * which is only flash_read command at the moment. 88 | */ 89 | uint32_t SLIP_recv(void *pkt, uint32_t max_len) { 90 | uint32_t len = 0; 91 | slip_state_t state = SLIP_NO_FRAME; 92 | uint8_t *p = (uint8_t *) pkt; 93 | 94 | int16_t r; 95 | do { 96 | r = SLIP_recv_byte(stub_rx_one_char(), &state); 97 | if(r >= 0 && len < max_len) { 98 | p[len++] = (uint8_t)r; 99 | } 100 | } while(r != SLIP_FINISHED_FRAME); 101 | 102 | return len; 103 | } 104 | -------------------------------------------------------------------------------- /tool_esptoolpy/flasher_stub/wrap_stub.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # 3 | # Stub has to be generated via Python 3, for correct repr() output 4 | # 5 | # Copyright (c) 2016 Cesanta Software Limited & Copyright (c) 2016-2019 Espressif Systems (Shanghai) PTE LTD 6 | # All rights reserved 7 | # 8 | # This program is free software; you can redistribute it and/or modify it under 9 | # the terms of the GNU General Public License as published by the Free Software 10 | # Foundation; either version 2 of the License, or (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but WITHOUT 13 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along with 17 | # this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 18 | # Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | from __future__ import division, print_function 20 | 21 | import argparse 22 | import base64 23 | import os 24 | import os.path 25 | import re 26 | import sys 27 | import zlib 28 | 29 | sys.path.append('..') 30 | import esptool # noqa: E402 31 | 32 | 33 | def wrap_stub(elf_file): 34 | """ Wrap an ELF file into a stub 'dict' """ 35 | print('Wrapping ELF file %s...' % elf_file) 36 | e = esptool.ELFFile(elf_file) 37 | 38 | text_section = e.get_section('.text') 39 | try: 40 | data_section = e.get_section('.data') 41 | except ValueError: 42 | data_section = None 43 | stub = { 44 | 'text': text_section.data, 45 | 'text_start': text_section.addr, 46 | 'entry': e.entrypoint, 47 | } 48 | if data_section is not None: 49 | stub['data'] = data_section.data 50 | stub['data_start'] = data_section.addr 51 | 52 | # Pad text with NOPs to mod 4. 53 | if len(stub['text']) % 4 != 0: 54 | stub['text'] += (4 - (len(stub['text']) % 4)) * '\0' 55 | 56 | print('Stub text: %d @ 0x%08x, data: %d @ 0x%08x, entry @ 0x%x' % ( 57 | len(stub['text']), stub['text_start'], 58 | len(stub.get('data', '')), stub.get('data_start', 0), 59 | stub['entry']), file=sys.stderr) 60 | return stub 61 | 62 | 63 | PYTHON_TEMPLATE = """\ 64 | ESP%sROM.STUB_CODE = eval(zlib.decompress(base64.b64decode(b\"\"\" 65 | %s\"\"\"))) 66 | """ 67 | 68 | ESPTOOL_PY = "../esptool.py" 69 | 70 | 71 | def write_python_snippet_to_file(stub_name, stub_data, out_file): 72 | print("writing %s stub" % stub_name) 73 | encoded = base64.b64encode(zlib.compress(repr(stub_data).encode("utf-8"), 9)).decode("utf-8") 74 | in_lines = "" 75 | # split encoded data into 160 character lines 76 | LINE_LEN = 160 77 | for c in range(0, len(encoded), LINE_LEN): 78 | in_lines += encoded[c:c + LINE_LEN] + "\\\n" 79 | out_file.write(PYTHON_TEMPLATE % (stub_name, in_lines)) 80 | 81 | 82 | def write_python_snippets(stub_dict, out_file): 83 | for name, stub_data in stub_dict.items(): 84 | m = re.match(r"stub_flasher_([a-z0-9_]+)", name) 85 | key = m.group(1).upper() 86 | write_python_snippet_to_file(key, stub_data, out_file) 87 | 88 | 89 | def embed_python_snippets(stubs): 90 | with open(ESPTOOL_PY, 'r') as f: 91 | lines = [line for line in f] 92 | 93 | with open(ESPTOOL_PY, "w") as f: 94 | skip_until = None 95 | for line in lines: 96 | if skip_until is not None: 97 | if skip_until in line: 98 | skip_until = None 99 | continue 100 | 101 | m = re.search(r"ESP([A-Z0-9]+)ROM.STUB_CODE = eval", line) 102 | if not m: 103 | f.write(line) 104 | continue 105 | 106 | key = m.group(1) 107 | stub_data = stubs.get("stub_flasher_%s" % key.lower(), None) 108 | if not stub_data: 109 | f.write(line) 110 | continue 111 | 112 | write_python_snippet_to_file(key, stub_data, f) 113 | skip_until = r'""")))' 114 | 115 | 116 | def stub_name(filename): 117 | """ Return a dictionary key for the stub with filename 'filename' """ 118 | return os.path.splitext(os.path.basename(filename))[0] 119 | 120 | 121 | if __name__ == '__main__': 122 | parser = argparse.ArgumentParser() 123 | parser.add_argument("--out-file", required=False, type=argparse.FileType('w'), 124 | help="Output file name. If not specified, stubs are embedded into esptool.py.") 125 | parser.add_argument("elf_files", nargs="+", help="Stub ELF files to convert") 126 | args = parser.parse_args() 127 | 128 | stubs = dict((stub_name(elf_file), wrap_stub(elf_file)) for elf_file in args.elf_files) 129 | if args.out_file: 130 | print('Dumping to Python snippet file %s.' % args.out_file.name) 131 | write_python_snippets(stubs, args.out_file) 132 | else: 133 | print('Embedding Python snippets into esptool.py') 134 | embed_python_snippets(stubs) 135 | -------------------------------------------------------------------------------- /tool_esptoolpy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tool-esptoolpy", 3 | "version": "1.30100.210531", 4 | "description": "Espressif ESP8266 and ESP32 serial bootloader utility", 5 | "keywords": [ 6 | "tools", 7 | "uploader", 8 | "espressif" 9 | ], 10 | "license": "GPL-2.0-or-later", 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/espressif/esptool" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tool_esptoolpy/setup.cfg: -------------------------------------------------------------------------------- 1 | [flake8] 2 | exclude = ecdsa,.git,__pycache__,.eggs,build 3 | max-line-length = 160 4 | ignore = 5 | # multiple spaces before operator - used for visual indent of constants in some files 6 | E221, 7 | 8 | # various future imports we don't need: absolute_import, with_statement, unicode_literals, generator_stop 9 | # nested_scopes, generators, annotations 10 | # 11 | # See https://pypi.org/project/flake8-future-import/ for list 12 | FI11, FI12, FI14, FI15, FI16, FI17, FI18, 13 | 14 | # future imports we do need: division, print_function 15 | FI50, FI53, 16 | per-file-ignores = 17 | # tests often manipulate sys.path before importing the main tools, so ignore import order violations 18 | test/*.py: E402, 19 | 20 | # multiple spaces after ',' - used for visual layout of eFuse data 21 | espressif/efuse/*/mem_definition.py: E241, 22 | espressif/efuse/*/fields.py: E241, 23 | 24 | # don't require future imports or check for unused imports in __init__.py files 25 | __init__.py: FI10, FI13, F401 26 | test/sitecustomize.py: FI10, FI13 27 | -------------------------------------------------------------------------------- /tool_esptoolpy/setup.py: -------------------------------------------------------------------------------- 1 | from __future__ import division, print_function 2 | 3 | import io 4 | import os 5 | import re 6 | import sys 7 | 8 | try: 9 | from setuptools import find_packages, setup 10 | except ImportError: 11 | print('Package setuptools is missing from your Python installation. Please see the installation section of ' 12 | 'the README for instructions on how to install it.') 13 | exit(1) 14 | 15 | 16 | # Example code to pull version from esptool.py with regex, taken from 17 | # http://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/ 18 | def read(*names, **kwargs): 19 | with io.open( 20 | os.path.join(os.path.dirname(__file__), *names), 21 | encoding=kwargs.get("encoding", "utf8") 22 | ) as fp: 23 | return fp.read() 24 | 25 | 26 | def find_version(*file_paths): 27 | version_file = read(*file_paths) 28 | version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", 29 | version_file, re.M) 30 | if version_match: 31 | return version_match.group(1) 32 | raise RuntimeError("Unable to find version string.") 33 | 34 | 35 | long_description = """ 36 | ========== 37 | esptool.py 38 | ========== 39 | A command line utility to communicate with the ROM bootloader in Espressif ESP8266 & ESP32 microcontrollers. 40 | 41 | Allows flashing firmware, reading back firmware, querying chip parameters, etc. 42 | 43 | The esptool.py project is hosted on github: https://github.com/espressif/esptool 44 | 45 | Installation 46 | ------------ 47 | 48 | esptool can be installed via pip: 49 | 50 | $ pip install --upgrade esptool 51 | 52 | Since version 1.3, esptool supports both Python 2.7 and Python 3.4 or newer. 53 | 54 | Since version 2.0, esptool supports both ESP8266 & ESP32. 55 | 56 | Usage 57 | ----- 58 | 59 | Please see the `Usage section of the README.md file `_. 60 | 61 | You can also get help information by running `esptool.py --help`. 62 | 63 | Contributing 64 | ------------ 65 | Please see the `CONTRIBUTING.md file on github `_. 66 | """ 67 | 68 | # For Windows, we want to install esptool.py.exe, etc. so that normal Windows command line can run them 69 | # For Linux/macOS, we can't use console_scripts with extension .py as their names will clash with the modules' names. 70 | if os.name == "nt": 71 | scripts = None 72 | entry_points = { 73 | 'console_scripts': [ 74 | 'esptool.py=esptool:_main', 75 | 'espsecure.py=espsecure:_main', 76 | 'espefuse.py=espefuse:_main', 77 | ], 78 | } 79 | else: 80 | scripts = ['esptool.py', 81 | 'espsecure.py', 82 | 'espefuse.py'] 83 | entry_points = None 84 | 85 | setup( 86 | name='esptool', 87 | py_modules=['esptool', 'espsecure', 'espefuse'], 88 | version=find_version('esptool.py'), 89 | description='A serial utility to communicate & flash code to Espressif ESP8266 & ESP32 chips.', 90 | long_description=long_description, 91 | url='https://github.com/espressif/esptool', 92 | author='Fredrik Ahlberg (themadinventor) & Angus Gratton (projectgus)', 93 | author_email='angus@espressif.com', 94 | license='GPLv2+', 95 | classifiers=[ 96 | 'Development Status :: 5 - Production/Stable', 97 | 'Intended Audience :: Developers', 98 | 'Natural Language :: English', 99 | 'Operating System :: POSIX', 100 | 'Operating System :: Microsoft :: Windows', 101 | 'Operating System :: MacOS :: MacOS X', 102 | 'Topic :: Software Development :: Embedded Systems', 103 | 'Environment :: Console', 104 | 'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)', 105 | 'Programming Language :: Python :: 2.7', 106 | 'Programming Language :: Python :: 3.4', # Note: when dropping 3.4 support we can also remove the check in setup_requires 107 | 'Programming Language :: Python :: 3.5', 108 | 'Programming Language :: Python :: 3.6', 109 | 'Programming Language :: Python :: 3.7', 110 | 'Programming Language :: Python :: 3.8', 111 | 'Programming Language :: Python :: 3.9', 112 | ], 113 | setup_requires=['wheel'] if sys.version_info[0:2] not in [(3, 4), (3, 5)] else [], 114 | extras_require={ 115 | "dev": [ 116 | 'flake8>=3.2.0', 117 | 'flake8-future-import', 118 | 'flake8-import-order', 119 | 'pyelftools', 120 | 'unittest-xml-reporting<=2.5.2', # the replacement of the old xmlrunner package (Python 2 comp. version) 121 | 'coverage', 122 | ], 123 | }, 124 | install_requires=[ 125 | 'bitstring>=3.1.6', 126 | 'cryptography>=2.1.4', 127 | 'ecdsa>=0.16.0', 128 | 'pyserial>=3.0', 129 | 'reedsolo>=1.5.3,<=1.5.4', 130 | ], 131 | packages=find_packages(), 132 | scripts=scripts, 133 | entry_points=entry_points, 134 | ) 135 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/.covconf: -------------------------------------------------------------------------------- 1 | [run] 2 | parallel = true 3 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/README.md: -------------------------------------------------------------------------------- 1 | # esptool.py test cases README 2 | 3 | # test_elf2image.py 4 | 5 | Exists to catch unexpected changes in elf2image or image_info output. Does not require an ESP8266 to verify. 6 | 7 | ## About Tests 8 | 9 | Test method is fairly lo-fi: 10 | 11 | Directory test/elf2image/ contains subdirectories esp8266-v1, esp8266-v2 and esp32. These contain test cases. 12 | 13 | Each test case is a .elf file, which is stored alongside one or more .bin files representing the output of elf2image, and one .txt file representing the output of image_info when reading back the binary. 14 | 15 | Default run of test_elf2image.py will re-run elf2image & image_info on all these images. Suitable --chip and --version args are supplied, determined by the directory name. 16 | 17 | The test runner verifies that nothing in the output of either command has changed. 18 | 19 | ## Dealing With Output Changes 20 | 21 | If changes are detected, we can check if valid images are still being produced. If the changes turn out to be OK, running "test_elf2image.py --regen" will regenerate all of the .bin and .txt files for the test cases. 22 | 23 | (--regen can also be used to evaluate test failures, by looking at git diff output.) 24 | 25 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/ci/multirun_with_pyenv.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | # 3 | # Tool for running scripts with several versions of Python by the use of pyenv (versions must be installed before in 4 | # the docker image) 5 | # 6 | # Examples: 7 | # ./multirun_with_pyenv.sh ./exec.sh # Run ./exec.h with ALL installed versions of Python 8 | # ./multirun_with_pyenv.sh ./exec.sh arg1 arg2 # Run ./exec.h with arguments (and ALL installed versions of Python) 9 | # ./multirun_with_pyenv.sh -p 2.7.15 ./exec.sh # Run ./exec.h with Python 2.7.15 (-p must be the first argument) 10 | # ./multirun_with_pyenv.sh -p 3.4.8,2.7.15 ./exec.sh # Run ./exec.h with Python 3.4.8 and 2.7.15 (versions must be 11 | # # separated by coma and be without a space) 12 | 13 | PY_VERSIONS="" 14 | 15 | { source /opt/pyenv/activate; } || { echo 'Pyenv activation has failed!' ; exit 1; } 16 | 17 | if [ "$1" = "-p" ]; then 18 | if [ "$#" -ge 2 ]; then 19 | IFS=',' read -a PY_VERSIONS <<< "$2" 20 | shift #remove -p 21 | shift #remove argument after -p 22 | else 23 | echo 'No value (Python version) is given for argument -p!' 24 | exit 1 25 | fi 26 | else 27 | PY_VERSIONS=$(pyenv versions --bare) 28 | fi 29 | 30 | if [ "$#" -lt 1 ]; then 31 | echo 'No executable was passed to the runner!' 32 | exit 1 33 | fi 34 | 35 | for ver in ${PY_VERSIONS[@]} 36 | do 37 | echo 'Switching to Python' $ver 38 | $(pyenv global $ver) || exit 1 39 | echo 'Running' $@ 40 | $@ || { 41 | echo 'Run failed! Switching back to the system version of the Python interpreter.'; 42 | pyenv global system; 43 | exit 1; 44 | } 45 | done 46 | 47 | echo 'Switching back to the system version of Python' 48 | # if the global python is not installed the script will log a warning and finish with zero return code 49 | { pyenv global system; } || { echo 'Restoring the system version of the Python interpreter has failed!' ;} 50 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/ci/setup_ci_build_env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -exuo pipefail 4 | 5 | ESP8266_TOOLCHAIN_URL="https://dl.espressif.com/dl/xtensa-lx106-elf-linux64-1.22.0-92-g8facf4c-5.2.0.tar.gz" 6 | ESP32_TOOLCHAIN_URL="https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz" 7 | ESP32S2_TOOLCHAIN_URL="https://dl.espressif.com/dl/xtensa-esp32s2-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz" 8 | ESP32S3_TOOLCHAIN_URL="https://dl.espressif.com/dl/xtensa-esp32s3-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz" 9 | ESP32C3_TOOLCHAIN_URL="https://dl.espressif.com/dl/toolchains/preview/riscv32-esp-elf-gcc8_4_0-crosstool-ng-1.24.0-123-g64eb9ff-linux-amd64.tar.gz" 10 | 11 | # Setup shell script to download & configure ESP8266 & ESP32 toolchains 12 | # for building the flasher stub program 13 | 14 | mkdir -p ${TOOLCHAIN_DIR} 15 | cd ${TOOLCHAIN_DIR} 16 | 17 | if ! [ -d ${ESP8266_BINDIR} ]; then 18 | wget --continue --no-verbose "${ESP8266_TOOLCHAIN_URL}" 19 | tar zxf $(basename ${ESP8266_TOOLCHAIN_URL}) 20 | fi 21 | 22 | if ! [ -d ${ESP32_BINDIR} ]; then 23 | # gitlab CI image may already have this file 24 | wget --continue --no-verbose "${ESP32_TOOLCHAIN_URL}" 25 | tar zxf $(basename ${ESP32_TOOLCHAIN_URL}) 26 | fi 27 | 28 | if ! [ -d ${ESP32S2_BINDIR} ]; then 29 | # gitlab CI image may already have this file 30 | wget --continue --no-verbose "${ESP32S2_TOOLCHAIN_URL}" 31 | tar zxf $(basename ${ESP32S2_TOOLCHAIN_URL}) 32 | fi 33 | 34 | if ! [ -d ${ESP32S3_BINDIR} ]; then 35 | # gitlab CI image may already have this file 36 | wget --continue --no-verbose "${ESP32S3_TOOLCHAIN_URL}" 37 | tar zxf $(basename ${ESP32S3_TOOLCHAIN_URL}) 38 | fi 39 | 40 | if ! [ -d ${ESP32C3_BINDIR} ]; then 41 | # gitlab CI image may already have this file 42 | wget --continue --no-verbose "${ESP32C3_TOOLCHAIN_URL}" 43 | tar zxf $(basename ${ESP32C3_TOOLCHAIN_URL}) 44 | fi 45 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/ecdsa_secure_boot_signing_key2.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN EC PRIVATE KEY----- 2 | MHcCAQEEIINRYjKaXM0dQJn4FLwoHYj3ovmpRee7UWv8ksQ9IS2toAoGCCqGSM49 3 | AwEHoUQDQgAEYWCmqAxxAmbr8cZk4AjTYkQJ0pCZOsESk2bPAe6lrzHrFKKR2t2W 4 | ge+cNvXU2dYswEdgWr/fdnyAbHHEVEBSrA== 5 | -----END EC PRIVATE KEY----- 6 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/elf2image/esp32-app-cust-ver-info.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/elf2image/esp32-app-cust-ver-info.elf -------------------------------------------------------------------------------- /tool_esptoolpy/test/elf2image/esp32-app-template.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/elf2image/esp32-app-template.elf -------------------------------------------------------------------------------- /tool_esptoolpy/test/elf2image/esp32-bootloader.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/elf2image/esp32-bootloader.elf -------------------------------------------------------------------------------- /tool_esptoolpy/test/elf2image/esp32-too-many-sections.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/elf2image/esp32-too-many-sections.elf -------------------------------------------------------------------------------- /tool_esptoolpy/test/elf2image/esp32-too-many-sections/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for generating and compiling an Xtensa-ESP32 ELF file that has a lot 2 | # (too many) sections. 3 | # 4 | # To generate the C file and compile it, simply use the following command: 5 | # make 6 | 7 | # Adjustable parameters 8 | BASH=/bin/bash 9 | SECTIONS_COUNT=350 10 | 11 | # Do not touch the following variables 12 | CC=xtensa-esp32-elf-gcc 13 | CFLAGS=-W -std=c99 14 | LDFLAGS=-nostdlib -ffunction-sections -fdata-sections 15 | OBJ=esp32-too-many-sections.o 16 | BIN=esp32-too-many-sections.elf 17 | SRC=esp32-too-many-sections.c 18 | 19 | # The following command will generate the C file to compile. 20 | # This is the simplest way to have a working and easily maintainable 21 | # C file as it is almost only way out repetitions. 22 | define generate_c_code = 23 | # Generate the constants, one per section. 24 | # Is it necessary to align the sections on an 16-byte bounds in order 25 | # to prevent esptool to merge them while generating the binary. 26 | # Indeed, by aligning them, there will be padding between them. 27 | echo "Generating $(SRC) ..." 28 | echo "// This has file been automatically generated, please check Makefile for\ 29 | more information." > $(SRC); \ 30 | for i in {1..$(SECTIONS_COUNT)}; \ 31 | do \ 32 | echo "const int number$$i __attribute__ ((section (\".NUM$$i\"), aligned((16)))) = $$i;" >> $(SRC) ;\ 33 | done; 34 | echo -e "\n" >> $(SRC) ; \ 35 | echo "int _start(void) {" >> $(SRC) ; \ 36 | echo " volatile long int res =" >> $(SRC) ; \ 37 | for i in {1..$(SECTIONS_COUNT)}; \ 38 | do \ 39 | echo " (unsigned int) number$$i +" >> $(SRC) ;\ 40 | done; 41 | # Adding 0 at the end it simpler than making a special case for the last 42 | # loop iteration 43 | echo " 0;" >> $(SRC) ; 44 | echo " return res;" >> $(SRC) ; 45 | echo "}" >> $(SRC) ; 46 | endef 47 | 48 | .PHONY: all clean generate-src 49 | 50 | all: $(BIN) 51 | 52 | $(BIN): $(OBJ) 53 | $(CC) -o $@ $^ $(LDFLAGS) 54 | 55 | # By default, make uses sh as script langage, use bash to generate the C file 56 | $(SRC): SHELL:=$(BASH) 57 | $(SRC): 58 | @$(generate_c_code) 59 | 60 | %.o: %.c 61 | $(CC) -c -o $@ $^ $(CFLAGS) 62 | 63 | clean: 64 | rm -f $(SRC) $(BIN) $(OBJ) 65 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/elf2image/esp32-zephyr.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/elf2image/esp32-zephyr.elf -------------------------------------------------------------------------------- /tool_esptoolpy/test/elf2image/esp8266-nonossdkv12-example.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/elf2image/esp8266-nonossdkv12-example.elf -------------------------------------------------------------------------------- /tool_esptoolpy/test/elf2image/esp8266-nonossdkv20-at-v2.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/elf2image/esp8266-nonossdkv20-at-v2.elf -------------------------------------------------------------------------------- /tool_esptoolpy/test/elf2image/esp8266-nonosssdk20-iotdemo.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/elf2image/esp8266-nonosssdk20-iotdemo.elf -------------------------------------------------------------------------------- /tool_esptoolpy/test/elf2image/esp8266-openrtos-blink-v2.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/elf2image/esp8266-openrtos-blink-v2.elf -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/aes_key.bin: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/bootloader_esp32.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/bootloader_esp32.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/bootloader_esp32c3.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/bootloader_esp32c3.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/bootloader_esp32s2.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/bootloader_esp32s2.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/bootloader_esp32s3beta2.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/bootloader_esp32s3beta2.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/bootloader_esp32s3beta3.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/bootloader_esp32s3beta3.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/efuse/128bit: -------------------------------------------------------------------------------- 1 |  2 |  -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/efuse/192bit: -------------------------------------------------------------------------------- 1 |   -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/efuse/192bit_1: -------------------------------------------------------------------------------- 1 |  2 | ! -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/efuse/192bit_2: -------------------------------------------------------------------------------- 1 | " 2 | " -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/efuse/224bit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/efuse/224bit -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/efuse/256bit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/efuse/256bit -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/efuse/256bit_1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/efuse/256bit_1 -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/efuse/256bit_2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/efuse/256bit_2 -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/esp8266_deepsleep.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/esp8266_deepsleep.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/esp8266_sdk/4096_user1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/esp8266_sdk/4096_user1.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/esp8266_sdk/blank.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/esp8266_sdk/blank.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/esp8266_sdk/boot_v1.4(b1).bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/esp8266_sdk/boot_v1.4(b1).bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/esp8266_sdk/esp_init_data_default.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/esp8266_sdk/esp_init_data_default.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/fifty_kb.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/fifty_kb.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/helloworld-esp32_edit.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/helloworld-esp32_edit.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/nodemcu-master-7-modules-2017-01-19-11-10-03-integer.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/nodemcu-master-7-modules-2017-01-19-11-10-03-integer.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/one_kb.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/one_kb.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/one_kb_all_ef.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/one_kb_all_ef.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/one_mb.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/one_mb.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/onebyte.bin: -------------------------------------------------------------------------------- 1 | a -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/partitions_singleapp.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/partitions_singleapp.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/ram_helloworld/helloworld-esp32.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/ram_helloworld/helloworld-esp32.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/ram_helloworld/helloworld-esp8266.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/ram_helloworld/helloworld-esp8266.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/ram_helloworld/source/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile to compile the helloworld app for esptool tests 2 | 3 | # Prefix for each cross compiler (can include a directory path) 4 | # These can be overriden via environment variables or on the make command line 5 | CROSS_8266 ?= xtensa-lx106-elf- 6 | CROSS_32 ?= xtensa-esp32-elf- 7 | CROSS_32S2 ?= xtensa-esp32s2-elf- 8 | CROSS_32S3 ?= xtensa-esp32s3-elf- 9 | CROSS_32C3 ?= riscv32-esp-elf- 10 | 11 | # Pass V=1 to see the commands being executed by make 12 | ifneq ("$(V)","1") 13 | Q = @ 14 | endif 15 | 16 | APP = hello_world 17 | SRCS = main.c 18 | 19 | BUILD_DIR = build 20 | 21 | APP_ELF_8266 = $(BUILD_DIR)/$(APP)_8266.elf 22 | APP_ELF_32 = $(BUILD_DIR)/$(APP)_32.elf 23 | APP_ELF_32S2 = $(BUILD_DIR)/$(APP)_32s2.elf 24 | APP_ELF_32S3_BETA_2 = $(BUILD_DIR)/$(APP)_32s3beta2.elf 25 | APP_ELF_32S3_BETA_3 = $(BUILD_DIR)/$(APP)_32s3beta3.elf 26 | APP_ELF_32C3 = $(BUILD_DIR)/$(APP)_32c3.elf 27 | 28 | .PHONY: all clean 29 | 30 | all: $(APP_ELF_8266) $(APP_ELF_32) $(APP_ELF_32S2) 31 | 32 | $(BUILD_DIR): 33 | $(Q) mkdir $@ 34 | 35 | CFLAGS = -std=c99 -Wall -Werror -Os \ 36 | -mtext-section-literals -mlongcalls -nostdlib -fno-builtin -flto \ 37 | -Wl,-static -g -ffunction-sections -Wl,--gc-sections -Iinclude -Lld 38 | CFLAGS_ESP32C3 = -std=c99 -Wall -Werror -Os \ 39 | -march=rv32imc -msmall-data-limit=0 \ 40 | -nostdlib -fno-builtin -flto \ 41 | -Wl,-static -g -ffunction-sections -Wl,--gc-sections -Iinclude -Lld 42 | LDLIBS = -lgcc 43 | 44 | $(APP_ELF_8266): $(SRCS) $(SRCS_8266) $(BUILD_DIR) ld/app_8266.ld | Makefile 45 | @echo " CC(8266) $^ -> $@" 46 | $(Q) $(CROSS_8266)gcc $(CFLAGS) -DESP8266=1 -Tapp_8266.ld -Wl,-Map=$(@:.elf=.map) -o $@ $(filter %.c, $^) $(LDLIBS) 47 | 48 | $(APP_ELF_32): $(SRCS) $(BUILD_DIR) ld/app_32.ld | Makefile 49 | @echo " CC(32) $^ -> $@" 50 | $(Q) $(CROSS_32)gcc $(CFLAGS) -DESP32=1 -Tapp_32.ld -Wl,-Map=$(@:.elf=.map) -o $@ $(filter %.c, $^) $(LDLIBS) 51 | 52 | $(APP_ELF_32S2): $(SRCS) $(BUILD_DIR) ld/app_32s2.ld 53 | @echo " CC(32S2) $^ -> $@" 54 | $(Q) $(CROSS_32S2)gcc $(CFLAGS) -DESP32S2=1 -Tapp_32s2.ld -Wl,-Map=$(@:.elf=.map) -o $@ $(filter %.c, $^) $(LDLIBS) 55 | 56 | $(APP_ELF_32S3_BETA_2): $(SRCS) $(BUILD_DIR) ld/app_32s3_beta_2.ld 57 | @echo " CC(32S3) $^ -> $@" 58 | $(Q) $(CROSS_32S3)gcc $(CFLAGS) -DESP32S3=1 -Tapp_32s3.ld -Wl,-Map=$(@:.elf=.map) -o $@ $(filter %.c, $^) $(LDLIBS) 59 | 60 | $(APP_ELF_32S3_BETA_3): $(SRCS) $(BUILD_DIR) ld/app_32s3_beta_3.ld 61 | @echo " CC(32S3) $^ -> $@" 62 | $(Q) $(CROSS_32S3)gcc $(CFLAGS) -DESP32S3=1 -Tapp_32s3.ld -Wl,-Map=$(@:.elf=.map) -o $@ $(filter %.c, $^) $(LDLIBS) 63 | 64 | $(APP_ELF_32C3): $(SRCS) $(BUILD_DIR) ld/app_32c3.ld 65 | @echo " CC(32C3) $^ -> $@" 66 | $(Q) $(CROSS_32C3)gcc $(CFLAGS_ESP32C3) -DESP32C3=1 -Tapp_32c3.ld -Wl,-Map=$(@:.elf=.map) -o $@ $(filter %.c, $^) $(LDLIBS) 67 | 68 | clean: 69 | $(Q) rm -rf $(BUILD_DIR) 70 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/ram_helloworld/source/ld/app_32.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Cesanta Software Limited 3 | * All rights reserved 4 | * 5 | * This program is free software; you can redistribute it and/or modify it under 6 | * the terms of the GNU General Public License as published by the Free Software 7 | * Foundation; either version 2 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 15 | * Street, Fifth Floor, Boston, MA 02110-1301 USA. 16 | */ 17 | 18 | MEMORY { 19 | iram : org = 0x4008c000, len = 0x1000 20 | dram : org = 0x3ffc0000, len = 0xc000 21 | } 22 | 23 | ENTRY(ram_main) 24 | 25 | SECTIONS { 26 | .text : ALIGN(4) { 27 | *(.literal) 28 | *(.text .text.*) 29 | } > iram 30 | 31 | .bss : ALIGN(4) { 32 | _bss_start = ABSOLUTE(.); 33 | *(.bss) 34 | _bss_end = ABSOLUTE(.); 35 | } > dram 36 | 37 | .data : ALIGN(4) { 38 | *(.data) 39 | *(.rodata .rodata.*) 40 | } > dram 41 | } 42 | 43 | INCLUDE "../../../../flasher_stub/ld/rom_32.ld" 44 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/ram_helloworld/source/ld/app_32c3.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Espressif Systems (Shanghai) PTE LTD 3 | * All rights reserved 4 | * 5 | * This program is free software; you can redistribute it and/or modify it under 6 | * the terms of the GNU General Public License as published by the Free Software 7 | * Foundation; either version 2 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 15 | * Street, Fifth Floor, Boston, MA 02110-1301 USA. 16 | */ 17 | 18 | MEMORY { 19 | iram : org = 0x4037C000, len = 0x4000 20 | dram : org = 0x3FC80000, len = 0x4000 21 | } 22 | 23 | ENTRY(ram_main) 24 | 25 | SECTIONS { 26 | .text : ALIGN(4) { 27 | *(.literal) 28 | *(.text .text.*) 29 | } > iram 30 | 31 | .bss : ALIGN(4) { 32 | _bss_start = ABSOLUTE(.); 33 | *(.bss) 34 | _bss_end = ABSOLUTE(.); 35 | } > dram 36 | 37 | .data : ALIGN(4) { 38 | *(.data) 39 | *(.rodata .rodata.*) 40 | } > dram 41 | } 42 | 43 | INCLUDE "../../../../flasher_stub/ld/rom_32c3.ld" 44 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/ram_helloworld/source/ld/app_32s2.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Espressif Systems (Shanghai) PTE LTD 3 | * All rights reserved 4 | * 5 | * This program is free software; you can redistribute it and/or modify it under 6 | * the terms of the GNU General Public License as published by the Free Software 7 | * Foundation; either version 2 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 15 | * Street, Fifth Floor, Boston, MA 02110-1301 USA. 16 | */ 17 | 18 | MEMORY { 19 | iram : org = 0x40020000, len = 0x8000 20 | dram : org = 0x3FFC8000, len = 0x8000 21 | } 22 | 23 | ENTRY(ram_main) 24 | 25 | SECTIONS { 26 | .text : ALIGN(4) { 27 | *(.literal) 28 | *(.text .text.*) 29 | } > iram 30 | 31 | .bss : ALIGN(4) { 32 | _bss_start = ABSOLUTE(.); 33 | *(.bss) 34 | _bss_end = ABSOLUTE(.); 35 | } > dram 36 | 37 | .data : ALIGN(4) { 38 | *(.data) 39 | *(.rodata .rodata.*) 40 | } > dram 41 | } 42 | 43 | INCLUDE "../../../../flasher_stub/ld/rom_32s2.ld" 44 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/ram_helloworld/source/ld/app_32s3.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Espressif Systems (Shanghai) PTE LTD 3 | * All rights reserved 4 | * 5 | * This program is free software; you can redistribute it and/or modify it under 6 | * the terms of the GNU General Public License as published by the Free Software 7 | * Foundation; either version 2 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 15 | * Street, Fifth Floor, Boston, MA 02110-1301 USA. 16 | */ 17 | 18 | MEMORY { 19 | iram : org = 0x40378000, len = 0x18000 20 | dram : org = 0x3FCA0000, len = 0x28000 21 | } 22 | 23 | ENTRY(ram_main) 24 | 25 | SECTIONS { 26 | .text : ALIGN(4) { 27 | *(.literal) 28 | *(.text .text.*) 29 | } > iram 30 | 31 | .bss : ALIGN(4) { 32 | _bss_start = ABSOLUTE(.); 33 | *(.bss) 34 | _bss_end = ABSOLUTE(.); 35 | } > dram 36 | 37 | .data : ALIGN(4) { 38 | *(.data) 39 | *(.rodata .rodata.*) 40 | } > dram 41 | } 42 | 43 | INCLUDE "../../../../flasher_stub/ld/rom_32s3.ld" 44 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/ram_helloworld/source/ld/app_8266.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Cesanta Software Limited 3 | * All rights reserved 4 | * 5 | * This program is free software; you can redistribute it and/or modify it under 6 | * the terms of the GNU General Public License as published by the Free Software 7 | * Foundation; either version 2 of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 15 | * Street, Fifth Floor, Boston, MA 02110-1301 USA. 16 | */ 17 | 18 | MEMORY { 19 | iram : org = 0x40108000, len = 0x2000 20 | dram : org = 0x3FFE8000, len = 0x100 21 | } 22 | 23 | ENTRY(ram_main) 24 | 25 | SECTIONS { 26 | .text : ALIGN(4) { 27 | *(.literal) 28 | *(.text .text.*) 29 | } > iram 30 | 31 | .bss : ALIGN(4) { 32 | _bss_start = ABSOLUTE(.); 33 | *(.bss) 34 | _bss_end = ABSOLUTE(.); 35 | } > dram 36 | 37 | .data : ALIGN(4) { 38 | *(.data) 39 | *(.rodata .rodata.*) 40 | } > dram 41 | } 42 | 43 | INCLUDE "../../../../flasher_stub/ld/rom_8266.ld" 44 | 45 | PROVIDE(SPIFlashModeConfig = 0x40004568); 46 | PROVIDE(SPIParamCfg = 0x40004c2c); 47 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/ram_helloworld/source/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void ets_printf(const char *s); // not the correct prototype, but should be enough! 4 | 5 | void __attribute__((noreturn)) ram_main() 6 | { 7 | while (1) { 8 | ets_printf("Hello world!\n"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/sector.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/sector.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/unaligned.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/unaligned.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/images/zerolength.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/images/zerolength.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/256bit_iv.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/secure_images/256bit_iv.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/256bit_key.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/secure_images/256bit_key.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/bootloader-encrypted-aes-xts.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/secure_images/bootloader-encrypted-aes-xts.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/bootloader-encrypted-conf0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/secure_images/bootloader-encrypted-conf0.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/bootloader-encrypted-conf3.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/secure_images/bootloader-encrypted-conf3.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/bootloader-encrypted-conf9.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/secure_images/bootloader-encrypted-conf9.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/bootloader-encrypted-confc.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/secure_images/bootloader-encrypted-confc.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/bootloader-encrypted.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/secure_images/bootloader-encrypted.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/bootloader.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/secure_images/bootloader.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/bootloader_digested.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/secure_images/bootloader_digested.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/bootloader_multi_signed_v2.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/secure_images/bootloader_multi_signed_v2.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/bootloader_signed.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/secure_images/bootloader_signed.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/bootloader_signed_v2.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/secure_images/bootloader_signed_v2.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/bootloader_unsigned_v2.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/secure_images/bootloader_unsigned_v2.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/digest_iv.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/secure_images/digest_iv.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/ecdsa_secure_boot_signing_key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN EC PRIVATE KEY----- 2 | MHcCAQEEIOI40eSC7ch6PxDSIclIGFCjfhCoXfHVqbbDn8XdY0GVoAoGCCqGSM49 3 | AwEHoUQDQgAENM762z/ushk+c0XOIYpi8wLSWuF5COnU0VAQnt3spTSX6l3bpwfu 4 | ppsemDdwy+aKbdgeyMYDxFbROLOPTRbYJw== 5 | -----END EC PRIVATE KEY----- 6 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/ecdsa_secure_boot_signing_key2.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN EC PRIVATE KEY----- 2 | MHcCAQEEIP9iY7XY8g3qSaUkKwTbq6HEq/AwenIxrssLqXGTS0z3oAoGCCqGSM49 3 | AwEHoUQDQgAEG+Ah4OAejTBYKQNvJkEOP9AifgulBMr4E9f+OqRU1Uno9Efi1kMc 4 | fzwZyx0A4mib0HfLUg9JNh8dNrUxLeVb4Q== 5 | -----END EC PRIVATE KEY----- 6 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/ecdsa_secure_boot_signing_key_pkcs8.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg4jjR5ILtyHo/ENIh 3 | yUgYUKN+EKhd8dWptsOfxd1jQZWhRANCAAQ0zvrbP+6yGT5zRc4himLzAtJa4XkI 4 | 6dTRUBCe3eylNJfqXdunB+6mmx6YN3DL5opt2B7IxgPEVtE4s49NFtgn 5 | -----END PRIVATE KEY----- 6 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/ecdsa_secure_boot_signing_pubkey.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAENM762z/ushk+c0XOIYpi8wLSWuF5 3 | COnU0VAQnt3spTSX6l3bpwfuppsemDdwy+aKbdgeyMYDxFbROLOPTRbYJw== 4 | -----END PUBLIC KEY----- 5 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/ecdsa_secure_boot_signing_pubkey2.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEG+Ah4OAejTBYKQNvJkEOP9Aifgul 3 | BMr4E9f+OqRU1Uno9Efi1kMcfzwZyx0A4mib0HfLUg9JNh8dNrUxLeVb4Q== 4 | -----END PUBLIC KEY----- 5 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/ef-flashencryption-key.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/secure_images/ef-flashencryption-key.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/hello-world-signed-encrypted-aes-xts.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/secure_images/hello-world-signed-encrypted-aes-xts.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/hello-world-signed-encrypted.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/secure_images/hello-world-signed-encrypted.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/hello-world-signed.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/secure_images/hello-world-signed.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/rsa_public_key_digest.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/tool_esptoolpy/test/secure_images/rsa_public_key_digest.bin -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/rsa_secure_boot_signing_key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | 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 39 | -----END RSA PRIVATE KEY----- 40 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/rsa_secure_boot_signing_key2.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | 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 39 | -----END RSA PRIVATE KEY----- 40 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/rsa_secure_boot_signing_key3.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | 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 39 | -----END RSA PRIVATE KEY----- 40 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/rsa_secure_boot_signing_key4.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | 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 39 | -----END RSA PRIVATE KEY----- 40 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/rsa_secure_boot_signing_pubkey.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAtvnS7JPl5hGfA0Iks2lQ 3 | m/L+eiw7pcAArH2IKGqryKdGCtiwuOLjZkUpNR/dZhSr/7JGvjUw+2elLY7D1XXX 4 | w3pufjVH7AePmo4EXUS4U1g6xDuctj3hj3cOarpKo2+dEYrAwY13Bx28tOW0z2uK 5 | xQhNX3zHP9ssiTsLQ+6E+MjEvKjYcvAFtadXYtYTUZWhxuh8W2vnhOiR3zyJQL98 6 | 4iAl08G/T+HI/3JX3vGSFEnOP/ypqz7wQEMJwOEjVpsgaStf5N1JbSOSKp7r/aOM 7 | LQHnYHkfjWSNkX1v0QJfXl7iwtB8XVxRPftY4fdANrGTpQnUOogVo4q6mI80qJ5O 8 | uWfI+gdkxvMVnbmnNp1HtTslPGfBbF+XfQG23xEFvnYTUVvmmNX5QuHY2Vy6KpSS 9 | tQmf4FGZXjQdGzxavFfQjdiBOhxi5DEixcFpwlS1VcHRWb1G2yp15q3ukWrEkh9X 10 | 4vV6h05fmdvxOk9QhHTr0XCIzC4GmaUBM/UYvzGjlfwrAgMBAAE= 11 | -----END PUBLIC KEY----- 12 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/rsa_secure_boot_signing_pubkey2.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAsM8ZHltWA8BfpCH1+xrm 3 | unmRCnzxZMjYsl069V7zkZlzKNHm7n76Q0+Jqb4g0uDzY3YD3hQAZTyCYxYjcgVm 4 | 4PQDSedkpWjkovKDJrvUIb3YzCGfoOOdj1vaJhGAH9COpJJJgvJG5fgvor7ERxFt 5 | q6/kTR2Dmipkc0CwrZi1CsBomcHKfUAEfuWY2hd2F4tmyN3Q/jObRUpk3XjPzFJP 6 | QDgnjgkxYHtUq9psalCqR8hjAx+pQHyGOMLNYSK0RwqslbvXy0dheLjlUPg84Z/g 7 | a4eYqboRy8wsiG+vRRgl4oYxIxg36WqurwaRu+8nUCO3zqQDff3yaN/lGlYfJojQ 8 | ihNto8opB5rTdRW/Obs0qE6nSf1WQMfG6ercRoMHx2alRgr1GRFe8QCm+nQsWnY7 9 | DOIy5U3usmQH9kjOBSYvHHvDbXvgyYRA3EHicWjh4akhtlbFosZeBZbK6NrsuKC8 10 | gc0UIpd8OcXmEudUEg34ezoLOs0gd4LI7hMt1c9UKofpAgMBAAE= 11 | -----END PUBLIC KEY----- 12 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/secure_images/rsa_secure_boot_signing_pubkey4.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEApY+yGcE5s0hecfgMuIiv 3 | 5s4wr4Xkx+DPWs3r2fdZeUulpKtoh5QZ5QG2OFivx1ASBA4bN4NjuCzO+M83OLrC 4 | U8nCr4J1WLejOgJHabrvlAqYrRt6WF9ZQaw0feVasC13b96PgC80GgU6KhiLhJla 5 | hQLFC7F/Cyh14j5P31SCb3isSlIP6VN/PK73RETWwV+Ie3zxIrMeF2mpumLrW4U5 6 | YBt8PNQ1eAWmlUYD1iMGXZeZ9u/DRuhHGxTR4KCSov5/F14+Rb3L0eajYAQcyypU 7 | tDHLc7m62EAICqK2uHl3QX9+xnXnj2cfYUhDiQ1S6WJyVo9RTCx8qCYMVPt4c1DU 8 | rG+1dWKXFS5rQuQ9FaDNlE7sH1+QoBmyWRO9esIVOPFVXHa0E7VCVQQFpH833yCV 9 | JrqCiCCtlVaUDpvXbZWftJHgAXPWE9uecAMUjB+7qW5SXYfbiQsZPi9cnEZTyRs8 10 | jcQwA+1DDhY8SpzRe3+36ooJQ5WJDeCps/3y4STSgs1dAgMBAAE= 11 | -----END PUBLIC KEY----- 12 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/sitecustomize.py: -------------------------------------------------------------------------------- 1 | import coverage 2 | coverage.process_startup() 3 | 4 | # This file exists to perform arbitrary site-specific customizations. 5 | # This script is executed before every Python process to start coverage measurement. 6 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/test_merge_bin.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from __future__ import division, print_function 3 | 4 | import itertools 5 | import os 6 | import os.path 7 | import subprocess 8 | import sys 9 | import tempfile 10 | import unittest 11 | 12 | IMAGES_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "images") 13 | try: 14 | ESPTOOL_PY = os.environ["ESPTOOL_PY"] 15 | except KeyError: 16 | ESPTOOL_PY = os.path.join(IMAGES_DIR, "../..", "esptool.py") 17 | 18 | # import the version of esptool we are testing with 19 | sys.path.append(os.path.dirname(ESPTOOL_PY)) 20 | 21 | 22 | from esptool import byte 23 | 24 | 25 | def read_image(filename): 26 | with open(os.path.join(IMAGES_DIR, filename), "rb") as f: 27 | return f.read() 28 | 29 | 30 | class MergeBinTests(unittest.TestCase): 31 | 32 | def run_merge_bin(self, chip, offsets_names, options=[]): 33 | """ Run merge_bin on a list of (offset, filename) tuples 34 | with output to a named temporary file. 35 | 36 | Filenames are relative to the 'test/images' directory. 37 | 38 | Returns the contents of the merged file if successful. 39 | """ 40 | output_file = tempfile.NamedTemporaryFile(delete=False) 41 | try: 42 | output_file.close() 43 | 44 | cmd = [sys.executable, ESPTOOL_PY, "--chip", chip, "merge_bin", "-o", output_file.name] + options 45 | for (offset, name) in offsets_names: 46 | cmd += [hex(offset), name] 47 | print("Executing %s" % (" ".join(cmd))) 48 | 49 | output = str(subprocess.check_output(cmd, cwd=IMAGES_DIR, stderr=subprocess.STDOUT)) 50 | print(output) 51 | self.assertFalse("warning" in output.lower(), "merge_bin should not output warnings") 52 | 53 | with open(output_file.name, "rb") as f: 54 | return f.read() 55 | except subprocess.CalledProcessError as e: 56 | print(e.output) 57 | raise 58 | finally: 59 | os.unlink(output_file.name) 60 | 61 | def assertAllFF(self, some_bytes): 62 | # this may need some improving as the failed assert messages may be very long and/or useless! 63 | self.assertEqual(b'\xFF' * len(some_bytes), some_bytes) 64 | 65 | def test_simple_merge(self): 66 | merged = self.run_merge_bin("esp8266", [(0x0, "one_kb.bin"), 67 | (0x1000, "one_kb.bin"), 68 | (0x10000, "one_kb.bin")]) 69 | one_kb = read_image("one_kb.bin") 70 | 71 | self.assertEqual(0x400, len(one_kb)) 72 | 73 | self.assertEqual(0x10400, len(merged)) 74 | self.assertEqual(one_kb, merged[:0x400]) 75 | self.assertEqual(one_kb, merged[0x1000:0x1400]) 76 | self.assertEqual(one_kb, merged[0x10000:]) 77 | 78 | self.assertAllFF(merged[0x400:0x1000]) 79 | self.assertAllFF(merged[0x1400:0x10000]) 80 | 81 | def test_args_out_of_order(self): 82 | # no matter which order we supply arguments, the output should be the same 83 | args = [(0x0, "one_kb.bin"), 84 | (0x1000, "one_kb.bin"), 85 | (0x10000, "one_kb.bin")] 86 | merged_orders = [self.run_merge_bin("esp8266", perm_args) for perm_args in itertools.permutations(args)] 87 | for m in merged_orders: 88 | self.assertEqual(merged_orders[0], m) 89 | 90 | def test_error_overlap(self): 91 | args = [(0x1000, "one_mb.bin"), 92 | (0x20000, "one_kb.bin")] 93 | for perm_args in itertools.permutations(args): 94 | with self.assertRaises(subprocess.CalledProcessError) as fail: 95 | self.run_merge_bin("esp32", perm_args) 96 | self.assertIn(b"overlap", fail.exception.output) 97 | 98 | def test_leading_padding(self): 99 | merged = self.run_merge_bin("esp32c3", [(0x100000, "one_mb.bin")]) 100 | self.assertAllFF(merged[:0x100000]) 101 | self.assertEqual(read_image("one_mb.bin"), merged[0x100000:]) 102 | 103 | def test_update_bootloader_params(self): 104 | merged = self.run_merge_bin("esp32", [(0x1000, "bootloader_esp32.bin"), (0x10000, "ram_helloworld/helloworld-esp32.bin")], 105 | ["--flash_size", "2MB", "--flash_mode", "dout"]) 106 | self.assertAllFF(merged[:0x1000]) 107 | 108 | bootloader = read_image("bootloader_esp32.bin") 109 | helloworld = read_image("ram_helloworld/helloworld-esp32.bin") 110 | 111 | # test the bootloader is unchanged apart from the header (updating the header doesn't change CRC, 112 | # and doesn't update the SHA although it will invalidate it!) 113 | self.assertEqual(merged[0x1010:0x1000 + len(bootloader)], bootloader[0x10:]) 114 | 115 | # check the individual bytes in the header are as expected 116 | merged_hdr = merged[0x1000:0x1010] 117 | bootloader_hdr = bootloader[:0x10] 118 | self.assertEqual(bootloader_hdr[:2], merged_hdr[:2]) 119 | self.assertEqual(3, byte(merged_hdr, 2)) # flash mode dout 120 | self.assertEqual(0x10, byte(merged_hdr, 3) & 0xF0) # flash size 2MB (ESP32) 121 | self.assertEqual(byte(bootloader_hdr, 3) & 0x0F, byte(merged_hdr, 3) & 0x0F) # flash speed is unchanged 122 | self.assertEqual(bootloader_hdr[4:], merged_hdr[4:]) # remaining field are unchanged 123 | 124 | # check all the padding is as expected 125 | self.assertAllFF(merged[0x1000 + len(bootloader):0x10000]) 126 | self.assertEqual(merged[0x10000:0x10000 + len(helloworld)], helloworld) 127 | 128 | def test_target_offset(self): 129 | merged = self.run_merge_bin("esp32", [(0x1000, "bootloader_esp32.bin"), (0x10000, "ram_helloworld/helloworld-esp32.bin")], 130 | ["--target-offset", "0x1000"]) 131 | 132 | bootloader = read_image("bootloader_esp32.bin") 133 | helloworld = read_image("ram_helloworld/helloworld-esp32.bin") 134 | self.assertEqual(bootloader, merged[:len(bootloader)]) 135 | self.assertEqual(helloworld, merged[0xF000:0xF000 + len(helloworld)]) 136 | self.assertAllFF(merged[0x1000 + len(bootloader):0xF000]) 137 | 138 | def test_fill_flash_size(self): 139 | merged = self.run_merge_bin("esp32c3", [(0x0, "bootloader_esp32c3.bin")], 140 | ["--fill-flash-size", "4MB"]) 141 | bootloader = read_image("bootloader_esp32c3.bin") 142 | 143 | self.assertEqual(0x400000, len(merged)) 144 | self.assertEqual(bootloader, merged[:len(bootloader)]) 145 | self.assertAllFF(merged[len(bootloader):]) 146 | 147 | def test_fill_flash_size_w_target_offset(self): 148 | merged = self.run_merge_bin("esp32", [(0x1000, "bootloader_esp32.bin"), (0x10000, "ram_helloworld/helloworld-esp32.bin")], 149 | ["--target-offset", "0x1000", "--fill-flash-size", "2MB"]) 150 | 151 | self.assertEqual(0x200000 - 0x1000, len(merged)) # full length is without target-offset arg 152 | 153 | bootloader = read_image("bootloader_esp32.bin") 154 | helloworld = read_image("ram_helloworld/helloworld-esp32.bin") 155 | self.assertEqual(bootloader, merged[:len(bootloader)]) 156 | self.assertEqual(helloworld, merged[0xF000:0xF000 + len(helloworld)]) 157 | self.assertAllFF(merged[0xF000 + len(helloworld):]) 158 | 159 | 160 | if __name__ == '__main__': 161 | unittest.main(buffer=True) 162 | -------------------------------------------------------------------------------- /tool_esptoolpy/test/test_modules.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Tests for regressions in python modules used by esptool.py, espefuse.py, and espsecure.py 4 | from __future__ import division, print_function 5 | 6 | import unittest 7 | 8 | import reedsolo 9 | 10 | 11 | class ReedSoloTests(unittest.TestCase): 12 | def test_reed_solomon_encoding(self): 13 | pairs = [("a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebf", "0404992ae0b12cb0ef0d4fd3"), 14 | ("11a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbd11bf", "e001803c2130884c190d57d5"), 15 | ("22a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbd22bf", "6c32056dd3fcc33fa6193773"), 16 | ("0a1a2a3a4a5a6a7a8a9aaabacadaeafa0b1b2b3b4b5b6b7b8b9babbbcbdbebfb", "08149eef461af628943c2661"), 17 | ("b3f455fb0b275123dec0e73c4becca19246bf2b103df401844a3bdcd3fd01a95", "500409183fa1b8e680568da7"), 18 | ("435777773fb1e36f7d6b5f1e99afaa7a57f16be0ed36bc057c7dae6a266d1504", "815d3007153d797bd6630d0e"), 19 | ("20a126c10f50ee871f43cfcfe4e62a492e3f729a6c48348a58863f3a482a69fe", "36150928f41dcacf396c0893"), 20 | ("a8d5fbda18d75605c422d2b10ac7f73283a5c9609d6b8c90ffaa96b84f133582", "a4f21330282242c9e20b6acf"), 21 | ("4296abb9a44432c8656d5605feffc25d71941fd0abf0ff0d61a01a19315a264c", "1bb4c3afd14b9023b33a2f15"), 22 | ("206e4f83f8173635d7d554d96b84586fbc3a4280b4403cba5834d3dc8e99a682", "1b7edac989c569cb08f9efd9"), 23 | ("57e8dc1b37c6b53a428fc6d7242114eaf3d80b0447bb642703120a257cf7ec52", "5ee82f785f3d5e19df92635b"), 24 | ("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", "13a36292597404257375e0aa"), 25 | ("f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0", "f66cb1ba3ee5d164a19668a0"), 26 | ("abad1deaabad1deaabad1deaabad1deaabad1deaabad1deaabad1deaabad1dea", "1171924a9b34c16878e182a5"), 27 | ("abad1deadeadbeefabadbabecafebabe11223344556677889900aabbccddeeff", "7601266085196663727c6522"), 28 | ("0000000000000000000000000000000000000000000000000000000000000000", "000000000000000000000000"), 29 | ("1000000000000000000000000000000000000000000000000000000000000000", "b6f06eae2266cc0bfca685ca"), 30 | ("0001000100010001000a000b000c000d000e000f000100010001000100010001", "6dc2afb4820bb002d9263544"), 31 | ("0000000000000000000000000000000000000000000000000000000000000001", "44774376dc1f07545c7fd561"), 32 | ] # Pregenerated pairs consisting of 32 bytes of data + 12 bytes of RS ECC (FPGA verified) 33 | 34 | rs = reedsolo.RSCodec(12) # 12 ECC symbols 35 | 36 | for pair in pairs: 37 | bin_base = bytearray.fromhex(pair[0]) 38 | encoded_data = rs.encode([x for x in bin_base]) # Encode the original 32 bytes of data 39 | self.assertEqual(encoded_data, bytearray.fromhex(pair[0] + pair[1])) 40 | 41 | 42 | if __name__ == '__main__': 43 | print("Running python modules tests...") 44 | unittest.main(buffer=True) 45 | -------------------------------------------------------------------------------- /util/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ClimbSnail/HoloCubic_AIO_Tool/31ce4bb175d27ca8e2af6562a3b0331d78ce6295/util/__init__.py -------------------------------------------------------------------------------- /util/common.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | ################################################################################ 3 | # 4 | # Author: ClimbSnail(HQ) 5 | # original source is here. 6 | # https://github.com/ClimbSnail/HoloCubic_AIO_Tool 7 | # 8 | # 9 | ################################################################################ 10 | 11 | from util.massagehead import * 12 | import binascii 13 | import ctypes 14 | import inspect 15 | import traceback 16 | import re 17 | 18 | VERSION = "Ver1.4.6" 19 | ROOT_PATH = "OutFile" 20 | CACHE_PATH = "Cache" 21 | 22 | # 字节序定义 23 | byteOrders = {'Native order': '@', # 本机(默认) 24 | 'Native standard': '=', # 本机 25 | 'Little-endian': '<', # 小端 26 | 'Big-endian': '>', # 大端 27 | 'Network order': '!'} # network(大端) 28 | 29 | 30 | # 关于struct格式串字节大小 https://blog.csdn.net/qq_30638831/article/details/80421019 31 | 32 | def getSendInfo(info): 33 | """ 34 | 打印网络数据流, 35 | :param info: ctypes.create_string_buffer() 36 | :return : str 37 | """ 38 | info = binascii.hexlify(info) 39 | print(info) 40 | re_obj = re.compile('.{1,2}') # 匹配任意字符1-2次 41 | t = ' '.join(re_obj.findall(str(info).upper())) 42 | return t 43 | 44 | 45 | def _async_raise(thread_obj): 46 | """ 47 | 释放进程 48 | :param thread: 进程对象 49 | :param exctype: 50 | :return: 51 | """ 52 | try: 53 | tid = thread_obj.ident 54 | tid = ctypes.c_long(tid) 55 | exctype = SystemExit 56 | """raises the exception, performs cleanup if needed""" 57 | if not inspect.isclass(exctype): 58 | exctype = type(exctype) 59 | res = ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, ctypes.py_object(exctype)) 60 | if res == 0: 61 | raise ValueError("invalid thread id") 62 | elif res != 1: 63 | # """if it returns a number greater than one, you're in trouble, 64 | # and you should call it again with exc=NULL to revert the effect""" 65 | ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, None) 66 | raise SystemError("PyThreadState_SetAsyncExc failed") 67 | except Exception as err: 68 | print(err) 69 | -------------------------------------------------------------------------------- /util/massagehead.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | ################################################################################ 3 | # 4 | # Author: ClimbSnail(HQ) 5 | # original source is here. 6 | # https://github.com/ClimbSnail/HoloCubic_AIO_Tool 7 | # 8 | # 9 | ################################################################################ 10 | 11 | from ctypes import * 12 | from util.common import * 13 | import struct 14 | 15 | # 模块名 M_ 16 | M_ALL = "M_ALL" 17 | M_ENGINE = "M_ENGINE" 18 | M_DOWNLOAD_DEBUG = "M_DOWNLOAD_DEBUG" 19 | M_SETTING = "M_SETTING" 20 | M_FILE_MANAGER = "M_FILE_MANAGER" 21 | M_PICTURE = "M_PICTURE" 22 | M_VIDEO_TOOL = "M_VIDEO_TOOL" 23 | M_SRCEEN_SHARE = "M_SRCEEN_SHARE" 24 | M_HELP = "M_HELP" 25 | 26 | # 动作类型 A_ 27 | A_CLOSE_UART = "A_CLOSE_UART" 28 | A_OPEN_UART = "A_OPEN_UART" 29 | 30 | 31 | class ModuleType: 32 | class ConstError(TypeError): pass 33 | 34 | # 模块名 未知 35 | MODULE_TYPE_UNKNOW = 0 36 | 37 | # 模块名 Holocubic 38 | MODULE_TYPE_CUBIC_FILE_MANAGER = 1 39 | 40 | # 上位机控制器 41 | MODULE_TYPE_C_FILE_MANAGER = 2 42 | 43 | # Holocubic的settings模块 44 | MODULE_TYPE_CUBIC_SETTINGS = 3 45 | 46 | # 上位机控制器的settings模块 47 | MODULE_TYPE_TOOL_SETTINGS = 4 48 | 49 | def __setattr__(self, name, value): 50 | raise self.ConstError(f"Can't rebind const {name}") 51 | 52 | 53 | MT = ModuleType() # 模块类型 54 | 55 | 56 | class ActionType: 57 | class ConstError(TypeError): pass 58 | 59 | # 未知类型 60 | AT_UNKNOWN = 0 61 | AT_FREE_STATUS = 1 62 | 63 | # 目录操作 64 | AT_DIR_CREATE = 2 # 创建 65 | AT_DIR_REMOVE = 3 # 删除 66 | AT_DIR_RENAME = 4 # 重命名 67 | AT_DIR_LIST = 5 # 列举目录文件 68 | 69 | # 文件操作 70 | AT_FILE_CREATE = 6 # 创建 71 | AT_FILE_WRITE = 7 # 文件信息流写 72 | AT_FILE_READ = 8 # 文件信息读 73 | AT_FILE_REMOVE = 9 # 删除 74 | AT_FILE_RENAME = 10 # 重命名 75 | AT_FILE_GET_INFO = 11 # 查询文件大小 76 | 77 | AT_SETTING_SET = 12 # 设置属性 78 | AT_SETTING_GET = 13 # 获取属性 79 | 80 | def __setattr__(self, name, value): 81 | raise self.ConstError(f"Can't rebind const {name}") 82 | 83 | 84 | AT = ActionType() 85 | 86 | class ValueType: 87 | class ConstError(TypeError): pass 88 | 89 | # 值类型 未知 90 | VALUE_TYPE_UNKNOWN = 0 91 | 92 | # int 93 | VALUE_TYPE_INT = 1 94 | 95 | # uchar 96 | VALUE_TYPE_UCHAR = 2 97 | 98 | # String 99 | VALUE_TYPE_STRING = 3 100 | 101 | def __setattr__(self, name, value): 102 | raise self.ConstError(f"Can't rebind const {name}") 103 | 104 | 105 | VT = ValueType() # Setting中值的类型 106 | 107 | 108 | class MsgHead_TT(Structure): 109 | _fields_ = [ 110 | ("header_mark", c_byte * 2), 111 | ("from_who", c_byte), 112 | ("to_who", c_byte), 113 | ("msg_len", c_uint), 114 | ] 115 | 116 | 117 | class MsgHead(): 118 | """ 119 | 网络通信的消息头 120 | """ 121 | 122 | def __init__(self, from_who=0, to_who=0, action_type=AT.AT_UNKNOWN): 123 | # self.header_mark = b'\x23\x23' # 两个#号 124 | self.header_mark = 8995 # 两个#号 125 | self.msg_len = 0 126 | self.from_who = from_who 127 | self.to_who = to_who 128 | self.action_type = action_type 129 | # fmt 以为 format 规定以上四个参数的所占字节数 130 | self.fmt = "1H1H1B1B1B" 131 | 132 | def __dir__(self): 133 | # 定义类中哪些是需要发送的数据 134 | return ["header_mark", "msg_len", "from_who", "to_who", "action_type"] 135 | 136 | def decode(self, network_data, byteOrder='!'): 137 | """ 138 | 消息的解码,子类可以继承无需重写 139 | """ 140 | members = [attr for attr in self.__dir__() 141 | if not callable(getattr(self, attr)) 142 | and not attr.startswith("__") 143 | and not attr.startswith("fmt")] 144 | # 获取当前实例化的对象大小(可能是当前类,也可能是它的子类) 145 | size = struct.Struct(self.fmt).size 146 | # 以下的 self.fmt 可能包含了子类的一部分,并非一定等于 __init__ 中的 self.fmt 147 | get_data = struct.unpack(byteOrder + self.fmt, network_data[: size]) 148 | 149 | # 解析解码后的参数 150 | for (attr, value) in zip(members, get_data): 151 | setattr(self, attr, value) 152 | return size # 返回解码完成的数据大小 153 | 154 | def encode(self, byteOrder='='): 155 | """ 156 | 消息的编码,子类可以继承可以不重写 157 | """ 158 | # self.msg_len = struct.Struct(self.fmt).size - 7 159 | # 获取当前实例化的参数 160 | members = [attr for attr in self.__dir__() if not callable(getattr(self, attr))] 161 | # 解析得到所有的参数 一定要在self.msg_len赋值后操作 162 | params = [getattr(self, param) for param in members] 163 | return struct.pack(byteOrder + self.fmt, *params) 164 | 165 | 166 | class SettingMsg(MsgHead): 167 | 168 | def __init__(self, action_type=AT.AT_SETTING_GET): 169 | MsgHead.__init__(self, MT.MODULE_TYPE_TOOL_SETTINGS, MT.MODULE_TYPE_CUBIC_SETTINGS, action_type) # 一定要初始化父类 170 | # 以下数据直接使用空格隔开 171 | self.prefs_name = b''; 172 | self.key = b''; 173 | self.type = b''; 174 | self.value = b''; 175 | # self.fmt = self.fmt + "1B" 176 | 177 | def decode(self, network_data, byteOrder='!'): 178 | """ 179 | 消息的解码 180 | """ 181 | size = super().decode(network_data, byteOrder) 182 | # 处理不定长的数据 183 | self.left_info = network_data[size:] 184 | print(self.left_info) 185 | # # 获取当前实例化的对象大小(可能是当前类,也可能是它的子类) 186 | # size = struct.Struct(self.fmt).size 187 | # # 以下的 self.fmt 可能包含了子类的一部分,并非一定等于 __init__ 中的 self.fmt 188 | # get_data = struct.unpack(byteOrder + self.fmt, network_data[: size]) 189 | 190 | # # 解析解码后的参数 191 | # for (attr, value) in zip(members, get_data): 192 | # setattr(self, attr, value) 193 | return size # 返回解码完成的数据大小 194 | 195 | def encode(self, byteOrder='='): 196 | """ 197 | 消息的编码,子类可以继承可以不重写 198 | """ 199 | info = self.prefs_name + b'\x00' + self.key + b'\x00' \ 200 | + self.type + b'\x00' + self.value + b'\r\n' 201 | self.msg_len = struct.Struct(self.fmt).size + len(info) 202 | 203 | data = super().encode(byteOrder) 204 | data = data + info 205 | return data 206 | 207 | def __dir__(self): 208 | super_param = super().__dir__() 209 | return super_param 210 | 211 | 212 | # 结构体转字典 213 | def dump_dict(obj): 214 | info = {} 215 | # 通过_fields_获取每一个字段 216 | # 检查每个字段的类型,根据不同类型分别处理 217 | # 支持递归迭代 218 | for k, v in obj._fields_: 219 | av = getattr(obj, k) 220 | if type(v) == type(Structure): 221 | print(av) 222 | # av = av.dump_dict() 223 | elif type(v) == type(Array): 224 | av = cast(av, c_char_p).value.decode() 225 | else: 226 | pass 227 | info[k] = av 228 | return info 229 | -------------------------------------------------------------------------------- /util/tkutils.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import tkinter as tk 4 | import tkinter.font as tkFont 5 | from PIL import Image, ImageTk # pip3 install pillow 6 | from tkinter import messagebox 7 | 8 | 9 | def show_info(message=""): 10 | messagebox.showinfo("提示框", message) 11 | 12 | 13 | def show_confirm(message=""): 14 | """ 15 | True : yes 16 | False : no 17 | """ 18 | return messagebox.askyesno("确认框", message) 19 | 20 | 21 | def center_window(win, width=None, height=None): 22 | """ 将窗口屏幕居中 """ 23 | screenwidth = win.winfo_screenwidth() 24 | screenheight = win.winfo_screenheight() 25 | if width is None: 26 | width, height = get_window_size(win)[:2] 27 | size = '%dx%d+%d+%d' % (width, height, (screenwidth - width) / 2, (screenheight - height) / 3) 28 | win.geometry(size) 29 | 30 | 31 | def get_window_size(win, update=True): 32 | """ 获得窗体的尺寸 """ 33 | if update: 34 | win.update() 35 | return win.winfo_width(), win.winfo_height(), win.winfo_x(), win.winfo_y() 36 | 37 | 38 | def tkimg_resized(img, w_box, h_box, keep_ratio=True): 39 | """对图片进行按比例缩放处理""" 40 | w, h = img.size 41 | 42 | if keep_ratio: 43 | if w > h: 44 | width = w_box 45 | height = int(h_box * (1.0 * h / w)) 46 | 47 | if h >= w: 48 | height = h_box 49 | width = int(w_box * (1.0 * w / h)) 50 | else: 51 | width = w_box 52 | height = h_box 53 | 54 | img1 = img.resize((width, height), Image.ANTIALIAS) 55 | tkimg = ImageTk.PhotoImage(img1) 56 | return tkimg 57 | 58 | 59 | def image_label(frame, img, width, height, keep_ratio=True): 60 | """输入图片信息,及尺寸,返回界面组件""" 61 | if isinstance(img, str): 62 | _img = Image.open(img) 63 | else: 64 | _img = img 65 | lbl_image = tk.Label(frame, width=width, height=height) 66 | 67 | tk_img = tkimg_resized(_img, width, height, keep_ratio) 68 | lbl_image.image = tk_img 69 | lbl_image.config(image=tk_img) 70 | return lbl_image 71 | 72 | 73 | def _font(fname="微软雅黑", size=12, bold=tkFont.NORMAL): 74 | """设置字体""" 75 | ft = tkFont.Font(family=fname, size=size, weight=bold) 76 | return ft 77 | 78 | 79 | def _ft(size=12, bold=False): 80 | """极简字体设置函数""" 81 | if bold: 82 | return _font(size=size, bold=tkFont.BOLD) 83 | else: 84 | return _font(size=size, bold=tkFont.NORMAL) 85 | 86 | 87 | def h_seperator(parent, height=2): # height 单位为像素值 88 | """水平分割线, 水平填充 """ 89 | tk.Frame(parent, height=height, bg="whitesmoke").pack(fill=tk.X) 90 | 91 | 92 | def v_seperator(parent, width, bg="whitesmoke"): # width 单位为像素值 93 | """垂直分割线 , fill=tk.Y, 但如何定位不确定,直接返回对象,由容器决定 """ 94 | frame = tk.Frame(parent, width=width, bg=bg) 95 | return frame 96 | -------------------------------------------------------------------------------- /util/widget_base.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | ################################################################################ 3 | # 4 | # Author: ClimbSnail(HQ) 5 | # original source is here. 6 | # https://github.com/ClimbSnail/HoloCubic_AIO_Tool 7 | # 8 | # 9 | ################################################################################ 10 | 11 | import tkinter as tk 12 | 13 | 14 | class EntryWithPlaceholder(tk.Entry): 15 | def __init__(self, master=None, *, placeholder="PLACEHOLDER", 16 | placeholder_color='grey', **attribute): 17 | super().__init__(master, attribute) 18 | 19 | self.placeholder = placeholder.strip() 20 | self.placeholder_color = placeholder_color 21 | self.default_fg_color = self['fg'] 22 | 23 | self.bind("", self.foc_in) 24 | self.bind("", self.foc_out) 25 | 26 | def get(self): 27 | if super().get().strip() == self.placeholder: 28 | return "" 29 | return super().get().strip() 30 | 31 | def refresh(self): 32 | """ 33 | 若输入框带有其他默认值(非提示词)时 需要手动调用刷新 34 | """ 35 | if not self.get(): 36 | self.insert(0, self.placeholder) 37 | self['fg'] = self.placeholder_color 38 | 39 | def foc_in(self, *args): 40 | if self.placeholder == super().get(): 41 | if self['fg'] == self.placeholder_color: 42 | self.delete('0', 'end') 43 | self['fg'] = self.default_fg_color 44 | 45 | def foc_out(self, *args): 46 | self.refresh() 47 | --------------------------------------------------------------------------------