Skip to content

tl installer / new OpenOCD #149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 53 commits into from
Apr 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
5711fca
Update README.md
Jason2866 Mar 9, 2025
6fa2efb
Update IDF 5.4.0.250303
Jason2866 Mar 9, 2025
aa5a97e
Added missing UM boards and fixed TinyS3 product URL. (#122)
UnexpectedMaker Mar 10, 2025
e247f2e
boards update taken from https://github.com/sivar2311/platformio_boards
Jason2866 Mar 19, 2025
832a195
pioarduino core 6.1.18
Jason2866 Mar 19, 2025
cac1250
Update IDF 5.4.0.250314
Jason2866 Mar 19, 2025
60b2963
Create esp32-s3-devkitc-1-n32r8v.json
Jason2866 Mar 20, 2025
b2c4121
Board Arduino Nano: standard no remapping
Jason2866 Mar 21, 2025
0a48460
Update arduino_nano_esp32.json
Jason2866 Mar 21, 2025
3d5ca25
add arduino_nano_esp32 board to Arduino Blink example
Jason2866 Mar 21, 2025
2fa97a5
remove already defined
Jason2866 Mar 21, 2025
9c5cf8b
no Arduino Nora Nano support
Jason2866 Mar 24, 2025
10aa217
arduino_nano_esp32.json: flash recovery image
Jason2866 Mar 24, 2025
fafc700
Update esptoolpy v4.8.9
Jason2866 Apr 1, 2025
6899b83
Create Bug_report.md
Jason2866 Apr 2, 2025
63fc1b3
Create config.yml
Jason2866 Apr 2, 2025
8eec5f0
add PR template
Jason2866 Apr 2, 2025
a7fab12
Update esp32-s3-devkitc1-n16r16.json (#136)
ikorman Apr 2, 2025
714989f
Ignore not used libs in example "Tasmota"
Jason2866 Apr 2, 2025
441f2b9
Disable BLE (sdkconfig) in CI Tasmota example
Jason2866 Apr 3, 2025
80cbeca
set lib_archive=False as default to make weak defines in Arduino Core…
Jason2866 Apr 7, 2025
a13d5f5
revert c
Jason2866 Apr 7, 2025
9c7f8b8
Set lib_archive to False as default
Jason2866 Apr 7, 2025
4eee52d
Update main.py
Jason2866 Apr 7, 2025
eb12567
Update IDF 5.4.1.250407
Jason2866 Apr 13, 2025
ba2dae6
Update platform.json
Jason2866 Apr 13, 2025
fa7beed
add esp-rom-elfs
Jason2866 Apr 13, 2025
6e848c3
Use actual develop 5.4. libs
Jason2866 Apr 13, 2025
f0bb1b8
Update pip dependencies
Jason2866 Apr 13, 2025
9530453
Update espidf.py
Jason2866 Apr 14, 2025
88fbdaf
Update IDF v5.4.1.250411
Jason2866 Apr 14, 2025
3a85a8b
remove old (not anymore working) way of setting start address of firm…
Jason2866 Apr 16, 2025
729d601
Update README.md
Jason2866 Apr 16, 2025
7da09cf
Update README.md to fix typos (#139)
lboue Apr 16, 2025
d47f924
remove generated old sdkconfig leftover
Jason2866 Apr 19, 2025
b07c738
Fix Arduino as an component of IDF compile for the C2
Jason2866 Apr 20, 2025
43ef94a
change example `custom_component_add`
Jason2866 Apr 23, 2025
d81abd0
Use Arduino libs idf-release_v5.4-3ad36321
Jason2866 Apr 23, 2025
a899cc6
Update platform.json
Jason2866 Apr 25, 2025
acabc69
install newer OpenOCD via tl_install from github
Jason2866 Apr 25, 2025
1b24fa5
Build C6 Blink example in debug mode
Jason2866 Apr 25, 2025
3b22952
Update platform.py
Jason2866 Apr 25, 2025
19f024b
Esp32ExceptionDecoder: decode stack overflow backtraces
Jason2866 Apr 25, 2025
e61acc7
do not overwrite an existing package.json
Jason2866 Apr 25, 2025
2b71471
remove redundant `bool`
Jason2866 Apr 25, 2025
575ca3e
Deactivate tl-install AFTER it is installed
Jason2866 Apr 25, 2025
6d2d94c
move installer in class
Jason2866 Apr 26, 2025
ef71a2b
Update platform.json
Jason2866 Apr 26, 2025
4284c61
small refactor and clean up
Jason2866 Apr 26, 2025
f59c54b
refactor no need for install folder / entry
Jason2866 Apr 27, 2025
083609d
no extra installer entry
Jason2866 Apr 27, 2025
ced2c63
remove trailing `,`
Jason2866 Apr 27, 2025
697ff0b
Merge branch 'devlop33_install' into develop_new_ocd
Jason2866 Apr 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/arduino-blink/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ custom_component_remove = espressif/esp_hosted
espressif/esp_diagnostics
espressif/esp_rainmaker
espressif/rmaker_common
custom_component_add = espressif/cmake_utilities @ 0.*
custom_component_add = espressif/cmake_utilities @ 0.*

[env:esp32-s3-arduino_nano_esp32]
platform = espressif32
Expand Down Expand Up @@ -92,6 +92,7 @@ custom_component_remove = espressif/esp_hosted
[env:esp32-c6-devkitc-1]
platform = espressif32
framework = arduino
build_type = debug
board = esp32-c6-devkitc-1
monitor_speed = 115200
custom_component_remove = espressif/esp_hosted
Expand Down
36 changes: 28 additions & 8 deletions platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
"license": "Apache-2.0",
"keywords": [
"dev-platform",
"Wi-Fi",
"WiFi",
"Bluetooth",
"Xtensa",
"RISC-V"
],
"engines": {
"platformio": ">=6.1.16"
"platformio": ">=6.1.18"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -85,9 +85,16 @@
},
"tool-esptoolpy": {
"type": "uploader",
"optional": false,
"owner": "pioarduino",
"version": "https://github.com/pioarduino/esptool/releases/download/v4.8.9/esptool.zip"
},
"tl-install": {
"type": "tool",
"optional": false,
"owner": "pioarduino",
"version": "https://github.com/pioarduino/esp_install/releases/download/v5.0.0/esp_install-v5.0.0.zip"
},
"tool-dfuutil-arduino": {
"type": "uploader",
"optional": true,
Expand All @@ -97,11 +104,12 @@
"tool-openocd-esp32": {
"type": "debugger",
"optional": true,
"owner": "platformio",
"version": "~2.1100.0"
"owner": "pioarduino",
"version": "https://github.com/pioarduino/registry/releases/download/0.0.1/openocd-v0.12.0-esp32-20250226.zip"
},
"tool-mklittlefs": {
"type": "uploader",
"optional": true,
"owner": "tasmota",
"version": "^3.2.0"
},
Expand All @@ -118,34 +126,46 @@
"version": "~2.230.0"
},
"tool-cppcheck": {
"type": "tool",
"optional": true,
"owner": "platformio",
"version": "~1.21100"
},
"tool-clangtidy": {
"type": "tool",
"optional": true,
"owner": "platformio",
"version": "^1.190100.0"
},
"tool-pvs-studio": {
"type": "tool",
"optional": true,
"owner": "platformio",
"version": "^7.18.59866"
},
"tool-cmake": {
"type": "tool",
"optional": true,
"owner": "platformio",
"version": "~3.30.2"
},
"tool-esp-rom-elfs": {
"optional": true,
"owner": "platformio",
"version": "0.0.1+20241011"
"tool-esp-rom-elfs": {
"type": "tool",
"optional": true,
"owner": "platformio",
"version": "0.0.1+20241011"
},
"tool-ninja": {
"type": "tool",
"optional": true,
"owner": "platformio",
"version": "^1.7.0"
},
"tool-scons": {
"type": "tool",
"optional": true,
"owner": "platformio",
"version": "~4.40801.0"
}
}
}
85 changes: 63 additions & 22 deletions platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,26 @@
# limitations under the License.

import os
import urllib
import subprocess
import sys
import json
import re
import requests
import shutil
from os.path import join

from platformio.public import PlatformBase, to_unix_path
from platformio.proc import get_pythonexe_path
from platformio.project.config import ProjectConfig
from platformio.package.manager.tool import ToolPackageManager


IS_WINDOWS = sys.platform.startswith("win")
# Set Platformio env var to use windows_amd64 for all windows architectures
# only windows_amd64 native espressif toolchains are available
# needs platformio core >= 6.1.16b2 or pioarduino core 6.1.16+test
# needs platformio/pioarduino core >= 6.1.17
if IS_WINDOWS:
os.environ["PLATFORMIO_SYSTEM_TYPE"] = "windows_amd64"

python_exe = get_pythonexe_path()
pm = ToolPackageManager()

class Espressif32Platform(PlatformBase):
def configure_default_packages(self, variables, targets):
Expand All @@ -38,11 +42,55 @@ def configure_default_packages(self, variables, targets):
board_config = self.board_config(variables.get("board"))
mcu = variables.get("board_build.mcu", board_config.get("build.mcu", "esp32"))
board_sdkconfig = variables.get("board_espidf.custom_sdkconfig", board_config.get("espidf.custom_sdkconfig", ""))
core_variant_board = ''.join(variables.get("board_build.extra_flags", board_config.get("build.extra_flags", "")))
core_variant_board = core_variant_board.replace("-D", " ")
core_variant_build = (''.join(variables.get("build_flags", []))).replace("-D", " ")
frameworks = variables.get("pioframework", [])

def install_tool(TOOL):
self.packages[TOOL]["optional"] = False
TOOL_PATH = os.path.join(ProjectConfig.get_instance().get("platformio", "packages_dir"), TOOL)
TOOL_PACKAGE_PATH = os.path.join(TOOL_PATH, "package.json")
TOOLS_PATH_DEFAULT = os.path.join(os.path.expanduser("~"), ".platformio")
IDF_TOOLS = os.path.join(ProjectConfig.get_instance().get("platformio", "packages_dir"), "tl-install", "tools", "idf_tools.py")
TOOLS_JSON_PATH = os.path.join(TOOL_PATH, "tools.json")
TOOLS_PIO_PATH = os.path.join(TOOL_PATH, ".piopm")
IDF_TOOLS_CMD = (
python_exe,
IDF_TOOLS,
"--quiet",
"--non-interactive",
"--tools-json",
TOOLS_JSON_PATH,
"install"
)

tl_flag = bool(os.path.exists(IDF_TOOLS))
json_flag = bool(os.path.exists(TOOLS_JSON_PATH))
pio_flag = bool(os.path.exists(TOOLS_PIO_PATH))
if tl_flag and json_flag:
rc = subprocess.run(IDF_TOOLS_CMD).returncode
if rc != 0:
sys.stderr.write("Error: Couldn't execute 'idf_tools.py install'\n")
else:
tl_path = "file://" + join(TOOLS_PATH_DEFAULT, "tools", TOOL)
if not os.path.exists(join(TOOLS_PATH_DEFAULT, "tools", TOOL, "package.json")):
shutil.copyfile(TOOL_PACKAGE_PATH, join(TOOLS_PATH_DEFAULT, "tools", TOOL, "package.json"))
self.packages.pop(TOOL, None)
if os.path.exists(TOOL_PATH) and os.path.isdir(TOOL_PATH):
try:
shutil.rmtree(TOOL_PATH)
except Exception as e:
print(f"Error while removing the tool folder: {e}")
pm.install(tl_path)
# tool is already installed, just activate it
if tl_flag and pio_flag and not json_flag:
self.packages[TOOL]["version"] = TOOL_PATH
self.packages[TOOL]["optional"] = False

return

# Installer only needed for setup, deactivate when installed
if bool(os.path.exists(os.path.join(ProjectConfig.get_instance().get("platformio", "packages_dir"), "tl-install", "tools", "idf_tools.py"))):
self.packages["tl-install"]["optional"] = True

if "arduino" in frameworks:
self.packages["framework-arduinoespressif32"]["optional"] = False
self.packages["framework-arduinoespressif32-libs"]["optional"] = False
Expand Down Expand Up @@ -77,8 +125,7 @@ def configure_default_packages(self, variables, targets):
self.packages["tool-mkfatfs"]["optional"] = False
else:
self.packages["tool-mkspiffs"]["optional"] = False
if variables.get("upload_protocol"):
self.packages["tool-openocd-esp32"]["optional"] = False

if os.path.isdir("ulp"):
self.packages["toolchain-esp32ulp"]["optional"] = False

Expand All @@ -94,29 +141,23 @@ def configure_default_packages(self, variables, targets):
else:
del self.packages["tool-dfuutil-arduino"]

# Starting from v12, Espressif's toolchains are shipped without
# bundled GDB. Instead, it's distributed as separate packages for Xtensa
# and RISC-V targets.
for gdb_package in ("tool-xtensa-esp-elf-gdb", "tool-riscv32-esp-elf-gdb"):
self.packages[gdb_package]["optional"] = False
# if IS_WINDOWS:
# Note: On Windows GDB v12 is not able to
# launch a GDB server in pipe mode while v11 works fine
# self.packages[gdb_package]["version"] = "~11.2.0"
# install GDB and OpenOCD when debug mode or upload_protocol is set
if (variables.get("build_type") or "debug" in "".join(targets)) or variables.get("upload_protocol"):
for gdb_package in ("tool-xtensa-esp-elf-gdb", "tool-riscv32-esp-elf-gdb"):
self.packages[gdb_package]["optional"] = False
install_tool("tool-openocd-esp32")

# Common packages for IDF and mixed Arduino+IDF projects
if "espidf" in frameworks:
self.packages["toolchain-esp32ulp"]["optional"] = False
for p in self.packages:
if p in (
"tool-scons",
"tool-cmake",
"tool-ninja",
"tool-scons",
"tool-esp-rom-elfs",
):
self.packages[p]["optional"] = False
# elif p in ("tool-mconf", "tool-idf") and IS_WINDOWS:
# self.packages[p]["optional"] = False

if mcu in ("esp32", "esp32s2", "esp32s3"):
self.packages["toolchain-xtensa-esp-elf"]["optional"] = False
Expand Down