From 079825135502a6a5add00e5a2575c9310d32aecb Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Mon, 1 Oct 2018 16:21:30 +1000 Subject: [PATCH] windows: Add Python dependencies, openocd, and ULP to installer --- .../jtag-debugging/configure-wrover.rst | 5 +- docs/en/api-guides/jtag-debugging/index.rst | 4 ++ .../jtag-debugging/setup-openocd-windows.rst | 6 +++ .../jtag-debugging/windows-openocd-note.rst | 3 ++ .../jtag-debugging/windows-openocd-note.rst | 1 + tools/windows/tool_setup/build_installer.sh | 8 ++- tools/windows/tool_setup/idf_tool_setup.iss | 52 ++++++++++++------- 7 files changed, 59 insertions(+), 20 deletions(-) create mode 100644 docs/en/api-guides/jtag-debugging/windows-openocd-note.rst create mode 100644 docs/zh_CN/api-guides/jtag-debugging/windows-openocd-note.rst diff --git a/docs/en/api-guides/jtag-debugging/configure-wrover.rst b/docs/en/api-guides/jtag-debugging/configure-wrover.rst index 95e6932144..bdfad5249e 100644 --- a/docs/en/api-guides/jtag-debugging/configure-wrover.rst +++ b/docs/en/api-guides/jtag-debugging/configure-wrover.rst @@ -132,8 +132,11 @@ Manually unloading the driver sudo kextload -b com.FTDI.driver.FTDIUSBSerialDriver +.. include:: ./windows-openocd-note.rst -Note that if you need to restart OpenOCD, there is no need to unload FTDI driver again — just stop OpenOCD and start it again. The driver only needs to be unloaded if WROVER KIT was reconnected or power was toggled. +.. note:: + + If you need to restart OpenOCD, there is no need to unload FTDI driver again — just stop OpenOCD and start it again. The driver only needs to be unloaded if WROVER KIT was reconnected or power was toggled. This procedure can be wrapped into a shell script, if desired. diff --git a/docs/en/api-guides/jtag-debugging/index.rst b/docs/en/api-guides/jtag-debugging/index.rst index c74609fdf3..42bcc84eb0 100644 --- a/docs/en/api-guides/jtag-debugging/index.rst +++ b/docs/en/api-guides/jtag-debugging/index.rst @@ -165,6 +165,8 @@ Open terminal, go to directory where OpenOCD is installed and start it up:: The files provided after ``-f`` above, are specific for ESP-WROVER-KIT with :ref:`esp-modules-and-boards-esp32-wroom-32` module. You may need to provide different files depending on used hardware, For guidance see :ref:`jtag-debugging-tip-openocd-configure-target`. +.. include:: ./windows-openocd-note.rst + .. highlight:: none You should now see similar output (this log is for ESP32 WROVER KIT):: @@ -201,6 +203,8 @@ Another option is to write application image to flash using OpenOCD via JTAG wit cd ~/esp/openocd-esp32 bin/openocd -s share/openocd/scripts -f interface/ftdi/esp32_devkitj_v1.cfg -f board/esp-wroom-32.cfg -c "program_esp32 filename.bin 0x10000 verify exit" +.. include:: ./windows-openocd-note.rst + OpenOCD flashing command ``program_esp32`` has the following format: ``program_esp32 [verify] [reset] [exit]`` diff --git a/docs/en/api-guides/jtag-debugging/setup-openocd-windows.rst b/docs/en/api-guides/jtag-debugging/setup-openocd-windows.rst index e7d6f5dfaf..6b7b83af84 100644 --- a/docs/en/api-guides/jtag-debugging/setup-openocd-windows.rst +++ b/docs/en/api-guides/jtag-debugging/setup-openocd-windows.rst @@ -2,6 +2,12 @@ Set up OpenOCD for Windows ************************** +IDF Tools Installer +=================== + +If you are using CMake build system and followed the :doc:`/get-started-cmake/windows-setup` with the ``ESP-IDF Tools Installer`` V1.2 or newer, then by default you will already have ``openocd`` installed. + +``ESP-IDF Tools Installer`` adds ``openocd` to the ``PATH`` so that it can be run from any directory. Set up OpenOCD ============== diff --git a/docs/en/api-guides/jtag-debugging/windows-openocd-note.rst b/docs/en/api-guides/jtag-debugging/windows-openocd-note.rst new file mode 100644 index 0000000000..4451ae722b --- /dev/null +++ b/docs/en/api-guides/jtag-debugging/windows-openocd-note.rst @@ -0,0 +1,3 @@ +.. note:: + + If you installed openocd on Windows using the ESP-IDF Tools Installer, can run ``openocd -f interface/ftdi/esp32_devkitj_v1.cfg -f board/esp-wroom-32.cfg`` without needing to change directory first, and without the ``-s share/openocd/scripts`` argument. diff --git a/docs/zh_CN/api-guides/jtag-debugging/windows-openocd-note.rst b/docs/zh_CN/api-guides/jtag-debugging/windows-openocd-note.rst new file mode 100644 index 0000000000..f81ed5ca65 --- /dev/null +++ b/docs/zh_CN/api-guides/jtag-debugging/windows-openocd-note.rst @@ -0,0 +1 @@ +.. include:: ../../../en/api-guides/jtag-debugging/windows-openocd-note.rst diff --git a/tools/windows/tool_setup/build_installer.sh b/tools/windows/tool_setup/build_installer.sh index 8dc21f1de2..3673d6a245 100755 --- a/tools/windows/tool_setup/build_installer.sh +++ b/tools/windows/tool_setup/build_installer.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # Setup script to build Windows tool installer with Inno Setup # @@ -10,9 +10,13 @@ # - Runs ISCC under wine to compile the installer itself set -e +mkdir -p dl input + cd `dirname $0` pushd dl wget --continue "https://dl.espressif.com/dl/xtensa-esp32-elf-win32-1.22.0-80-g6c4433a-5.2.0.zip" +wget --continue "https://github.com/espressif/binutils-esp32ulp/releases/download/v2.28.51-esp32ulp-20180809/binutils-esp32ulp-win32-2.28.51-esp32ulp-20180809.zip" +wget --continue "https://github.com/espressif/openocd-esp32/releases/download/v0.10.0-esp32-20180920/openocd-esp32-win32-0.10.0-esp32-20180920.zip" wget --continue "https://github.com/espressif/kconfig-frontends/releases/download/v4.6.0.0-idf-20180525/mconf-v4.6.0.0-idf-20180525-win32.zip" wget --continue "https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-win.zip" popd @@ -21,6 +25,8 @@ rm -rf input/* pushd input unzip ../dl/xtensa-esp32-elf-win32-1.22.0-80-g6c4433a-5.2.0.zip unzip ../dl/mconf-v4.6.0.0-idf-20180525-win32.zip +unzip ../dl/binutils-esp32ulp-win32-2.28.51-esp32ulp-20180809.zip +unzip ../dl/openocd-esp32-win32-0.10.0-esp32-20180920.zip unzip ../dl/ninja-win.zip popd diff --git a/tools/windows/tool_setup/idf_tool_setup.iss b/tools/windows/tool_setup/idf_tool_setup.iss index 551c5abcbd..55db4b2003 100644 --- a/tools/windows/tool_setup/idf_tool_setup.iss +++ b/tools/windows/tool_setup/idf_tool_setup.iss @@ -2,8 +2,8 @@ [Setup] AppName=ESP-IDF Tools -AppVersion=1.1 OutputBaseFilename=esp-idf-tools-setup-1.1 +AppVersion=1.2 DefaultDirName={pf}\Espressif\ESP-IDF Tools DefaultGroupName=ESP-IDF Tools @@ -21,8 +21,10 @@ Name: "full"; Description: "Default installation" Name: "custom"; Description: "Custom installation"; Flags: iscustom [Components] -Name: toolchain; Description: ESP32 Xtensa GCC Cross-Toolchain; Types: full custom; +Name: xtensa_esp32; Description: ESP32 Xtensa GCC Cross-Toolchain; Types: full custom; Name: mconf_idf; Description: ESP-IDF console menuconfig tool; Types: full custom; +Name: openocd_esp32; Description: openocd debug interface for ESP32; Types: full custom; +Name: esp32ulp_elf_binutils; Description: ULP binutils toolchain for ESP32; Types: full custom; Name: ninja; Description: Install Ninja build v1.8.2; Types: full custom [Tasks] @@ -37,29 +39,35 @@ Name: addpath\user; Description: "For the current user only"; GroupDescription: ; The tasks won't appear if CMake/Python27 already appear to be installed on this system Name: cmake32; Description: Download and Run CMake 3.11.1 Installer; GroupDescription: "Other Required Tools:"; Check: not IsWin64 and not CMakeInstalled Name: cmake64; Description: Download and Run CMake 3.11.1 Installer; GroupDescription: "Other Required Tools:"; Check: IsWin64 and not CMakeInstalled -Name: python32; Description: Download and Run Python 2.7.14 Installer and install pyserial; GroupDescription: "Other Required Tools:"; Check: not IsWin64 and not Python27Installed -Name: python64; Description: Download and Run Python 2.7.14 Installer and install pyserial; GroupDescription: "Other Required Tools:"; Check: IsWin64 and not Python27Installed +Name: python32; Description: Download and Run Python 2.7.14 Installer and install Python dependencies; GroupDescription: "Other Required Tools:"; Check: not IsWin64 and not Python27Installed +Name: python64; Description: Download and Run Python 2.7.14 Installer and install Python dependencies; GroupDescription: "Other Required Tools:"; Check: IsWin64 and not Python27Installed +Name: python_requirements; Description: Install any missing Python dependencies; GroupDescription: "Other Required Tools:"; Check: Python27Installed [Files] -Components: toolchain; Source: "input\xtensa-esp32-elf\*"; DestDir: "{app}\toolchain\"; Flags: recursesubdirs; +Components: xtensa_esp32; Source: "input\xtensa-esp32-elf\*"; DestDir: "{app}\tools\"; Flags: recursesubdirs; Components: mconf_idf; Source: "input\mconf-v4.6.0.0-idf-20180525-win32\*"; DestDir: "{app}\mconf-idf\"; -Components: ninja; Source: "input\ninja.exe"; DestDir: "{app}"; +Components: esp32ulp_elf_binutils; Source: "input\esp32ulp-elf-binutils\*"; DestDir: "{app}\tools\"; Flags: recursesubdirs; +; Excludes for openocd are because some config files contain Cyrillic characters and inno can't encode them +Components: openocd_esp32; Source: "input\openocd-esp32\*"; DestDir: "{app}\tools\"; Flags: recursesubdirs; Excludes: "target\1986*.cfg,target\*1879*.cfg" +Components: ninja; Source: "input\ninja.exe"; DestDir: "{app}\tools\bin\"; +Tasks: python32 python64 python_requirements; Source: "..\..\..\requirements.txt"; DestDir: "{tmp}"; Flags: deleteafterinstall; [Run] Tasks: cmake32 cmake64; Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\cmake.msi"" /qb! {code:GetCMakeInstallerArgs}"; StatusMsg: Running CMake installer...; Tasks: python32 python64; Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\python.msi"" /qb! {code:GetPythonInstallerArgs} REBOOT=Supress"; StatusMsg: Running Python installer...; -Tasks: python32 python64; Filename: "C:\Python27\Scripts\pip.exe"; Parameters: "install pyserial"; StatusMsg: Installing pyserial...; +Tasks: python32 python64; Filename: "C:\Python27\Scripts\pip.exe"; Parameters: "install -r ""{tmp}\requirements.txt"""; StatusMsg: Installing Python modules...; +Tasks: python_requirements; Filename: "{code:Python27InstallPathInclude}\Scripts\pip.exe"; Parameters: "install -r ""{tmp}\requirements.txt"""; StatusMsg: Installing Python modules...; [Registry] ; Prepend various entries to Path in the registry. Can either be HKLM (all users) or HKCU (single user only) -; ninja path (in root app directory) +; "tools" bin dir (ninja, xtensa & ULP toolchains, openocd all in this dir) Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; \ - ValueType: expandsz; ValueName: "Path"; ValueData: "{app};{olddata}"; Check: not IsInPath('{app}'); \ - Components: ninja; Tasks: addpath\allusers + ValueType: expandsz; ValueName: "Path"; ValueData: "{app}\tools\bin;{olddata}"; Check: not IsInPath('{app}'); \ + Components: xtensa_esp32 esp32ulp_elf_binutils openocd_esp32 ninja; Tasks: addpath\allusers Root: HKCU; Subkey: "Environment"; \ - ValueType: expandsz; ValueName: "Path"; ValueData: "{app};{olddata}"; Check: not IsInPath('{app}'); \ - Components: ninja; Tasks: addpath\user + ValueType: expandsz; ValueName: "Path"; ValueData: "{app}\tools\bin;{olddata}"; Check: not IsInPath('{app}'); \ + Components: xtensa_esp32 esp32ulp_elf_binutils openocd_esp32 ninja; Tasks: addpath\user ; mconf-idf path Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; \ @@ -69,13 +77,15 @@ Root: HKCU; Subkey: "Environment"; \ ValueType: expandsz; ValueName: "Path"; ValueData: "{app}\mconf-idf;{olddata}"; Check: not IsInPath('{app}\mconf-idf'); \ Components: mconf_idf; Tasks: addpath\user -; toolchain path +; set OPENOCD_SCRIPTS environment variable +[Registry] Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; \ - ValueType: expandsz; ValueName: "Path"; ValueData: "{app}\toolchain\bin;{olddata}"; Check: not IsInPath('{app}\toolchain\bin'); \ - Components: toolchain; Tasks: addpath\allusers -Root: HKCU; Subkey: "Environment"; \ - ValueType: expandsz; ValueName: "Path"; ValueData: "{app}\toolchain\bin;{olddata}"; Check: not IsInPath('{app}\toolchain\bin'); \ - Components: toolchain; Tasks: addpath\user + ValueType:string; ValueName: "OPENOCD_SCRIPTS"; \ + ValueData: "{app}\tools\share\openocd\scripts"; Flags: preservestringtype createvalueifdoesntexist; \ + Components: openocd_esp32; Tasks: addpath\allusers +Root: HKCU; Subkey: "Environment"; ValueType:string; ValueName: "OPENOCD_SCRIPTS"; \ + ValueData: "{app}\tools\share\openocd\scripts"; Flags: preservestringtype createvalueifdoesntexist; \ + Components: openocd_esp32; Tasks: addpath\user [Code] @@ -146,6 +156,12 @@ begin Result := GetInstallPath('SOFTWARE\Python\PythonCore\2.7\InstallPath', ''); end; +{ Return the path where Python 2.7 is installed, suitable for including in code: tag } +function Python27InstallPathInclude(Ignored : String) : String; +begin + Result := Python27InstallPath(); +end; + { Return True if Python 2.7 is installed } function Python27Installed() : Boolean; begin