diff --git a/.github/workflows/ci-esp32.yml b/.github/workflows/ci-esp32.yml index 35f177364d..1644494eff 100644 --- a/.github/workflows/ci-esp32.yml +++ b/.github/workflows/ci-esp32.yml @@ -13,22 +13,18 @@ jobs: matrix: os: [ubuntu-latest, macos-latest, windows-latest] variant: [esp32, esp32s2, esp32c3, esp32s3, esp32c2] - idf_version: ["4.3", "4.4", "5.0", "5.2"] - exclude: - - variant: esp32s3 - idf_version: "4.3" - - variant: esp32c2 + idf_version: ["4.4", "5.0", "5.2"] + include: + - os: ubuntu-latest + variant: esp32 idf_version: "4.3" + exclude: - variant: esp32c2 idf_version: "4.4" - - os: macos-latest - idf_version: "4.3" - os: macos-latest idf_version: "4.4" - os: macos-latest idf_version: "5.0" - - os: windows-latest - idf_version: "4.3" - os: windows-latest idf_version: "5.0" @@ -42,6 +38,7 @@ jobs: SMING_ARCH: Esp32 SMING_SOC: ${{ matrix.variant }} INSTALL_IDF_VER: ${{ matrix.idf_version }} + ENABLE_CCACHE: 1 steps: - name: Fix autocrlf setting @@ -86,6 +83,11 @@ jobs: . Tools/ci/setenv.ps1 Tools/ci/install.cmd + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ matrix.os }}-${{ matrix.variant }}-${{ matrix.idf_version }} + - name: Build and test for ${{matrix.variant}} with IDF v${{matrix.idf_version}} on Ubuntu / MacOS if: ${{ matrix.os != 'windows-latest' }} run: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ba517edd1..608d6286e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,6 +41,7 @@ jobs: SMING_SOC: ${{ matrix.variant }} CLANG_BUILD: ${{ matrix.toolchain == 'clang' && '15' || '0' }} BUILD64: ${{ matrix.toolchain == 'gcc64' && 1 || 0 }} + ENABLE_CCACHE: 1 steps: - name: Fix autocrlf setting @@ -72,6 +73,11 @@ jobs: . Tools/ci/setenv.ps1 Tools/ci/install.cmd + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ matrix.os }}-${{ matrix.toolchain }}-${{ matrix.variant }} + - name: Build and test for ${{matrix.variant}} on Ubuntu / MacOS env: CLANG_FORMAT: clang-format-8 diff --git a/Sming/Arch/Esp32/Tools/install.cmd b/Sming/Arch/Esp32/Tools/install.cmd index 91b2d104f8..9952a151c6 100644 --- a/Sming/Arch/Esp32/Tools/install.cmd +++ b/Sming/Arch/Esp32/Tools/install.cmd @@ -1,9 +1,9 @@ REM Esp32 install.cmd -if "%IDF_PATH%"=="" goto :EOF -if "%IDF_TOOLS_PATH%"=="" goto :EOF +if "%IDF_PATH%"=="" goto :undefined +if "%IDF_TOOLS_PATH%"=="" goto :undefined -if exist "%IDF_PATH%" goto :setup +if exist "%IDF_PATH%" goto :cloned if "%IDF_REPO%"=="" set IDF_REPO="https://github.com/mikee47/esp-idf.git" if "%INSTALL_IDF_VER%"=="" set INSTALL_IDF_VER=5.2 @@ -14,6 +14,23 @@ if "%CI_BUILD_DIR%" NEQ "" ( ) git clone -b %IDF_BRANCH% %IDF_REPO% %IDF_PATH% %IDF_INSTALL_OPTIONS% +goto :setup + + +:undefined +echo. +echo ** Cannot install Esp32 tools: IDF_PATH or IDF_TOOLS_PATH not defined +echo. +goto :EOF + + +:cloned +echo. +echo ** Skipping ESP-IDF clone: '%IDF_PATH%' exists +echo. +goto :setup + + :setup REM Install IDF tools and packages @@ -24,10 +41,3 @@ python3 "%IDF_PATH%\tools\idf_tools.py" --non-interactive install-python-env if "%CI_BUILD_DIR%" NEQ "" ( del /q "%IDF_TOOLS_PATH%\dist\*" ) - -if "%INSTALL_IDF_VER%" == "5.0" goto :install_python -if "%INSTALL_IDF_VER%" == "5.2" goto :install_python -goto :EOF - -:install_python -python "%IDF_PATH%\tools\idf_tools.py" --non-interactive install-python-env diff --git a/Sming/Arch/Esp32/Tools/install.sh b/Sming/Arch/Esp32/Tools/install.sh index fa191f34ad..82bab550fd 100755 --- a/Sming/Arch/Esp32/Tools/install.sh +++ b/Sming/Arch/Esp32/Tools/install.sh @@ -12,7 +12,6 @@ case $DIST in debian) PACKAGES+=(\ bison \ - ccache \ flex \ gperf \ libffi-dev \ @@ -23,7 +22,6 @@ case $DIST in fedora) PACKAGES+=(\ bison \ - ccache \ flex \ gperf \ libffi-devel \ diff --git a/Sming/Arch/Esp32/build.mk b/Sming/Arch/Esp32/build.mk index 44789fb545..df09aea6f6 100644 --- a/Sming/Arch/Esp32/build.mk +++ b/Sming/Arch/Esp32/build.mk @@ -103,6 +103,10 @@ endif IDF_PATH_LIST += $(ESP32_IDFEXE_PATH) endif +ifeq ($(ENABLE_CCACHE),1) +export IDF_CCACHE_ENABLE := 1 +endif + DEBUG_VARS += NINJA NINJA := $(if $(ESP32_NINJA_PATH),$(ESP32_NINJA_PATH)/,)ninja diff --git a/Sming/Arch/Esp8266/Tools/install.cmd b/Sming/Arch/Esp8266/Tools/install.cmd index 3c20108241..20920917c3 100644 --- a/Sming/Arch/Esp8266/Tools/install.cmd +++ b/Sming/Arch/Esp8266/Tools/install.cmd @@ -1,8 +1,27 @@ REM Esp8266 install.cmd +if "%ESP_HOME%" == "" goto :undefined +if exist "%ESP_HOME%" goto :installed + set EQT_REPO=https://github.com/earlephilhower/esp-quick-toolchain/releases/download/3.2.0-gcc10.3 set EQT_TOOLCHAIN=x86_64-w64-mingw32.xtensa-lx106-elf-c791b74.230224.zip mkdir %ESP_HOME% curl -Lo %DOWNLOADS%/%EQT_TOOLCHAIN% %EQT_REPO%/%EQT_TOOLCHAIN% 7z -o%ESP_HOME% x %DOWNLOADS%/%EQT_TOOLCHAIN% + +goto :EOF + + +:undefined +echo. +echo ** Cannot install Esp8266 tools: ESP_HOME not defined +echo. +goto :EOF + + +:installed +echo. +echo ** Skipping Esp8266 tools installation: '%ESP_HOME%' exists +echo. +goto :EOF diff --git a/Sming/Arch/Rp2040/Components/picotool/component.mk b/Sming/Arch/Rp2040/Components/picotool/component.mk index e339d2025c..9e2ea04f85 100644 --- a/Sming/Arch/Rp2040/Components/picotool/component.mk +++ b/Sming/Arch/Rp2040/Components/picotool/component.mk @@ -7,7 +7,13 @@ COMPONENT_LIBNAME := DEBUG_VARS += PICOTOOL -CMAKE_OPTIONS := +PICOTOOL_CMAKE_OPTIONS := + +ifeq ($(ENABLE_CCACHE),1) +PICOTOOL_CMAKE_OPTIONS += \ + -DCMAKE_C_COMPILER_LAUNCHER=$(CCACHE) \ + -DCMAKE_CPP_COMPILER_LAUNCHER=$(CCACHE) +endif ifeq ($(UNAME),Windows) PICOTOOL_CMAKE_OPTIONS += \ diff --git a/Sming/Arch/Rp2040/Components/rp2040/component.mk b/Sming/Arch/Rp2040/Components/rp2040/component.mk index 4c18fef8e6..4c03455044 100644 --- a/Sming/Arch/Rp2040/Components/rp2040/component.mk +++ b/Sming/Arch/Rp2040/Components/rp2040/component.mk @@ -118,6 +118,12 @@ RP2040_CMAKE_OPTIONS := \ -DCMAKE_MAKE_PROGRAM=$(NINJA) \ -DCMAKE_BUILD_TYPE=$(if $(subst 1,,$(PICO_DEBUG)),RelWithDebInfo,Debug) +ifeq ($(ENABLE_CCACHE),1) +RP2040_CMAKE_OPTIONS += \ + -DCMAKE_C_COMPILER_LAUNCHER=$(CCACHE) \ + -DCMAKE_CPP_COMPILER_LAUNCHER=$(CCACHE) +endif + COMPONENT_PREREQUISITES := $(PICO_CONFIG) BOOTLOADER := $(PICO_BUILD_DIR)/pico-sdk/src/rp2_common/boot_stage2/bs2_default_padded_checksummed.S diff --git a/Sming/Arch/Rp2040/Tools/install.cmd b/Sming/Arch/Rp2040/Tools/install.cmd index cf77680df7..6f8416843e 100644 --- a/Sming/Arch/Rp2040/Tools/install.cmd +++ b/Sming/Arch/Rp2040/Tools/install.cmd @@ -1,6 +1,8 @@ REM Rp2040 install.cmd -if exist "%PICO_TOOLCHAIN_PATH%/arm-none-eabi" goto :already_got +if "%PICO_TOOLCHAIN_PATH%"=="" goto :undefined +if exist "%PICO_TOOLCHAIN_PATH%/arm-none-eabi" goto :installed + set TOOLCHAIN_VERSION=13.2.rel1 set TOOLCHAIN_BASE_URL=https://developer.arm.com/-/media/Files/downloads/gnu set TOOLCHAIN_NAME=arm-gnu-toolchain-%TOOLCHAIN_VERSION%-mingw-w64-i686-arm-none-eabi @@ -10,10 +12,19 @@ curl -Lo tmp.zip %TOOLCHAIN_BASE_URL%/%TOOLCHAIN_VERSION%/binrel/%TOOLCHAIN_FILE del tmp.zip move "%PICO_TOOLCHAIN_PATH%-tmp/%TOOLCHAIN_NAME%" "%PICO_TOOLCHAIN_PATH%" rmdir "%PICO_TOOLCHAIN_PATH%-tmp" + +goto :EOF + + +:undefined +echo. +echo ** Cannot install Rp2040 tools: PICO_TOOLCHAIN_PATH not defined +echo. goto :EOF -:already_got +:installed echo. echo ** Skipping Rp2040 tools installation: '%PICO_TOOLCHAIN_PATH%' exists echo. +goto :EOF diff --git a/Sming/Components/lwip/component.mk b/Sming/Components/lwip/component.mk index b692dcf685..b5011ee0e9 100644 --- a/Sming/Components/lwip/component.mk +++ b/Sming/Components/lwip/component.mk @@ -30,6 +30,11 @@ LWIP_CMAKE_OPTIONS := \ -DLWIP_DIR=$(COMPONENT_PATH)/lwip \ -DCMAKE_MAKE_PROGRAM="$(NINJA)" +ifeq ($(ENABLE_CCACHE),1) +LWIP_CMAKE_OPTIONS += \ + -DCMAKE_C_COMPILER_LAUNCHER=$(CCACHE) +endif + ifeq ($(ENABLE_LWIPDEBUG), 1) LWIP_CMAKE_OPTIONS += -DCMAKE_BUILD_TYPE=Debug else diff --git a/Sming/Components/ws_parser b/Sming/Components/ws_parser index e94a4b9d8e..76797cefa3 160000 --- a/Sming/Components/ws_parser +++ b/Sming/Components/ws_parser @@ -1 +1 @@ -Subproject commit e94a4b9d8eab5dface51c666db546c60ca9f8377 +Subproject commit 76797cefa3f5a0f20ae7932d2a623e0f37d3ffab diff --git a/Sming/README.rst b/Sming/README.rst index aa6d1e23a0..02f3b32030 100644 --- a/Sming/README.rst +++ b/Sming/README.rst @@ -81,6 +81,20 @@ Change it like this:: However, it does not treat them as errors because of the above which could be false-positives. +Build caching +~~~~~~~~~~~~~ + +.. envvar:: ENABLE_CCACHE + + Default: 0 (disabled) + + Set to 1 to run (most) compilation through `ccache `__. + This speeds up re-compilation of code considerably at the expense of disk space + and slightly extended initial compilation. + + This setting was introduced mainly for CI builds as relatively little changes between runs. + + Release builds ~~~~~~~~~~~~~~ diff --git a/Sming/build.mk b/Sming/build.mk index f98de53e72..c4667dea81 100644 --- a/Sming/build.mk +++ b/Sming/build.mk @@ -130,6 +130,10 @@ ARCH_COMPONENTS = $(ARCH_BASE)/Components DEBUG_VARS += GIT GIT ?= git +# ccache +DEBUG_VARS += CCACHE +CCACHE ?= ccache + # CMake command DEBUG_VARS += CMAKE CMAKE ?= cmake @@ -221,6 +225,10 @@ ifneq ($(STRICT),1) CXXFLAGS += -Wno-reorder endif +# ccache can speed up re-builds considerably +BUILD_VARS += ENABLE_CCACHE +ENABLE_CCACHE ?= 0 + include $(ARCH_BASE)/build.mk ifndef MAKE_CLEAN diff --git a/Sming/component-wrapper.mk b/Sming/component-wrapper.mk index 007beda4e0..1b99dcda78 100644 --- a/Sming/component-wrapper.mk +++ b/Sming/component-wrapper.mk @@ -110,16 +110,14 @@ CFLAGS += $(COMPONENT_CFLAGS) CPPFLAGS += $(COMPONENT_CPPFLAGS) CXXFLAGS += $(COMPONENT_CXXFLAGS) -# GCC 10 escapes ':' in path names which breaks GNU make for Windows so filter them -ifeq ($(UNAME),Windows) -OUTPUT_DEPS := | $(SED) "s/\\\\:/:/g" > $$@ -else -OUTPUT_DEPS := -MF $$@ -endif - # Additional flags to pass to clang CLANG_FLAG_EXTRA ?= +ifneq ($(ENABLE_CCACHE),1) +CCACHE := +export CCACHE_DISABLE=1 +endif + # $1 -> absolute source directory, no trailing path separator # $2 -> relative output build directory, with trailing path separator define GenerateCompileTargets @@ -127,12 +125,12 @@ BUILD_DIRS += $2 ifneq (,$(filter $1/%.s,$(SOURCE_FILES))) $2%.o: $1/%.s $(vecho) "AS $$<" - $(Q) $(AS) $(addprefix -I,$(INCDIR)) $(CPPFLAGS) $(CFLAGS) -c $$< -o $$@ + $(Q) $(CCACHE) $(AS) $(addprefix -I,$(INCDIR)) $(CPPFLAGS) $(CFLAGS) -c $$< -o $$@ endif ifneq (,$(filter $1/%.S,$(SOURCE_FILES))) $2%.o: $1/%.S $(vecho) "AS $$<" - $(Q) $(AS) $(addprefix -I,$(INCDIR)) $(CPPFLAGS) $(CFLAGS) -c $$< -o $$@ + $(Q) $(CCACHE) $(AS) $(addprefix -I,$(INCDIR)) $(CPPFLAGS) $(CFLAGS) -c $$< -o $$@ endif ifneq (,$(filter $1/%.c,$(SOURCE_FILES))) ifdef CLANG_TIDY @@ -140,12 +138,10 @@ $2%.o: $1/%.c $(vecho) "TIDY $$<" $(Q) $(CLANG_TIDY) $$< -- $(addprefix -I,$(INCDIR)) $(CPPFLAGS) $(CFLAGS) $(CLANG_FLAG_EXTRA) else -$2%.o: $1/%.c $2%.c.d +$2%.o: $1/%.c $(vecho) "CC $$<" - $(Q) $(CC) $(addprefix -I,$(INCDIR)) $(CPPFLAGS) $(CFLAGS) -c $$< -o $$@ -$2%.c.d: $1/%.c - $(Q) $(CC) $(addprefix -I,$(INCDIR)) $(CPPFLAGS) $(CFLAGS) -MM -MT $2$$*.o $$< $(OUTPUT_DEPS) -.PRECIOUS: $2%.c.d + $(Q) $(CCACHE) $(CC) $(addprefix -I,$(INCDIR)) $(CPPFLAGS) $(CFLAGS) -c $$< -o $$@ -MMD -MF $${@:.o=.c.d} +-include $2%.c.d endif endif ifneq (,$(filter $1/%.cpp,$(SOURCE_FILES))) @@ -154,12 +150,10 @@ $2%.o: $1/%.cpp $(vecho) "TIDY $$<" $(Q) $(CLANG_TIDY) $$< -- $(addprefix -I,$(INCDIR)) $(CPPFLAGS) $(CXXFLAGS) $(CLANG_FLAG_EXTRA) else -$2%.o: $1/%.cpp $2%.cpp.d +$2%.o: $1/%.cpp $(vecho) "C+ $$<" - $(Q) $(CXX) $(addprefix -I,$(INCDIR)) $(CPPFLAGS) $(CXXFLAGS) -c $$< -o $$@ -$2%.cpp.d: $1/%.cpp - $(Q) $(CXX) $(addprefix -I,$(INCDIR)) $(CPPFLAGS) $(CXXFLAGS) -MM -MT $2$$*.o $$< $(OUTPUT_DEPS) -.PRECIOUS: $2%.cpp.d + $(Q) $(CCACHE) $(CXX) $(addprefix -I,$(INCDIR)) $(CPPFLAGS) $(CXXFLAGS) -c $$< -o $$@ -MMD -MF $${@:.o=.cpp.d} +-include $2%.cpp.d endif endif endef diff --git a/Tools/boardtool.py b/Tools/boardtool.py index 65767b0ebe..951c828d8e 100644 --- a/Tools/boardtool.py +++ b/Tools/boardtool.py @@ -221,7 +221,7 @@ def addSignal(e, f): def parse_peripherals(self, spec): for name_spec, periphdef in spec.items(): - p = re.compile('\[([0-9]+)-([0-9]+)\]') + p = re.compile(r'\[([0-9]+)-([0-9]+)\]') matches = p.findall(name_spec) if len(matches) == 0: indexRange = range(-1, 0) diff --git a/Tools/ci/clean-tools.py b/Tools/ci/clean-tools.py new file mode 100644 index 0000000000..1654b37b50 --- /dev/null +++ b/Tools/ci/clean-tools.py @@ -0,0 +1,174 @@ +#!/usr/bin/env python + +import os +import re +import shutil +import argparse + +# The commented-out ARC paths below are for regular libraries with RTTI. +# These are used by default without the -fno-rtti switch so without them the cmake +# compiler check fails. Otherwise they can go. +TOOLS = r'esp32/tools/' +IDF = r'esp-idf([^/]+)/' +ARC = r'([^/]+)\.a' +FILTERS = [ + # Leave versioned directory to avoid re-installation + rf'{TOOLS}.*esp-elf-gdb/.*/.*esp-elf-gdb/', + rf'{TOOLS}esp32ulp-elf/.*/esp32ulp-elf/', + rf'{TOOLS}openocd-esp32/.*/openocd-esp32/', + # Libraries not required by Sming + # rf'{TOOLS}.*/riscv32-esp-elf/lib/{ARC}', + rf'{TOOLS}.*/riscv32-esp-elf/lib/rv32i_.*', + rf'{TOOLS}.*/riscv32-esp-elf/lib/rv32i/', + rf'{TOOLS}.*/riscv32-esp-elf/lib/rv32imac_.*', + rf'{TOOLS}.*/riscv32-esp-elf/lib/rv32imafc_.*', + rf'{TOOLS}.*/riscv32-esp-elf/lib/rv32imafc/', + # rf'{TOOLS}.*/riscv32-esp-elf/lib/rv32imc_zicsr_zifencei/ilp32/{ARC}', + # rf'{TOOLS}.*/riscv32-esp-elf/lib/rv32imc/ilp32/{ARC}', + # rf'{TOOLS}.*/lib/esp32/{ARC}', + rf'{TOOLS}.*/lib/esp32-psram', + rf'{TOOLS}.*/lib/esp32/psram', + # rf'{TOOLS}.*/lib/esp32s2/{ARC}', + # rf'{TOOLS}.*/lib/esp32s3/{ARC}', + # rf'{TOOLS}.*/xtensa-esp32-elf/lib/{ARC}', + # rf'{TOOLS}.*/xtensa-esp32s2-elf/lib/{ARC}', + # rf'{TOOLS}.*/xtensa-esp32s3-elf/lib/{ARC}', + # rf'{TOOLS}.*/xtensa-esp-elf/lib/{ARC}', + # Components, examples and archives + rf'{IDF}docs/', + rf'{IDF}examples/', + rf'{IDF}components/cmock/', + rf'{IDF}components/unity/', + rf'{IDF}.*esp32c6.*', + rf'{IDF}.*esp32h2.*', + rf'{IDF}.*esp32p4.*', + rf'{IDF}.*/tests', +] + +# Python 3.8 doesn't have str.removeprefix +def removeprefix(path: str, prefix: str) -> str: + return path[len(prefix):] if path.startswith(prefix) else path + + +def scan_log(logfile: str, file_list: dict): + with open(logfile, 'r') as f: + for path in f: + path = path.strip() + try: + path, _, blocks = path.rpartition(' ') + path, _, size = path.rpartition(' ') + blocks = int(blocks) + size = int(size) + if path[1] == ':': + path = path[2:].replace('\\', '/') + path = removeprefix(path, '/opt/') + if not path.startswith('esp'): + continue + existing = file_list.get(path) + if not existing or size > existing: + file_list[path] = size + except: + print(path) + raise + +def scan_logs(log_dir) -> dict: + file_list = {} + + for dirpath, _, filenames in os.walk(log_dir): + for logfile in [os.path.join(dirpath, f) for f in filenames]: + scan_log(logfile, file_list) + return file_list + + +def scan_tools_dir(tools_dir) -> dict: + file_list = {} + def scan(root_path): + for entry in os.scandir(root_path): + if entry.is_dir(): + scan(entry.path) + continue + path = entry.path + path = removeprefix(path, tools_dir + '/') + if not path.startswith('esp'): + continue + path = path.replace('\\', '/') + file_list[path] = entry.stat().st_size + scan(tools_dir) + return file_list + + +def scan_list(file_list: dict): + def mbstr(size) -> str: + mb = size / (1024*1024) + return f'{mb:0.2f} MB' + + total_size = sum(size for _, size in file_list.items()) + + print(f'{len(file_list)} files, total size {mbstr(total_size)}') + + total_size = 0 + for flt in FILTERS: + expr = re.compile(flt) + size = sum(size for path, size in file_list.items() if expr.match(path)) + total_size += size + print(f'{flt}: {mbstr(size)}') + + print(f'Total size {mbstr(total_size)}') + + +def clean_tools_dir(tools_dir: str, do_clean: bool): + re_filter = re.compile('|'.join(FILTERS)) + + def clean_path(root_path): + for entry in os.scandir(root_path): + try: + path = entry.path + path = path.replace('\\', '/') + path = removeprefix(path, tools_dir.replace('\\', '/') + '/') + if entry.is_dir(): + if re_filter.match(path + '/'): + print(f"rmtree {entry.path}") + if do_clean: + shutil.rmtree(entry.path) + else: + clean_path(entry.path) + elif re_filter.match(path): + print(f"rm {entry.path}") + if do_clean: + os.unlink(entry.path) + except Exception as e: + print(f'{repr(e)}') + + clean_path(tools_dir) + + +def main(): + parser = argparse.ArgumentParser(description='Sming CI tool cleaner') + parser.add_argument('action', choices=['scan', 'clean'], help='Action to perform') + parser.add_argument('--logdir', help='Scan downloaded log files instead of actual path') + parser.add_argument('--delete', action="store_true", help='Required flag to actually delete') + + args = parser.parse_args() + + tools_dir = os.path.dirname(os.environ['IDF_PATH']) + + print(f'Action: {args.action} "{tools_dir}"') + + if args.action == 'scan': + if args.logdir: + file_list = scan_logs(args.logdir) + else: + file_list = scan_tools_dir(tools_dir) + scan_list(file_list) + elif args.action == 'clean': + if not os.path.exists(tools_dir): + print(f'"{tools_dir}" not found, skipping.') + return + clean_tools_dir(tools_dir, args.delete) + if args.delete: + print("OK, items cleaned.") + else: + print("Dry run, nothing deleted.") + +if __name__ == '__main__': + main() diff --git a/Tools/ci/install.cmd b/Tools/ci/install.cmd index 0328612268..7fe9f022a2 100644 --- a/Tools/ci/install.cmd +++ b/Tools/ci/install.cmd @@ -8,6 +8,6 @@ if "%BUILD_DOCS%" == "true" ( set INSTALL_OPTS=doc ) -choco install ninja +call %CI_BUILD_DIR%\Tools\install.cmd %SMING_ARCH% %INSTALL_OPTS% -%SMING_HOME%\..\Tools\install.cmd %SMING_ARCH% %INSTALL_OPTS% +python "%CI_BUILD_DIR%\Tools\ci\clean-tools.py" clean --delete diff --git a/Tools/ci/install.sh b/Tools/ci/install.sh index d512d5bcd8..0cb02170cb 100755 --- a/Tools/ci/install.sh +++ b/Tools/ci/install.sh @@ -11,15 +11,17 @@ set -ex if [ -z "$SMING_TOOLS_PREINSTALLED" ]; then -if [ "$BUILD_DOCS" = "true" ]; then - INSTALL_OPTS="doc" -else - INSTALL_OPTS="fonts optional" +INSTALL_OPTS=(fonts) +if [ "$SMING_ARCH" = "Host" ]; then + INSTALL_OPTS+=(optional) fi # Ensure default path is writeable sudo chown "$USER" /opt -"$SMING_HOME/../Tools/install.sh" $SMING_ARCH $INSTALL_OPTS +"$CI_BUILD_DIR/Tools/install.sh" "$SMING_ARCH" "${INSTALL_OPTS[@]}" fi + +source "$CI_BUILD_DIR/Tools/export.sh" +python "$CI_BUILD_DIR/Tools/ci/clean-tools.py" clean --delete diff --git a/Tools/ide/vscode/setup.py b/Tools/ide/vscode/setup.py index ea33276c5f..ab9a90220c 100644 --- a/Tools/ide/vscode/setup.py +++ b/Tools/ide/vscode/setup.py @@ -138,7 +138,7 @@ def main(): sys.exit(1) # So we can find rjsmin.py - sys.path.append(os.path.join(env['SMING_HOME'], '../Tools/Python')) + sys.path.insert(1, os.path.expandvars('${SMING_HOME}/../Tools/Python')) update_intellisense() update_tasks() diff --git a/Tools/install.cmd b/Tools/install.cmd index bf6b93fb7e..f5e6aad946 100644 --- a/Tools/install.cmd +++ b/Tools/install.cmd @@ -18,6 +18,10 @@ echo ** Installing common python requirements echo. python -m pip install --upgrade pip -r %SMING_HOME%\..\Tools\requirements.txt +choco install ninja ccache + +if exist "C:\MinGW\bin" goto :mingw_installed + echo. echo. echo ** Installing MinGW @@ -26,7 +30,15 @@ rmdir /s /q c:\MinGW curl -Lo %DOWNLOADS%\MinGW.7z %SMINGTOOLS%/MinGW-2020-10-19.7z 7z -oC:\ x %DOWNLOADS%\MinGW.7z +goto :install + +:mingw_installed +echo. +echo ** MinGW found, not re-installing +echo. + :install + if "%1" == "" goto :EOF if "%1" == "all" ( call :install Host Esp8266 Esp32 Rp2040 diff --git a/Tools/install.sh b/Tools/install.sh index 05e13806c6..4b85fd5dd1 100755 --- a/Tools/install.sh +++ b/Tools/install.sh @@ -125,6 +125,7 @@ case $DIST in fi sudo apt-get -y update || echo "Update failed... Try to install anyway..." $PKG_INSTALL \ + ccache \ cmake \ curl \ git \ @@ -154,6 +155,7 @@ case $DIST in ;; esac $PKG_INSTALL \ + ccache \ cmake \ gawk \ gcc \ @@ -172,6 +174,7 @@ case $DIST in darwin) $PKG_INSTALL \ + ccache \ binutils \ coreutils \ gnu-sed \ diff --git a/samples/LiveDebug/app/application.cpp b/samples/LiveDebug/app/application.cpp index 918b849ca0..108ff73fa0 100644 --- a/samples/LiveDebug/app/application.cpp +++ b/samples/LiveDebug/app/application.cpp @@ -132,6 +132,7 @@ void onDataReceived(Stream& source, char arrivedChar, unsigned short availableCh commandBuffer.clear(); } showPrompt(); + break; } default: break; @@ -216,6 +217,7 @@ void asyncReadCallback(const GdbSyscallInfo& info) Serial << _F("readFileAsync: total = ") << transfer.total << _F(", elapsed = ") << elapsed << _F(" ms, av. ") << bps << _F(" bytes/sec") << endl; readConsole(); + break; } default:;