From 6ffe0ba1aba67b928f1fc839cce2bfbe8ebeb7e0 Mon Sep 17 00:00:00 2001 From: Nikhil Dabas Date: Sat, 10 Aug 2024 14:41:00 +0100 Subject: [PATCH 01/17] Add support for SDK v2.0.0 --- .gitignore | 1 + build.ps1 | 13 ++--- config/repositories.json | 12 ++--- packages/openocd/build-openocd.sh | 2 +- .../pico-sdk-tools-config.cmake | 4 +- packages/pico-setup-windows/pico-env.cmd | 6 ++- packages/picotool/build-picotool.sh | 51 ++++++++----------- 7 files changed, 41 insertions(+), 48 deletions(-) diff --git a/.gitignore b/.gitignore index ac2898b..d7e0e50 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ bin/ # Builds/staging build/ +build-*/ diff --git a/build.ps1 b/build.ps1 index 95e7c74..9748ed2 100644 --- a/build.ps1 +++ b/build.ps1 @@ -139,7 +139,7 @@ if (Test-Path .\build\python\python.exe) { } # Clone additional Pico-specific submodules in TinyUSB -exec { git -C .\build\pico-sdk\lib\tinyusb submodule update --init --depth=1 hw\mcu\raspberry_pi } +# exec { git -C .\build\pico-sdk\lib\tinyusb submodule update --init --depth=1 hw\mcu\raspberry_pi } $sdkVersion = (cmake -P .\packages\pico-setup-windows\pico-sdk-version.cmake -N | Select-String -Pattern 'PICO_SDK_VERSION_STRING=(.*)$').Matches.Groups[1].Value if (-not ($sdkVersion -match $versionRegEx)) { @@ -555,12 +555,9 @@ Section "-Pico environment" SecPico File /r "build\pico-sdk\*.*" SetOutPath "`$INSTDIR\pico-sdk-tools" - File "build\pico-sdk-tools\mingw$bitness\*.*" + File /r "build\pico-sdk-tools\mingw$bitness\*.*" WriteRegStr `${PICO_REG_ROOT} "Software\Kitware\CMake\Packages\pico-sdk-tools" "v$sdkVersion" "`$INSTDIR\pico-sdk-tools" - SetOutPath "`$INSTDIR\picotool" - File "build\picotool-install\mingw$bitness\*.*" - SetOutPath "`$INSTDIR" File "build\pico-examples.zip" WriteINIStr "`$INSTDIR\version.ini" "pico-setup-windows" "PICO_SDK_VERSION" "$sdkVersion" @@ -654,9 +651,9 @@ $env:__COMPAT_LAYER = "" # Sign files before packaging up the installer sign "build\uninstall-$suffix.exe", "build\openocd-install\mingw$bitness\bin\openocd.exe", -"build\pico-sdk-tools\mingw$bitness\elf2uf2.exe", -"build\pico-sdk-tools\mingw$bitness\pioasm.exe", -"build\picotool-install\mingw$bitness\picotool.exe" +"build\pico-sdk-tools\mingw$bitness\elf2uf2\elf2uf2.exe", +"build\pico-sdk-tools\mingw$bitness\pioasm\pioasm.exe", +"build\pico-sdk-tools\mingw$bitness\picotool\picotool.exe" exec { .\build\NSIS\makensis ".\$basename-$suffix.nsi" } Write-Host "Installer saved to $binfile" diff --git a/config/repositories.json b/config/repositories.json index b67c008..a4eb55c 100644 --- a/config/repositories.json +++ b/config/repositories.json @@ -2,28 +2,28 @@ "repositories": [ { "href": "https://github.com/raspberrypi/pico-sdk.git", - "tree": "1.5.1", + "tree": "2.0.0", "submodules": true }, { "href": "https://github.com/raspberrypi/pico-examples.git", - "tree": "sdk-1.5.1" + "tree": "sdk-2.0.0" }, { "href": "https://github.com/raspberrypi/pico-extras.git", - "tree": "sdk-1.5.1" + "tree": "sdk-2.0.0" }, { "href": "https://github.com/raspberrypi/pico-playground.git", - "tree": "sdk-1.5.1" + "tree": "sdk-2.0.0" }, { "href": "https://github.com/raspberrypi/picotool.git", - "tree": "1.1.2" + "tree": "2.0.0" }, { "href": "https://github.com/raspberrypi/openocd.git", - "tree": "rp2040-v0.12.0" + "tree": "sdk-2.0.0" } ] } diff --git a/packages/openocd/build-openocd.sh b/packages/openocd/build-openocd.sh index 328c58d..8cf952f 100644 --- a/packages/openocd/build-openocd.sh +++ b/packages/openocd/build-openocd.sh @@ -7,7 +7,7 @@ ARCH=$2 cd openocd ./bootstrap -./configure +./configure --disable-werror CFLAGS="-Duint=uint32_t" make clean make -j4 DESTDIR="$PWD/../openocd-install" make install diff --git a/packages/pico-sdk-tools/pico-sdk-tools-config.cmake b/packages/pico-sdk-tools/pico-sdk-tools-config.cmake index 34febfb..5a8bda6 100644 --- a/packages/pico-sdk-tools/pico-sdk-tools-config.cmake +++ b/packages/pico-sdk-tools/pico-sdk-tools-config.cmake @@ -1,5 +1,5 @@ set(Pioasm_TARGET Pioasm) -set(Pioasm_EXECUTABLE ${pico-sdk-tools_DIR}/pioasm.exe) +set(Pioasm_EXECUTABLE ${pico-sdk-tools_DIR}/pioasm/pioasm.exe) if(NOT TARGET ${Pioasm_TARGET}) add_executable(${Pioasm_TARGET} IMPORTED) endif() @@ -7,7 +7,7 @@ set_property(TARGET ${Pioasm_TARGET} PROPERTY IMPORTED_LOCATION ${Pioasm_EXECUTA set(Pioasm_FOUND 1) set(ELF2UF2_TARGET ELF2UF2) -set(ELF2UF2_EXECUTABLE ${pico-sdk-tools_DIR}/elf2uf2.exe) +set(ELF2UF2_EXECUTABLE ${pico-sdk-tools_DIR}/elf2uf2/elf2uf2.exe) if(NOT TARGET ${ELF2UF2_TARGET}) add_executable(${ELF2UF2_TARGET} IMPORTED) endif() diff --git a/packages/pico-setup-windows/pico-env.cmd b/packages/pico-setup-windows/pico-env.cmd index 5f983ce..8089056 100644 --- a/packages/pico-setup-windows/pico-env.cmd +++ b/packages/pico-setup-windows/pico-env.cmd @@ -86,7 +86,11 @@ call :AddToPath "%PICO_INSTALL_PATH%\ninja" call :AddToPath "%PICO_INSTALL_PATH%\python" call :AddToPath "%PICO_INSTALL_PATH%\git\cmd" call :AddToPath "%PICO_INSTALL_PATH%\pico-sdk-tools" -call :AddToPath "%PICO_INSTALL_PATH%\picotool" +call :AddToPath "%PICO_INSTALL_PATH%\pico-sdk-tools\elf2uf2" +call :AddToPath "%PICO_INSTALL_PATH%\pico-sdk-tools\pioasm" +call :AddToPath "%PICO_INSTALL_PATH%\pico-sdk-tools\picotool" + +set "PICO_ARM_TOOLCHAIN_PATH=%PICO_INSTALL_PATH%\gcc-arm-none-eabi\bin" call :VerifyExe "GNU Arm Embedded Toolchain" "arm-none-eabi-gcc --version" call :VerifyExe "CMake" "cmake --version" diff --git a/packages/picotool/build-picotool.sh b/packages/picotool/build-picotool.sh index b1e9472..30dd247 100644 --- a/packages/picotool/build-picotool.sh +++ b/packages/picotool/build-picotool.sh @@ -4,37 +4,28 @@ set -euo pipefail BITNESS=$1 ARCH=$2 +INSTALLDIR="pico-sdk-tools/mingw$BITNESS" export PICO_SDK_PATH="$PWD/pico-sdk" export LDFLAGS="-static -static-libgcc -static-libstdc++" -cd pico-sdk/tools/elf2uf2 -mkdir -p build -cd build -cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release -Wno-dev -cmake --build . - -cd ../../pioasm -mkdir -p build -cd build -cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release -Wno-dev -cmake --build . - -cd ../../../.. -INSTALLDIR="pico-sdk-tools/mingw$BITNESS" -mkdir -p $INSTALLDIR -cp pico-sdk/tools/elf2uf2/build/elf2uf2.exe $INSTALLDIR -cp pico-sdk/tools/pioasm/build/pioasm.exe $INSTALLDIR -cp ../packages/pico-sdk-tools/pico-sdk-tools-config.cmake $INSTALLDIR - -cd picotool -mkdir -p build -cd build -cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release -cmake --build . - -cd ../.. -INSTALLDIR="picotool-install/mingw$BITNESS" -mkdir -p $INSTALLDIR -cp picotool/build/picotool.exe $INSTALLDIR -cp "/mingw$BITNESS/bin/libusb-1.0.dll" $INSTALLDIR +build-tool () { + SRCDIR="$1" + TOOLDIR="$INSTALLDIR/$(basename "$SRCDIR")" + shift 1 + pushd "$SRCDIR" + mkdir -p build + cd build + cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release "$@" + cmake --build . + popd + mkdir -p "$TOOLDIR" + cmake --install "$SRCDIR/build" --prefix "$INSTALLDIR" || cp "$SRCDIR/build/*.exe" "$TOOLDIR" +} + +[ -d pico-sdk/tools/elf2uf2 ] && build-tool pico-sdk/tools/elf2uf2 -Wno-dev +build-tool pico-sdk/tools/pioasm -DPIOASM_FLAT_INSTALL=1 -Wno-dev +cp ../packages/pico-sdk-tools/pico-sdk-tools-config.cmake "$INSTALLDIR" + +build-tool picotool -DPICOTOOL_FLAT_INSTALL=1 +cp "/mingw$BITNESS/bin/libusb-1.0.dll" "$INSTALLDIR/picotool" From b88d97c830784106c5a8475257af3231dd0d937d Mon Sep 17 00:00:00 2001 From: Nikhil Dabas Date: Sat, 10 Aug 2024 15:02:46 +0100 Subject: [PATCH 02/17] Remove x86 build --- .github/workflows/build.yml | 2 +- config/x86.json | 34 ---------------------------------- update.ps1 | 2 +- 3 files changed, 2 insertions(+), 36 deletions(-) delete mode 100644 config/x86.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 370ea4f..dcf92ee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,7 +41,7 @@ jobs: strategy: fail-fast: false matrix: - config: [x86, x64, x64-standalone] + config: [x64, x64-standalone] build-type: [system] include: - { config: x64-standalone, build-type: user } diff --git a/config/x86.json b/config/x86.json deleted file mode 100644 index 6205066..0000000 --- a/config/x86.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "bitness": 32, - "mingwArch": "i686", - "componentSelection": true, - "downloads": [ - { - "name": "GNU Arm Embedded Toolchain", - "file": "gcc-arm-none-eabi-10.3-2021.10-win32.exe", - "exec": "\"$0\" /S /P /R", - "href": "https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-win32.exe?rev=29bb46cfa0434fbda93abb33c1d480e6&hash=3C58D05EA5D32EF127B9E4D13B3244D26188713C" - }, - { - "name": "CMake", - "file": "cmake-3.25.2-windows-i386.msi", - "exec": "msiexec /i \"$0\" /qn /norestart ADD_CMAKE_TO_PATH=System", - "href": "https://github.com/Kitware/CMake/releases/download/v3.25.2/cmake-3.25.2-windows-i386.msi" - }, - { - "name": "Python 3.9", - "file": "python-3.9.13.exe", - "exec": "\"$0\" /quiet InstallAllUsers=1 PrependPath=1", - "href": "https://www.python.org/ftp/python/3.9.13/python-3.9.13.exe" - }, - { - "name": "Git for Windows", - "file": "Git-2.39.1-32-bit.exe", - "exec": "\"$0\" /VERYSILENT /NORESTART /NOCANCEL /SP- /CLOSEAPPLICATIONS /RESTARTAPPLICATIONS /SKIPDOWNGRADE=1 \"/LOADINF=$PLUGINSDIR\\git.inf\"", - "href": "https://github.com/git-for-windows/git/releases/download/v2.39.1.windows.1/Git-2.39.1-32-bit.exe", - "additionalFiles": [ - "packages\\pico-setup-windows\\git.inf" - ] - } - ] -} diff --git a/update.ps1 b/update.ps1 index 5b38ef4..73b5dbf 100644 --- a/update.ps1 +++ b/update.ps1 @@ -109,7 +109,7 @@ function updateDownloadUrl { } } -foreach ($arch in @('x86.json', 'x64.json', 'x64-standalone.json')) { +foreach ($arch in @('x64.json', 'x64-standalone.json')) { $config = Get-Content ".\config\$arch" | ConvertFrom-Json foreach ($i in $config.downloads) { From a3b0d603100ebbe729e9a4c9566f233f3d7ed41f Mon Sep 17 00:00:00 2001 From: Nikhil Dabas Date: Sun, 11 Aug 2024 16:46:13 +0100 Subject: [PATCH 03/17] Update packages --- README.md | 2 +- config/tools.json | 10 +++++----- config/x64-standalone.json | 18 +++++++++--------- config/x64.json | 18 +++++++++--------- update.ps1 | 4 ++-- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 3cf2f81..83d2406 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The rest of this README document is about developing the installer itself. If yo - [Arm GNU Toolchain](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads) - [CMake](https://cmake.org/download/) - [Ninja](https://github.com/ninja-build/ninja/releases) -- [Python 3.9](https://www.python.org/downloads/windows/) +- [Python 3.12](https://www.python.org/downloads/windows/) - [Git for Windows](https://git-scm.com/download/win) - [Visual Studio Code](https://code.visualstudio.com/) - [OpenOCD](https://github.com/openocd-org/openocd/) diff --git a/config/tools.json b/config/tools.json index ffc3e5f..87d3323 100644 --- a/config/tools.json +++ b/config/tools.json @@ -2,20 +2,20 @@ "tools": [ { "name": "NSIS", - "file": "nsis-3.08.zip", - "href": "https://sourceforge.net/projects/nsis/files/NSIS%203/3.08/nsis-3.08.zip/download", + "file": "nsis-3.10.zip", + "href": "https://sourceforge.net/projects/nsis/files/NSIS%203/3.10/nsis-3.10.zip/download", "dirName": "NSIS", "extractStrip": 1 }, { "name": "MSYS2", "file": "msys2.exe", - "href": "https://github.com/msys2/msys2-installer/releases/download/2023-01-27/msys2-base-x86_64-20230127.sfx.exe" + "href": "https://github.com/msys2/msys2-installer/releases/download/2024-07-27/msys2-base-x86_64-20240727.sfx.exe" }, { "name": "pandoc", - "file": "pandoc-3.1-windows-x86_64.zip", - "href": "https://github.com/jgm/pandoc/releases/download/3.1/pandoc-3.1-windows-x86_64.zip", + "file": "pandoc-3.3-windows-x86_64.zip", + "href": "https://github.com/jgm/pandoc/releases/download/3.3/pandoc-3.3-windows-x86_64.zip", "dirName": "pandoc", "extractStrip": 1 }, diff --git a/config/x64-standalone.json b/config/x64-standalone.json index 86e563e..b5c374a 100644 --- a/config/x64-standalone.json +++ b/config/x64-standalone.json @@ -5,33 +5,33 @@ { "name": "GNU Arm Embedded Toolchain", "file": "gcc-arm-none-eabi-10.3-2021.10-win32.zip", - "href": "https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-win32.zip?rev=8f4a92e2ec2040f89912f372a55d8cf3&hash=8A9EAF77EF1957B779C59EADDBF2DAC118170BBF", + "href": "https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-win32.zip?rev=8f4a92e2ec2040f89912f372a55d8cf3&hash=5569B4C322E49BB400BFB63567A4B33B", "dirName": "gcc-arm-none-eabi", "extractStrip": 1 }, { "name": "CMake", - "file": "cmake-3.25.2-windows-x86_64.zip", - "href": "https://github.com/Kitware/CMake/releases/download/v3.25.2/cmake-3.25.2-windows-x86_64.zip", + "file": "cmake-3.30.2-windows-x86_64.zip", + "href": "https://github.com/Kitware/CMake/releases/download/v3.30.2/cmake-3.30.2-windows-x86_64.zip", "dirName": "cmake", "extractStrip": 1 }, { "name": "Ninja", "file": "ninja-win.zip", - "href": "https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-win.zip", + "href": "https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-win.zip", "dirName": "ninja" }, { - "name": "Python 3.9", - "file": "python-3.9.13-embed-amd64.zip", - "href": "https://www.python.org/ftp/python/3.9.13/python-3.9.13-embed-amd64.zip", + "name": "Python 3.12", + "file": "python-3.12.5-embed-amd64.zip", + "href": "https://www.python.org/ftp/python/3.12.5/python-3.12.5-embed-amd64.zip", "dirName": "python" }, { "name": "Git for Windows", - "file": "MinGit-2.39.1-64-bit.zip", - "href": "https://github.com/git-for-windows/git/releases/download/v2.39.1.windows.1/MinGit-2.39.1-64-bit.zip", + "file": "MinGit-2.46.0-64-bit.zip", + "href": "https://github.com/git-for-windows/git/releases/download/v2.46.0.windows.1/MinGit-2.46.0-64-bit.zip", "dirName": "git" } ] diff --git a/config/x64.json b/config/x64.json index 3540d7c..3dfcf38 100644 --- a/config/x64.json +++ b/config/x64.json @@ -7,31 +7,31 @@ "name": "GNU Arm Embedded Toolchain", "file": "gcc-arm-none-eabi-10.3-2021.10-win32.exe", "exec": "\"$0\" /S /P /R", - "href": "https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-win32.exe?rev=29bb46cfa0434fbda93abb33c1d480e6&hash=3C58D05EA5D32EF127B9E4D13B3244D26188713C" + "href": "https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-win32.exe?rev=29bb46cfa0434fbda93abb33c1d480e6&hash=B2C5AAE07841929A0D0BF460896D6E52" }, { "name": "CMake", - "file": "cmake-3.25.2-windows-x86_64.msi", + "file": "cmake-3.30.2-windows-x86_64.msi", "exec": "msiexec /i \"$0\" /qn /norestart ADD_CMAKE_TO_PATH=System", - "href": "https://github.com/Kitware/CMake/releases/download/v3.25.2/cmake-3.25.2-windows-x86_64.msi" + "href": "https://github.com/Kitware/CMake/releases/download/v3.30.2/cmake-3.30.2-windows-x86_64.msi" }, { "name": "Ninja", "file": "ninja-win.zip", - "href": "https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-win.zip", + "href": "https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-win.zip", "dirName": "ninja" }, { - "name": "Python 3.9", - "file": "python-3.9.13-amd64.exe", + "name": "Python 3.12", + "file": "python-3.12.5-amd64.exe", "exec": "\"$0\" /quiet InstallAllUsers=1 PrependPath=1", - "href": "https://www.python.org/ftp/python/3.9.13/python-3.9.13-amd64.exe" + "href": "https://www.python.org/ftp/python/3.12.5/python-3.12.5-amd64.exe" }, { "name": "Git for Windows", - "file": "Git-2.39.1-64-bit.exe", + "file": "Git-2.46.0-64-bit.exe", "exec": "\"$0\" /VERYSILENT /NORESTART /NOCANCEL /SP- /CLOSEAPPLICATIONS /RESTARTAPPLICATIONS /SKIPDOWNGRADE=1 \"/LOADINF=$PLUGINSDIR\\git.inf\"", - "href": "https://github.com/git-for-windows/git/releases/download/v2.39.1.windows.1/Git-2.39.1-64-bit.exe", + "href": "https://github.com/git-for-windows/git/releases/download/v2.46.0.windows.1/Git-2.46.0-64-bit.exe", "additionalFiles": [ "packages\\pico-setup-windows\\git.inf" ] diff --git a/update.ps1 b/update.ps1 index 73b5dbf..7d862ef 100644 --- a/update.ps1 +++ b/update.ps1 @@ -53,7 +53,7 @@ function updateDownloadUrl { getGitHubReleaseAssetUrl 'ninja-build/ninja' { $_.name -eq 'ninja-win.zip' } } - 'Python 3.9' { + 'Python 3.12' { $suffix = '' if ($Download.file -match '\.exe$') { @@ -63,7 +63,7 @@ function updateDownloadUrl { } crawl 'https://www.python.org/downloads/windows/' | - Where-Object { $_ -match "python-3\.9\.[0-9]+$suffix`$" } | + Where-Object { $_ -match "python-3\.12\.[0-9]+$suffix`$" } | Select-Object -First 1 } From 5040fee193644392c8c88c83f352891bd3efe716 Mon Sep 17 00:00:00 2001 From: Nikhil Dabas Date: Mon, 12 Aug 2024 20:26:45 +0100 Subject: [PATCH 04/17] Remove COMSPEC Fixes https://github.com/raspberrypi/pico-setup-windows/issues/36 --- packages/pico-setup-windows/pico-env.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pico-setup-windows/pico-env.ps1 b/packages/pico-setup-windows/pico-env.ps1 index 96df2c9..ad1e739 100644 --- a/packages/pico-setup-windows/pico-env.ps1 +++ b/packages/pico-setup-windows/pico-env.ps1 @@ -3,7 +3,7 @@ $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' # https://github.com/microsoft/vswhere/wiki/Start-Developer-Command-Prompt#using-powershell -& "${env:COMSPEC}" /s /c "`"$PSScriptRoot\pico-env.cmd`" && set" | ForEach-Object { +cmd.exe /s /c "`"$PSScriptRoot\pico-env.cmd`" && set" | ForEach-Object { $name, $value = $_ -split '=', 2 Set-Content env:\"$name" $value } From 3adab5967b6d79e13607ba7d2794d3a8858e4b01 Mon Sep 17 00:00:00 2001 From: Nikhil Dabas Date: Mon, 12 Aug 2024 21:07:46 +0100 Subject: [PATCH 05/17] Update VS Code config --- .../pico-examples/ide/vscode/cmake-kits.json | 7 ---- .../pico-examples/ide/vscode/settings.json | 38 ++++++++----------- 2 files changed, 15 insertions(+), 30 deletions(-) delete mode 100644 packages/pico-examples/ide/vscode/cmake-kits.json diff --git a/packages/pico-examples/ide/vscode/cmake-kits.json b/packages/pico-examples/ide/vscode/cmake-kits.json deleted file mode 100644 index 33661c4..0000000 --- a/packages/pico-examples/ide/vscode/cmake-kits.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - { - "name": "Pico ARM GCC", - "description": "Pico SDK Toolchain with GCC arm-none-eabi", - "toolchainFile": "${env:PICO_SDK_PATH}/cmake/preload/toolchains/pico_arm_gcc.cmake" - } -] diff --git a/packages/pico-examples/ide/vscode/settings.json b/packages/pico-examples/ide/vscode/settings.json index 4551733..2449565 100644 --- a/packages/pico-examples/ide/vscode/settings.json +++ b/packages/pico-examples/ide/vscode/settings.json @@ -1,26 +1,18 @@ { - // These settings tweaks to the cmake plugin will ensure - // that you debug using cortex-debug instead of trying to launch - // a Pico binary on the host - "cmake.statusbar.advanced": { - "debug": { - "visibility": "hidden" + // These settings tweaks to the cmake plugin will ensure + // that you debug using cortex-debug instead of trying to launch + // a Pico binary on the host + "cmake.options.advanced": { + "launch": { + "statusBarVisibility": "hidden" + }, + "debug": { + "statusBarVisibility": "hidden" + } }, - "launch": { - "visibility": "hidden" - }, - "build": { - "visibility": "hidden" - }, - "buildTarget": { - "visibility": "hidden" - } - }, - "cmake.buildBeforeRun": true, - "cmake.configureOnOpen": true, - "cmake.configureSettings": { - "CMAKE_MODULE_PATH": "${env:PICO_INSTALL_PATH}/pico-sdk-tools" - }, - "cmake.generator": "Ninja", - "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools" + "cmake.buildBeforeRun": true, + "cmake.configureOnOpen": true, + "cmake.generator": "Ninja", + "cmake.configureSettings": { "PICO_BOARD": "pico" }, + "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools" } From 152169e91d7b7c03f94ad433183ae289790b7c05 Mon Sep 17 00:00:00 2001 From: Nikhil Dabas Date: Mon, 19 Aug 2024 14:22:40 +0100 Subject: [PATCH 06/17] pico_w httpd example builds again Fixed in https://github.com/raspberrypi/pico-sdk/pull/1841 --- config/repositories.json | 8 ++--- packages/pico-setup-windows/pico-setup.cmd | 18 +++++----- tests/pico-build.cmd | 38 +++++++++++++++++----- 3 files changed, 43 insertions(+), 21 deletions(-) diff --git a/config/repositories.json b/config/repositories.json index a4eb55c..9abd3b1 100644 --- a/config/repositories.json +++ b/config/repositories.json @@ -1,13 +1,13 @@ { "repositories": [ { - "href": "https://github.com/raspberrypi/pico-sdk.git", - "tree": "2.0.0", + "href": "https://github.com/ndabas/pico-sdk.git", + "tree": "2.0.0-0", "submodules": true }, { - "href": "https://github.com/raspberrypi/pico-examples.git", - "tree": "sdk-2.0.0" + "href": "https://github.com/ndabas/pico-examples.git", + "tree": "sdk-2.0.0-0" }, { "href": "https://github.com/raspberrypi/pico-extras.git", diff --git a/packages/pico-setup-windows/pico-setup.cmd b/packages/pico-setup-windows/pico-setup.cmd index 3dd0a2f..8c4686e 100644 --- a/packages/pico-setup-windows/pico-setup.cmd +++ b/packages/pico-setup-windows/pico-setup.cmd @@ -38,17 +38,19 @@ for %%i in (examples extras playground) do ( ) rem Build a couple of examples -mkdir "%PICO_REPOS_PATH%\pico-examples\build" -pushd "%PICO_REPOS_PATH%\pico-examples\build" -cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Debug --fresh || exit /b 1 +for %%j in (pico pico2) do ( + mkdir "%PICO_REPOS_PATH%\pico-examples\build-%%j" + pushd "%PICO_REPOS_PATH%\pico-examples\build-%%j" + cmake -G Ninja .. -DPICO_BOARD=%%j -DCMAKE_BUILD_TYPE=Debug --fresh || exit /b 1 + + for %%i in (blink "hello_world/all") do ( + echo Building %%i for %%j + ninja "%%i" || exit /b 1 + ) -for %%i in (blink "hello_world/all") do ( - echo Building %%i - ninja "%%i" || exit /b 1 + popd ) -popd - if "%interactive%" equ "1" ( rem Open repo folder in Explorer start . diff --git a/tests/pico-build.cmd b/tests/pico-build.cmd index 7f48d4d..5ab4635 100644 --- a/tests/pico-build.cmd +++ b/tests/pico-build.cmd @@ -1,5 +1,19 @@ @if not defined _echo echo off +goto main + +:test-build + + mkdir "%BUILD_DIR%" + pushd "%BUILD_DIR%" + cmake "%SRC_DIR%" -G Ninja -DCMAKE_BUILD_TYPE=Debug --fresh %* || exit /b 1 + cmake --build . || exit /b 1 + popd + + goto :EOF + +:main + call "%PICO_INSTALL_PATH%\pico-env.cmd" || exit /b 1 pushd "%PICO_REPOS_PATH%" @@ -10,15 +24,21 @@ popd subst P: "%PICO_REPOS_PATH%" || exit /b 1 -pushd "P:\pico-examples\build" -cmake -G Ninja .. -DPICO_BOARD=pico_w -DWIFI_SSID=ssid -DWIFI_PASSWORD=pass "-DFREERTOS_KERNEL_PATH=P:\FreeRTOS-Kernel" -DTEST_TCP_SERVER_IP=10.10.10.10 -DCMAKE_BUILD_TYPE=Debug --fresh || exit /b 1 -ninja --quiet || exit /b 1 -popd +set "SRC_DIR=P:\pico-examples" -mkdir "P:\pico-sdk-build" -pushd "P:\pico-sdk-build" -cmake "%PICO_SDK_PATH%" -G Ninja -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_BOARD=pico_w --fresh || exit /b 1 -ninja --quiet || exit /b 1 -popd +set "BUILD_DIR=P:\pico-examples\build-pico" +call :test-build -DPICO_BOARD=pico || exit /b 1 + +set "BUILD_DIR=P:\pico-examples\build-pico2" +call :test-build -DPICO_BOARD=pico2 || exit /b 1 + +rem call :test-build build-pico2-riscv -DPICO_BOARD=pico2 -DPICO_PLATFORM=rp2350-riscv || exit /b 1 + +set "BUILD_DIR=P:\pico-examples\build-pico_w" +call :test-build -DPICO_BOARD=pico_w -DWIFI_SSID=ssid -DWIFI_PASSWORD=pass "-DFREERTOS_KERNEL_PATH=P:\FreeRTOS-Kernel" -DTEST_TCP_SERVER_IP=10.10.10.10 || exit /b 1 + +set "SRC_DIR=%PICO_SDK_PATH%" +set "BUILD_DIR=P:\pico-sdk-build" +call :test-build -DPICO_SDK_TESTS_ENABLED=1 -DPICO_BOARD=pico_w || exit /b 1 subst P: /d From e221de2865e1f0af8edd28c9687e3d5127f7a35a Mon Sep 17 00:00:00 2001 From: Nikhil Dabas Date: Thu, 28 Nov 2024 14:04:13 +0000 Subject: [PATCH 07/17] Update actions --- .github/workflows/build.yml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dcf92ee..40f4e2a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,7 +7,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Test scripts shell: pwsh @@ -29,8 +29,7 @@ jobs: Invoke-Pester -Configuration $pesterConfig - name: Upload test results - uses: actions/upload-artifact@v2 - if: ${{ always() }} + uses: actions/upload-artifact@v4 with: name: Pester-Test-Results path: testResults.xml @@ -48,7 +47,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup MSYS2 uses: msys2/setup-msys2@v2 @@ -61,7 +60,7 @@ jobs: Add-Content -Path $env:GITHUB_ENV -Value "OPENOCD_BUILD_ID=openocd-$OpenOCDCommit-$Bitness" - name: Cache OpenOCD build - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: build/openocd-install key: ${{ env.OPENOCD_BUILD_ID }} @@ -76,7 +75,7 @@ jobs: .\build.ps1 .\config\${{ matrix.config }}.json -MSYS2Path (msys2 -c 'cygpath -m /').TrimEnd('\/') -SkipSigning -Compression zlib -BuildType ${{ matrix.build-type }} - name: Upload build artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Package-${{ matrix.config }}-${{ matrix.build-type }} path: bin/ @@ -95,10 +94,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Download installer artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: Package-${{ matrix.config }}-${{ matrix.build-type }} path: bin @@ -109,8 +108,7 @@ jobs: powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command "cd C:\repo; .\tests\setup.ps1" - name: Upload installer logs - uses: actions/upload-artifact@v2 - if: ${{ always() }} + uses: actions/upload-artifact@v4 with: name: Installer-Logs-Windows-${{ matrix.winver }}-${{ matrix.config }}-${{ matrix.build-type }} path: logs/ From e0afad917b5cdc2d31fab0cd4d4127e59e06ed8a Mon Sep 17 00:00:00 2001 From: Nikhil Dabas Date: Sat, 30 Nov 2024 20:55:23 +0000 Subject: [PATCH 08/17] Test riscv-gnu-toolchain build --- build.ps1 | 11 +++++++++-- config/repositories.json | 18 +++++++++++------- packages/riscv/build-riscv-gcc.sh | 18 ++++++++++++++++++ 3 files changed, 38 insertions(+), 9 deletions(-) create mode 100644 packages/riscv/build-riscv-gcc.sh diff --git a/build.ps1 b/build.ps1 index 9748ed2..f3ce8d4 100644 --- a/build.ps1 +++ b/build.ps1 @@ -189,6 +189,8 @@ function msys { $env:CHERE_INVOKING = 'yes' # Start MINGW32/64 environment $env:MSYSTEM = "MINGW$bitness" +# Use real symlinks +$env:MSYS = "winsymlinks:nativestrict" if (-not $SkipDownload) { # First run setup @@ -198,9 +200,14 @@ if (-not $SkipDownload) { # Normal update msys 'pacman --noconfirm -Suu' - msys "pacman -S --noconfirm --needed autoconf automake git libtool make pactoys pkg-config wget" + msys "pacman -S --noconfirm --needed autoconf automake base-devel expat git libtool pactoys patchutils pkg-config" + # pacboy adds MINGW_PACKAGE_PREFIX to package names suffixed with :p - msys "pacboy -S --noconfirm --needed cmake:p ninja:p toolchain:p libusb:p hidapi:p" + msys "pacboy -S --noconfirm --needed cmake:p ninja:p toolchain:p libusb:p hidapi:p libslirp:p" +} + +if (-not (Test-Path ".\build\riscv-install\mingw$bitness")) { + msys "cd build && ../packages/riscv/build-riscv-gcc.sh $bitness $mingw_arch" } if (-not (Test-Path ".\build\openocd-install\mingw$bitness")) { diff --git a/config/repositories.json b/config/repositories.json index 9abd3b1..41d9c96 100644 --- a/config/repositories.json +++ b/config/repositories.json @@ -1,29 +1,33 @@ { "repositories": [ { - "href": "https://github.com/ndabas/pico-sdk.git", - "tree": "2.0.0-0", + "href": "https://github.com/raspberrypi/pico-sdk.git", + "tree": "2.1.0", "submodules": true }, { - "href": "https://github.com/ndabas/pico-examples.git", - "tree": "sdk-2.0.0-0" + "href": "https://github.com/raspberrypi/pico-examples.git", + "tree": "sdk-2.1.0" }, { "href": "https://github.com/raspberrypi/pico-extras.git", - "tree": "sdk-2.0.0" + "tree": "sdk-2.1.0" }, { "href": "https://github.com/raspberrypi/pico-playground.git", - "tree": "sdk-2.0.0" + "tree": "sdk-2.1.0" }, { "href": "https://github.com/raspberrypi/picotool.git", - "tree": "2.0.0" + "tree": "2.1.0" }, { "href": "https://github.com/raspberrypi/openocd.git", "tree": "sdk-2.0.0" + }, + { + "href": "https://github.com/riscv/riscv-gnu-toolchain.git", + "tree": "master" } ] } diff --git a/packages/riscv/build-riscv-gcc.sh b/packages/riscv/build-riscv-gcc.sh new file mode 100644 index 0000000..1dd58c9 --- /dev/null +++ b/packages/riscv/build-riscv-gcc.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# From pico-sdk-tools +# https://github.com/raspberrypi/pico-sdk-tools/blob/63a716bf0c50a37883a740e1526fde65af083493/packages/windows/riscv/build-riscv-gcc.sh + +set -euo pipefail + +BITNESS=$1 +ARCH=$2 + +INSTALLDIR="riscv-install" +mkdir -p "$INSTALLDIR" + +BUILDDIR="$(pwd)" + +cd riscv-gnu-toolchain +./configure --prefix=$BUILDDIR/$INSTALLDIR --with-arch=rv32ima_zicsr_zifencei_zba_zbb_zbs_zbkb_zca_zcb --with-abi=ilp32 --with-multilib-generator="rv32ima_zicsr_zifencei_zba_zbb_zbs_zbkb_zca_zcb-ilp32--;rv32imac_zicsr_zifencei_zba_zbb_zbs_zbkb-ilp32--" +make -j$(nproc) From 3b39726697d53202d480095a499d87cc4307c211 Mon Sep 17 00:00:00 2001 From: Nikhil Dabas Date: Sun, 1 Dec 2024 10:13:09 +0000 Subject: [PATCH 09/17] Use shorter base path for builds --- .github/workflows/build.yml | 18 ++++++++++---- build.ps1 | 37 ++++++++++++++--------------- config/x64-standalone.json | 2 +- config/x64.json | 2 +- packages/common/build-id.ps1 | 29 ++++++++++++++++++++++ packages/openocd/build-openocd.sh | 9 +++---- packages/picotool/build-picotool.sh | 6 ++--- packages/riscv/build-riscv-gcc.sh | 5 +--- 8 files changed, 69 insertions(+), 39 deletions(-) create mode 100644 packages/common/build-id.ps1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 40f4e2a..3d24c30 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,10 +54,7 @@ jobs: - name: Check OpenOCD repository shell: pwsh - run: | - $OpenOCDCommit = ((Get-Content .\config\repositories.json | ConvertFrom-Json).repositories | Where-Object { $_.href -like '*openocd.git' } | ForEach-Object { git ls-remote $_.href $_.tree }).Split("`t")[0] - $Bitness = (Get-Content .\config\${{ matrix.config }}.json | ConvertFrom-Json).bitness - Add-Content -Path $env:GITHUB_ENV -Value "OPENOCD_BUILD_ID=openocd-$OpenOCDCommit-$Bitness" + run: .\packages\common\build-id.ps1 openocd .\config\${{ matrix.config }}.json >> $env:GITHUB_ENV - name: Cache OpenOCD build uses: actions/cache@v4 @@ -65,6 +62,16 @@ jobs: path: build/openocd-install key: ${{ env.OPENOCD_BUILD_ID }} + - name: Check riscv-gnu-toolchain repository + shell: pwsh + run: .\packages\common\build-id.ps1 riscv-gnu-toolchain .\config\${{ matrix.config }}.json >> $env:GITHUB_ENV + + - name: Cache riscv-gnu-toolchain build + uses: actions/cache@v4 + with: + path: build/riscv-gnu-toolchain-install + key: ${{ env.RISCV-GNU-TOOLCHAIN_BUILD_ID }} + - name: Build ${{ matrix.config }} (${{ matrix.build-type }}) shell: pwsh run: | @@ -72,6 +79,9 @@ jobs: $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' + subst P: . + P: + .\build.ps1 .\config\${{ matrix.config }}.json -MSYS2Path (msys2 -c 'cygpath -m /').TrimEnd('\/') -SkipSigning -Compression zlib -BuildType ${{ matrix.build-type }} - name: Upload build artifacts diff --git a/build.ps1 b/build.ps1 index f3ce8d4..1bcf988 100644 --- a/build.ps1 +++ b/build.ps1 @@ -48,7 +48,8 @@ $tools = (Get-Content '.\config\tools.json' | ConvertFrom-Json).tools $repositories = (Get-Content '.\config\repositories.json' | ConvertFrom-Json).repositories $config = Get-Content $ConfigFile | ConvertFrom-Json $bitness = $config.bitness -$mingw_arch = $config.mingwArch +$env:MSYSTEM = $config.msysEnv +$msysEnv = $config.msysEnv.ToLowerInvariant() $downloads = $config.downloads $componentSelection = ($config | Get-Member componentSelection) ? $config.componentSelection : $false @@ -187,8 +188,6 @@ function msys { # Preserve the current working directory $env:CHERE_INVOKING = 'yes' -# Start MINGW32/64 environment -$env:MSYSTEM = "MINGW$bitness" # Use real symlinks $env:MSYS = "winsymlinks:nativestrict" @@ -206,20 +205,20 @@ if (-not $SkipDownload) { msys "pacboy -S --noconfirm --needed cmake:p ninja:p toolchain:p libusb:p hidapi:p libslirp:p" } -if (-not (Test-Path ".\build\riscv-install\mingw$bitness")) { - msys "cd build && ../packages/riscv/build-riscv-gcc.sh $bitness $mingw_arch" +if (-not (Test-Path ".\build\riscv-gnu-toolchain-install\$msysEnv")) { + msys "cd build && ../packages/riscv/build-riscv-gcc.sh" } -if (-not (Test-Path ".\build\openocd-install\mingw$bitness")) { - msys "cd build && ../packages/openocd/build-openocd.sh $bitness $mingw_arch" +if (-not (Test-Path ".\build\openocd-install\$msysEnv")) { + msys "cd build && ../packages/openocd/build-openocd.sh" } -if (-not (Test-Path ".\build\picotool-install\mingw$bitness")) { - msys "cd build && ../packages/picotool/build-picotool.sh $bitness $mingw_arch" +if (-not (Test-Path ".\build\picotool-install\$msysEnv")) { + msys "cd build && ../packages/picotool/build-picotool.sh" } $template = Get-Content ".\packages\pico-sdk-tools\pico-sdk-tools-config-version.cmake" -Raw -$ExecutionContext.InvokeCommand.ExpandString($template) | Set-Content ".\build\pico-sdk-tools\mingw$bitness\pico-sdk-tools-config-version.cmake" +$ExecutionContext.InvokeCommand.ExpandString($template) | Set-Content ".\build\pico-sdk-tools\$msysEnv\pico-sdk-tools-config-version.cmake" exec { .\build\pandoc\pandoc.exe --from gfm --to gfm --output .\build\ReadMe.txt .\docs\tutorial.md } @@ -530,9 +529,9 @@ LangString DESC_Sec$($_.shortName) `${LANG_ENGLISH} "$($_.name)" Section "-OpenOCD" SecOpenOCD SetOutPath "`$INSTDIR\openocd" - File "build\openocd-install\mingw$bitness\bin\*.*" + File "build\openocd-install\$msysEnv\bin\*.*" SetOutPath "`$INSTDIR\openocd\scripts" - File /r "build\openocd-install\mingw$bitness\share\openocd\scripts\*.*" + File /r "build\openocd-install\$msysEnv\share\openocd\scripts\*.*" SectionEnd @@ -562,7 +561,7 @@ Section "-Pico environment" SecPico File /r "build\pico-sdk\*.*" SetOutPath "`$INSTDIR\pico-sdk-tools" - File /r "build\pico-sdk-tools\mingw$bitness\*.*" + File /r "build\pico-sdk-tools\$msysEnv\*.*" WriteRegStr `${PICO_REG_ROOT} "Software\Kitware\CMake\Packages\pico-sdk-tools" "v$sdkVersion" "`$INSTDIR\pico-sdk-tools" SetOutPath "`$INSTDIR" @@ -657,10 +656,10 @@ $env:__COMPAT_LAYER = "" # Sign files before packaging up the installer sign "build\uninstall-$suffix.exe", -"build\openocd-install\mingw$bitness\bin\openocd.exe", -"build\pico-sdk-tools\mingw$bitness\elf2uf2\elf2uf2.exe", -"build\pico-sdk-tools\mingw$bitness\pioasm\pioasm.exe", -"build\pico-sdk-tools\mingw$bitness\picotool\picotool.exe" +"build\openocd-install\$msysEnv\bin\openocd.exe", +"build\pico-sdk-tools\$msysEnv\elf2uf2\elf2uf2.exe", +"build\pico-sdk-tools\$msysEnv\pioasm\pioasm.exe", +"build\pico-sdk-tools\$msysEnv\picotool\picotool.exe" exec { .\build\NSIS\makensis ".\$basename-$suffix.nsi" } Write-Host "Installer saved to $binfile" @@ -670,7 +669,7 @@ sign $binfile # Package OpenOCD separately as well -$version = (cmd /c ".\build\openocd-install\mingw$bitness\bin\openocd.exe" --version '2>&1')[0] +$version = (cmd /c ".\build\openocd-install\$msysEnv\bin\openocd.exe" --version '2>&1')[0] if (-not ($version -match 'Open On-Chip Debugger (?[a-zA-Z0-9\.\-+]+) \((?[0-9\-:]+)\)')) { Write-Error 'Could not determine openocd version' } @@ -681,4 +680,4 @@ $filename = 'openocd-{0}-{1}-{2}.zip' -f $suffix Write-Host "Saving OpenOCD package to $filename" -exec { tar -a -cf "bin\$filename" -C "build\openocd-install\mingw$bitness\bin" * -C "..\share\openocd" "scripts" } +exec { tar -a -cf "bin\$filename" -C "build\openocd-install\$msysEnv\bin" * -C "..\share\openocd" "scripts" } diff --git a/config/x64-standalone.json b/config/x64-standalone.json index b5c374a..6db955c 100644 --- a/config/x64-standalone.json +++ b/config/x64-standalone.json @@ -1,6 +1,6 @@ { "bitness": 64, - "mingwArch": "x86_64", + "msysEnv": "MINGW64", "downloads": [ { "name": "GNU Arm Embedded Toolchain", diff --git a/config/x64.json b/config/x64.json index 3dfcf38..f013273 100644 --- a/config/x64.json +++ b/config/x64.json @@ -1,6 +1,6 @@ { "bitness": 64, - "mingwArch": "x86_64", + "msysEnv": "MINGW64", "componentSelection": true, "downloads": [ { diff --git a/packages/common/build-id.ps1 b/packages/common/build-id.ps1 new file mode 100644 index 0000000..e46950b --- /dev/null +++ b/packages/common/build-id.ps1 @@ -0,0 +1,29 @@ +param ( + [Parameter(Mandatory = $true, + Position = 0, + HelpMessage = "Base name of the repository to check.")] + [ValidateNotNullOrEmpty()] + [string] + $Repo, + + [Parameter(Mandatory = $true, + Position = 1, + HelpMessage = "Path to a JSON installer configuration file.")] + [Alias("PSPath")] + [ValidateNotNullOrEmpty()] + [string] + $ConfigFile +) + +#Requires -Version 7.2 + +Set-StrictMode -Version Latest +$ErrorActionPreference = 'Stop' + +$remoteCommit = ((Get-Content .\config\repositories.json | ConvertFrom-Json).repositories | + Where-Object { $_.href -like "*${Repo}.git" } | + ForEach-Object { git ls-remote $_.href $_.tree }).Split("`t")[0] + +$msystem = (Get-Content $ConfigFile | ConvertFrom-Json).msysEnv + +"$($Repo.ToUpperInvariant())_BUILD_ID=$Repo-$remoteCommit-$msystem" diff --git a/packages/openocd/build-openocd.sh b/packages/openocd/build-openocd.sh index 8cf952f..79a0526 100644 --- a/packages/openocd/build-openocd.sh +++ b/packages/openocd/build-openocd.sh @@ -2,14 +2,11 @@ set -euo pipefail -BITNESS=$1 -ARCH=$2 - cd openocd ./bootstrap ./configure --disable-werror CFLAGS="-Duint=uint32_t" make clean -make -j4 +make -j$(nproc) DESTDIR="$PWD/../openocd-install" make install -cp "/mingw$BITNESS/bin/libhidapi-0.dll" "$PWD/../openocd-install/mingw$BITNESS/bin" -cp "/mingw$BITNESS/bin/libusb-1.0.dll" "$PWD/../openocd-install/mingw$BITNESS/bin" +cp "/${MSYSTEM,,}/bin/libhidapi-0.dll" "$PWD/../openocd-install/${MSYSTEM,,}/bin" +cp "/${MSYSTEM,,}/bin/libusb-1.0.dll" "$PWD/../openocd-install/${MSYSTEM,,}/bin" diff --git a/packages/picotool/build-picotool.sh b/packages/picotool/build-picotool.sh index 30dd247..26d7310 100644 --- a/packages/picotool/build-picotool.sh +++ b/packages/picotool/build-picotool.sh @@ -2,9 +2,7 @@ set -euo pipefail -BITNESS=$1 -ARCH=$2 -INSTALLDIR="pico-sdk-tools/mingw$BITNESS" +INSTALLDIR="pico-sdk-tools/${MSYSTEM,,}" export PICO_SDK_PATH="$PWD/pico-sdk" export LDFLAGS="-static -static-libgcc -static-libstdc++" @@ -28,4 +26,4 @@ build-tool pico-sdk/tools/pioasm -DPIOASM_FLAT_INSTALL=1 -Wno-dev cp ../packages/pico-sdk-tools/pico-sdk-tools-config.cmake "$INSTALLDIR" build-tool picotool -DPICOTOOL_FLAT_INSTALL=1 -cp "/mingw$BITNESS/bin/libusb-1.0.dll" "$INSTALLDIR/picotool" +cp "/${MSYSTEM,,}/bin/libusb-1.0.dll" "$INSTALLDIR/picotool" diff --git a/packages/riscv/build-riscv-gcc.sh b/packages/riscv/build-riscv-gcc.sh index 1dd58c9..ee9ac9a 100644 --- a/packages/riscv/build-riscv-gcc.sh +++ b/packages/riscv/build-riscv-gcc.sh @@ -5,10 +5,7 @@ set -euo pipefail -BITNESS=$1 -ARCH=$2 - -INSTALLDIR="riscv-install" +INSTALLDIR="riscv-gnu-toolchain-install/${MSYSTEM,,}" mkdir -p "$INSTALLDIR" BUILDDIR="$(pwd)" From 6bd72dac624d15ff2a6a80da79d46dd51c8f49a7 Mon Sep 17 00:00:00 2001 From: Nikhil Dabas Date: Sun, 1 Dec 2024 17:12:41 +0000 Subject: [PATCH 10/17] Clean up scripts --- .editorconfig | 3 ++ build.ps1 | 10 ++--- packages/common/copy-deps.sh | 5 +++ packages/openocd/build-openocd.sh | 28 ++++++++------ packages/picotool/build-picotool.sh | 60 +++++++++++++++-------------- packages/riscv/build-riscv-gcc.sh | 32 +++++++-------- 6 files changed, 77 insertions(+), 61 deletions(-) create mode 100644 packages/common/copy-deps.sh diff --git a/.editorconfig b/.editorconfig index be651a8..996cdc7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,3 +12,6 @@ trim_trailing_whitespace = true [*.md] max_line_length = off trim_trailing_whitespace = false + +[*.sh] +end_of_line = lf diff --git a/build.ps1 b/build.ps1 index 1bcf988..d9e81aa 100644 --- a/build.ps1 +++ b/build.ps1 @@ -205,16 +205,16 @@ if (-not $SkipDownload) { msys "pacboy -S --noconfirm --needed cmake:p ninja:p toolchain:p libusb:p hidapi:p libslirp:p" } -if (-not (Test-Path ".\build\riscv-gnu-toolchain-install\$msysEnv")) { - msys "cd build && ../packages/riscv/build-riscv-gcc.sh" +if (-not (Test-Path ".\build\picotool-install\$msysEnv")) { + msys "cd build && ../packages/picotool/build-picotool.sh" } if (-not (Test-Path ".\build\openocd-install\$msysEnv")) { msys "cd build && ../packages/openocd/build-openocd.sh" } -if (-not (Test-Path ".\build\picotool-install\$msysEnv")) { - msys "cd build && ../packages/picotool/build-picotool.sh" +if (-not (Test-Path ".\build\riscv-gnu-toolchain-install\$msysEnv")) { + msys "cd build && ../packages/riscv/build-riscv-gcc.sh" } $template = Get-Content ".\packages\pico-sdk-tools\pico-sdk-tools-config-version.cmake" -Raw @@ -651,7 +651,7 @@ exec { .\build\NSIS\makensis /DBUILD_UNINSTALLER ".\$basename-$suffix.nsi" } # The 'installer' that just writes the uninstaller asks for admin access, which is not actually needed. $env:__COMPAT_LAYER = "RunAsInvoker" -exec { Start-Process -FilePath ".\build\build-uninstaller-$suffix.exe" -ArgumentList "/S /D=$PSScriptRoot\build" -Wait } +exec { Start-Process -FilePath ".\build\build-uninstaller-$suffix.exe" -ArgumentList "/S /D=$(Join-Path $PSScriptRoot 'build')" -Wait } $env:__COMPAT_LAYER = "" # Sign files before packaging up the installer diff --git a/packages/common/copy-deps.sh b/packages/common/copy-deps.sh new file mode 100644 index 0000000..107a2d9 --- /dev/null +++ b/packages/common/copy-deps.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +set -euo pipefail + +find . -name '*.exe' -exec ldd {} ';' | grep -Po "(?<==> )/${MSYSTEM,,}[^ ]+" | sort -u | xargs -I{} cp -v {} . diff --git a/packages/openocd/build-openocd.sh b/packages/openocd/build-openocd.sh index 79a0526..91a33b7 100644 --- a/packages/openocd/build-openocd.sh +++ b/packages/openocd/build-openocd.sh @@ -1,12 +1,16 @@ -#!/bin/bash - -set -euo pipefail - -cd openocd -./bootstrap -./configure --disable-werror CFLAGS="-Duint=uint32_t" -make clean -make -j$(nproc) -DESTDIR="$PWD/../openocd-install" make install -cp "/${MSYSTEM,,}/bin/libhidapi-0.dll" "$PWD/../openocd-install/${MSYSTEM,,}/bin" -cp "/${MSYSTEM,,}/bin/libusb-1.0.dll" "$PWD/../openocd-install/${MSYSTEM,,}/bin" +#!/bin/bash + +set -euo pipefail + +BUILDDIR="$PWD" +INSTALLDIR="openocd-install" + +cd openocd +./bootstrap +./configure --disable-werror CFLAGS="-Duint=uint32_t" +make -j$(nproc) + +DESTDIR="$BUILDDIR/$INSTALLDIR" make install + +cd "$BUILDDIR/$INSTALLDIR/${MSYSTEM,,}/bin" +"$BUILDDIR/../packages/common/copy-deps.sh" diff --git a/packages/picotool/build-picotool.sh b/packages/picotool/build-picotool.sh index 26d7310..55d4016 100644 --- a/packages/picotool/build-picotool.sh +++ b/packages/picotool/build-picotool.sh @@ -1,29 +1,31 @@ -#!/bin/bash - -set -euo pipefail - -INSTALLDIR="pico-sdk-tools/${MSYSTEM,,}" - -export PICO_SDK_PATH="$PWD/pico-sdk" -export LDFLAGS="-static -static-libgcc -static-libstdc++" - -build-tool () { - SRCDIR="$1" - TOOLDIR="$INSTALLDIR/$(basename "$SRCDIR")" - shift 1 - pushd "$SRCDIR" - mkdir -p build - cd build - cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release "$@" - cmake --build . - popd - mkdir -p "$TOOLDIR" - cmake --install "$SRCDIR/build" --prefix "$INSTALLDIR" || cp "$SRCDIR/build/*.exe" "$TOOLDIR" -} - -[ -d pico-sdk/tools/elf2uf2 ] && build-tool pico-sdk/tools/elf2uf2 -Wno-dev -build-tool pico-sdk/tools/pioasm -DPIOASM_FLAT_INSTALL=1 -Wno-dev -cp ../packages/pico-sdk-tools/pico-sdk-tools-config.cmake "$INSTALLDIR" - -build-tool picotool -DPICOTOOL_FLAT_INSTALL=1 -cp "/${MSYSTEM,,}/bin/libusb-1.0.dll" "$INSTALLDIR/picotool" +#!/bin/bash + +set -euo pipefail + +BUILDDIR="$PWD" +INSTALLDIR="pico-sdk-tools/${MSYSTEM,,}" + +export PICO_SDK_PATH="$PWD/pico-sdk" +export LDFLAGS="-static -static-libgcc -static-libstdc++" + +build-tool () { + SRCDIR="$1" + TOOLDIR="$INSTALLDIR/$(basename "$SRCDIR")" + shift 1 + pushd "$SRCDIR" + mkdir -p build + cd build + cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release "$@" + cmake --build . + popd + mkdir -p "$TOOLDIR" + cmake --install "$SRCDIR/build" --prefix "$INSTALLDIR" || cp "$SRCDIR/build/*.exe" "$TOOLDIR" +} + +[ -d pico-sdk/tools/elf2uf2 ] && build-tool pico-sdk/tools/elf2uf2 -Wno-dev +build-tool pico-sdk/tools/pioasm -DPIOASM_FLAT_INSTALL=1 -Wno-dev +cp ../packages/pico-sdk-tools/pico-sdk-tools-config.cmake "$INSTALLDIR" + +build-tool picotool -DPICOTOOL_FLAT_INSTALL=1 +cd "$INSTALLDIR/picotool" +"$BUILDDIR/../packages/common/copy-deps.sh" diff --git a/packages/riscv/build-riscv-gcc.sh b/packages/riscv/build-riscv-gcc.sh index ee9ac9a..e29a745 100644 --- a/packages/riscv/build-riscv-gcc.sh +++ b/packages/riscv/build-riscv-gcc.sh @@ -1,15 +1,17 @@ -#!/bin/bash - -# From pico-sdk-tools -# https://github.com/raspberrypi/pico-sdk-tools/blob/63a716bf0c50a37883a740e1526fde65af083493/packages/windows/riscv/build-riscv-gcc.sh - -set -euo pipefail - -INSTALLDIR="riscv-gnu-toolchain-install/${MSYSTEM,,}" -mkdir -p "$INSTALLDIR" - -BUILDDIR="$(pwd)" - -cd riscv-gnu-toolchain -./configure --prefix=$BUILDDIR/$INSTALLDIR --with-arch=rv32ima_zicsr_zifencei_zba_zbb_zbs_zbkb_zca_zcb --with-abi=ilp32 --with-multilib-generator="rv32ima_zicsr_zifencei_zba_zbb_zbs_zbkb_zca_zcb-ilp32--;rv32imac_zicsr_zifencei_zba_zbb_zbs_zbkb-ilp32--" -make -j$(nproc) +#!/bin/bash + +# From pico-sdk-tools +# https://github.com/raspberrypi/pico-sdk-tools/blob/63a716bf0c50a37883a740e1526fde65af083493/packages/windows/riscv/build-riscv-gcc.sh + +set -euo pipefail + +BUILDDIR="$PWD" +INSTALLDIR="riscv-gnu-toolchain-install/${MSYSTEM,,}" +mkdir -p "$INSTALLDIR" + +cd riscv-gnu-toolchain +./configure --prefix="$BUILDDIR/$INSTALLDIR" --with-arch=rv32ima_zicsr_zifencei_zba_zbb_zbs_zbkb_zca_zcb --with-abi=ilp32 --with-multilib-generator="rv32ima_zicsr_zifencei_zba_zbb_zbs_zbkb_zca_zcb-ilp32--;rv32imac_zicsr_zifencei_zba_zbb_zbs_zbkb-ilp32--" +make -j$(nproc) + +cd "$BUILDDIR/$INSTALLDIR/bin" +"$BUILDDIR/../packages/common/copy-deps.sh" From 0ab21fb7f592f92dc2f704f2602a5066f3c738a4 Mon Sep 17 00:00:00 2001 From: Nikhil Dabas Date: Sun, 1 Dec 2024 17:34:12 +0000 Subject: [PATCH 11/17] Don't fail if no DLLs to copy --- packages/common/copy-deps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/copy-deps.sh b/packages/common/copy-deps.sh index 107a2d9..30cd50f 100644 --- a/packages/common/copy-deps.sh +++ b/packages/common/copy-deps.sh @@ -2,4 +2,4 @@ set -euo pipefail -find . -name '*.exe' -exec ldd {} ';' | grep -Po "(?<==> )/${MSYSTEM,,}[^ ]+" | sort -u | xargs -I{} cp -v {} . +find . -name '*.exe' -exec ldd {} ';' | (grep -Po "(?<==> )/${MSYSTEM,,}[^ ]+" || true) | sort -u | xargs -I{} cp -v {} . From 736ae00ccab5ab033c0b517d7148295909b2476f Mon Sep 17 00:00:00 2001 From: Nikhil Dabas Date: Mon, 9 Dec 2024 19:25:21 +0000 Subject: [PATCH 12/17] Pre-archive RISCV toolchain NSIS cannot handle content > 2GB --- build.ps1 | 20 ++++++++++++++++++++ packages/common/copy-deps.sh | 14 +++++++++++++- packages/pico-setup-windows/pico-env.cmd | 4 ++++ packages/riscv/build-riscv-gcc.sh | 14 ++++++++++++-- tests/pico-build.cmd | 14 +++++++------- tests/setup.ps1 | 2 +- 6 files changed, 57 insertions(+), 11 deletions(-) diff --git a/build.ps1 b/build.ps1 index d9e81aa..d060548 100644 --- a/build.ps1 +++ b/build.ps1 @@ -216,6 +216,7 @@ if (-not (Test-Path ".\build\openocd-install\$msysEnv")) { if (-not (Test-Path ".\build\riscv-gnu-toolchain-install\$msysEnv")) { msys "cd build && ../packages/riscv/build-riscv-gcc.sh" } +exec { tar -a -cf "build\riscv-gnu-toolchain.zip" -C "build\riscv-gnu-toolchain-install\$msysEnv" '*' } $template = Get-Content ".\packages\pico-sdk-tools\pico-sdk-tools-config-version.cmake" -Raw $ExecutionContext.InvokeCommand.ExpandString($template) | Set-Content ".\build\pico-sdk-tools\$msysEnv\pico-sdk-tools-config-version.cmake" @@ -397,6 +398,18 @@ $($componentSelection ? '!insertmacro MUI_PAGE_COMPONENTS' : '') !include "packages\pico-setup-windows\DumpLog.nsh" +!macro ExpandArchive archivePath + + SetCompress off + File "`${archivePath}" + `${GetFileName} "`${archivePath}" `$R0 + nsExec::ExecToLog ``powershell -NoProfile -ExecutionPolicy Bypass -Command "Expand-Archive '`$R0' -DestinationPath . -Force"`` + Pop `$0 + Delete /REBOOTOK "`$OUTDIR\`$R0" + SetCompress auto + +!macroend + Function .onInit SetShellVarContext $($BuildType -eq 'system' ? 'all' : 'current') @@ -535,6 +548,13 @@ Section "-OpenOCD" SecOpenOCD SectionEnd +Section "-riscv-gnu-toolchain" SecRiscV + + SetOutPath "`$INSTDIR\riscv-gnu-toolchain" + !insertmacro ExpandArchive "build\riscv-gnu-toolchain.zip" + +SectionEnd + !include "packages\pico-setup-windows\VSCodeUtils.nsh" Section VSCode diff --git a/packages/common/copy-deps.sh b/packages/common/copy-deps.sh index 30cd50f..d08de27 100644 --- a/packages/common/copy-deps.sh +++ b/packages/common/copy-deps.sh @@ -2,4 +2,16 @@ set -euo pipefail -find . -name '*.exe' -exec ldd {} ';' | (grep -Po "(?<==> )/${MSYSTEM,,}[^ ]+" || true) | sort -u | xargs -I{} cp -v {} . +# Find all directories with exe files +find . -name '*.exe' -printf '%h\n' | sort -u | while read i +do + echo "Copying DLLs to $i" + pushd "$i" > /dev/null + + # We need to match just the DLL names, if they are from the MSYS2 libraries. + # (?<=...) is a positive lookbehind assertion, because we are looking for something like + # "libusb-1.0.dll => /mingw64/.../libusb-1.0.dll" + find . -maxdepth 1 -name '*.exe' -exec ldd {} ';' | (grep -Po "(?<==> )/${MSYSTEM,,}[^ ]+" || true) | sort -u | xargs -I{} cp -v {} . + + popd > /dev/null +done diff --git a/packages/pico-setup-windows/pico-env.cmd b/packages/pico-setup-windows/pico-env.cmd index 8089056..c3f2b69 100644 --- a/packages/pico-setup-windows/pico-env.cmd +++ b/packages/pico-setup-windows/pico-env.cmd @@ -82,6 +82,7 @@ set "HOME=%USERPROFILE%" call :AddToPath "%PICO_INSTALL_PATH%\cmake\bin" call :AddToPath "%PICO_INSTALL_PATH%\gcc-arm-none-eabi\bin" +call :AddToPath "%PICO_INSTALL_PATH%\riscv-gnu-toolchain\bin" call :AddToPath "%PICO_INSTALL_PATH%\ninja" call :AddToPath "%PICO_INSTALL_PATH%\python" call :AddToPath "%PICO_INSTALL_PATH%\git\cmd" @@ -91,6 +92,9 @@ call :AddToPath "%PICO_INSTALL_PATH%\pico-sdk-tools\pioasm" call :AddToPath "%PICO_INSTALL_PATH%\pico-sdk-tools\picotool" set "PICO_ARM_TOOLCHAIN_PATH=%PICO_INSTALL_PATH%\gcc-arm-none-eabi\bin" +if exist "%PICO_INSTALL_PATH%\riscv-gnu-toolchain\bin" ( + set "PICO_RISCV_TOOLCHAIN_PATH=%PICO_INSTALL_PATH%\riscv-gnu-toolchain\bin" +) call :VerifyExe "GNU Arm Embedded Toolchain" "arm-none-eabi-gcc --version" call :VerifyExe "CMake" "cmake --version" diff --git a/packages/riscv/build-riscv-gcc.sh b/packages/riscv/build-riscv-gcc.sh index e29a745..7e0e79e 100644 --- a/packages/riscv/build-riscv-gcc.sh +++ b/packages/riscv/build-riscv-gcc.sh @@ -9,9 +9,19 @@ BUILDDIR="$PWD" INSTALLDIR="riscv-gnu-toolchain-install/${MSYSTEM,,}" mkdir -p "$INSTALLDIR" +# Currently this results in: +# - GCC is fully static +# - binutils has static libstdc++ and libgcc but needs a few other DLLs +# - GDB is not static at all +export LDFLAGS="-static -static-libgcc -static-libstdc++" + cd riscv-gnu-toolchain -./configure --prefix="$BUILDDIR/$INSTALLDIR" --with-arch=rv32ima_zicsr_zifencei_zba_zbb_zbs_zbkb_zca_zcb --with-abi=ilp32 --with-multilib-generator="rv32ima_zicsr_zifencei_zba_zbb_zbs_zbkb_zca_zcb-ilp32--;rv32imac_zicsr_zifencei_zba_zbb_zbs_zbkb-ilp32--" +./configure \ + --prefix="$BUILDDIR/$INSTALLDIR" \ + --with-arch=rv32ima_zicsr_zifencei_zba_zbb_zbs_zbkb_zca_zcb \ + --with-abi=ilp32 \ + --with-multilib-generator="rv32ima_zicsr_zifencei_zba_zbb_zbs_zbkb_zca_zcb-ilp32--;rv32imac_zicsr_zifencei_zba_zbb_zbs_zbkb-ilp32--" make -j$(nproc) -cd "$BUILDDIR/$INSTALLDIR/bin" +cd "$BUILDDIR/$INSTALLDIR" "$BUILDDIR/../packages/common/copy-deps.sh" diff --git a/tests/pico-build.cmd b/tests/pico-build.cmd index 5ab4635..59fddfa 100644 --- a/tests/pico-build.cmd +++ b/tests/pico-build.cmd @@ -4,12 +4,11 @@ goto main :test-build - mkdir "%BUILD_DIR%" - pushd "%BUILD_DIR%" - cmake "%SRC_DIR%" -G Ninja -DCMAKE_BUILD_TYPE=Debug --fresh %* || exit /b 1 - cmake --build . || exit /b 1 - popd - + mkdir "%BUILD_DIR%" + pushd "%BUILD_DIR%" + cmake "%SRC_DIR%" -G Ninja -DCMAKE_BUILD_TYPE=Debug --fresh %* || exit /b 1 + ninja --quiet || exit /b 1 + popd goto :EOF :main @@ -32,7 +31,8 @@ call :test-build -DPICO_BOARD=pico || exit /b 1 set "BUILD_DIR=P:\pico-examples\build-pico2" call :test-build -DPICO_BOARD=pico2 || exit /b 1 -rem call :test-build build-pico2-riscv -DPICO_BOARD=pico2 -DPICO_PLATFORM=rp2350-riscv || exit /b 1 +set "BUILD_DIR=P:\pico-examples\build-pico2-riscv" +call :test-build -DPICO_BOARD=pico2 -DPICO_PLATFORM=rp2350-riscv "-DPICO_RISCV_TOOLCHAIN_PATH=%PICO_RISCV_TOOLCHAIN_PATH%" "-DPICO_ARM_TOOLCHAIN_PATH=%PICO_ARM_TOOLCHAIN_PATH%" || exit /b 1 set "BUILD_DIR=P:\pico-examples\build-pico_w" call :test-build -DPICO_BOARD=pico_w -DWIFI_SSID=ssid -DWIFI_PASSWORD=pass "-DFREERTOS_KERNEL_PATH=P:\FreeRTOS-Kernel" -DTEST_TCP_SERVER_IP=10.10.10.10 || exit /b 1 diff --git a/tests/setup.ps1 b/tests/setup.ps1 index b8ae1b1..6f16385 100644 --- a/tests/setup.ps1 +++ b/tests/setup.ps1 @@ -2,7 +2,7 @@ Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' -$installer = Get-ChildItem bin\*.exe | Select-Object -First 1 -ExpandProperty FullName +$installer = Get-ChildItem bin\*.exe | Sort-Object LastWriteTime -Descending | Select-Object -First 1 -ExpandProperty FullName Write-Host "Starting $installer" $elapsed = Measure-Command { Start-Process -FilePath $installer -ArgumentList "/S" -Wait } Write-Host ("Finished in {0:hh':'mm':'ss}" -f $elapsed) From 9dc1418eca3a372c98d07797fb3915c36924534c Mon Sep 17 00:00:00 2001 From: Nikhil Dabas Date: Mon, 9 Dec 2024 22:06:18 +0000 Subject: [PATCH 13/17] Update Arm GNU Toolchain --- config/x64-standalone.json | 8 ++++---- config/x64.json | 6 +++--- packages/pico-examples/ide/vscode/c_cpp_properties.json | 2 +- packages/pico-setup-windows/pico-env.cmd | 4 ++-- update.ps1 | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/config/x64-standalone.json b/config/x64-standalone.json index 6db955c..427941f 100644 --- a/config/x64-standalone.json +++ b/config/x64-standalone.json @@ -3,10 +3,10 @@ "msysEnv": "MINGW64", "downloads": [ { - "name": "GNU Arm Embedded Toolchain", - "file": "gcc-arm-none-eabi-10.3-2021.10-win32.zip", - "href": "https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-win32.zip?rev=8f4a92e2ec2040f89912f372a55d8cf3&hash=5569B4C322E49BB400BFB63567A4B33B", - "dirName": "gcc-arm-none-eabi", + "name": "Arm GNU Toolchain", + "file": "arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi.zip", + "href": "https://developer.arm.com/-/media/Files/downloads/gnu/13.3.rel1/binrel/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi.zip", + "dirName": "arm-gnu-toolchain", "extractStrip": 1 }, { diff --git a/config/x64.json b/config/x64.json index f013273..b1d777f 100644 --- a/config/x64.json +++ b/config/x64.json @@ -4,10 +4,10 @@ "componentSelection": true, "downloads": [ { - "name": "GNU Arm Embedded Toolchain", - "file": "gcc-arm-none-eabi-10.3-2021.10-win32.exe", + "name": "Arm GNU Toolchain", + "file": "arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi.exe", "exec": "\"$0\" /S /P /R", - "href": "https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-win32.exe?rev=29bb46cfa0434fbda93abb33c1d480e6&hash=B2C5AAE07841929A0D0BF460896D6E52" + "href": "https://developer.arm.com/-/media/Files/downloads/gnu/13.3.rel1/binrel/arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi.exe" }, { "name": "CMake", diff --git a/packages/pico-examples/ide/vscode/c_cpp_properties.json b/packages/pico-examples/ide/vscode/c_cpp_properties.json index f066f7c..dbd5d4d 100644 --- a/packages/pico-examples/ide/vscode/c_cpp_properties.json +++ b/packages/pico-examples/ide/vscode/c_cpp_properties.json @@ -7,7 +7,7 @@ "${env:PICO_SDK_PATH}/**" ], "defines": [], - "compilerPath": "${env:PICO_INSTALL_PATH}/gcc-arm-none-eabi/bin/arm-none-eabi-gcc.exe", + "compilerPath": "${env:PICO_INSTALL_PATH}/arm-gnu-toolchain/bin/arm-none-eabi-gcc.exe", "cStandard": "c11", "cppStandard": "c++11", "intelliSenseMode": "linux-gcc-arm", diff --git a/packages/pico-setup-windows/pico-env.cmd b/packages/pico-setup-windows/pico-env.cmd index c3f2b69..7bb0005 100644 --- a/packages/pico-setup-windows/pico-env.cmd +++ b/packages/pico-setup-windows/pico-env.cmd @@ -81,7 +81,7 @@ rem directory if we do not set this. set "HOME=%USERPROFILE%" call :AddToPath "%PICO_INSTALL_PATH%\cmake\bin" -call :AddToPath "%PICO_INSTALL_PATH%\gcc-arm-none-eabi\bin" +call :AddToPath "%PICO_INSTALL_PATH%\arm-gnu-toolchain\bin" call :AddToPath "%PICO_INSTALL_PATH%\riscv-gnu-toolchain\bin" call :AddToPath "%PICO_INSTALL_PATH%\ninja" call :AddToPath "%PICO_INSTALL_PATH%\python" @@ -91,7 +91,7 @@ call :AddToPath "%PICO_INSTALL_PATH%\pico-sdk-tools\elf2uf2" call :AddToPath "%PICO_INSTALL_PATH%\pico-sdk-tools\pioasm" call :AddToPath "%PICO_INSTALL_PATH%\pico-sdk-tools\picotool" -set "PICO_ARM_TOOLCHAIN_PATH=%PICO_INSTALL_PATH%\gcc-arm-none-eabi\bin" +set "PICO_ARM_TOOLCHAIN_PATH=%PICO_INSTALL_PATH%\arm-gnu-toolchain\bin" if exist "%PICO_INSTALL_PATH%\riscv-gnu-toolchain\bin" ( set "PICO_RISCV_TOOLCHAIN_PATH=%PICO_INSTALL_PATH%\riscv-gnu-toolchain\bin" ) diff --git a/update.ps1 b/update.ps1 index 7d862ef..8dc8652 100644 --- a/update.ps1 +++ b/update.ps1 @@ -32,11 +32,11 @@ function updateDownloadUrl { [uri]$newUrl = switch ($Download.name) { - 'GNU Arm Embedded Toolchain' { + 'Arm GNU Toolchain' { $ext = $Download.file -match '\.exe$' ? 'exe' : 'zip' - crawl 'https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads' | - Where-Object { $_ -match "-win32\.$ext" } | # There is no 64-bit build for Windows currently + crawl 'https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads' | + Where-Object { $_ -match "arm-gnu-toolchain-.*-mingw-w64-i686-arm-none-eabi\.$ext" } | # There is no 64-bit build for Windows currently Select-Object -First 1 } From a22e6b7ee6490fead7121b39b2b623befde8e902 Mon Sep 17 00:00:00 2001 From: Nikhil Dabas Date: Sun, 15 Dec 2024 17:51:10 +0000 Subject: [PATCH 14/17] Don't wait for dangling processes arm-gnu-toolchain launches a shell --- tests/setup.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/setup.ps1 b/tests/setup.ps1 index 6f16385..802803c 100644 --- a/tests/setup.ps1 +++ b/tests/setup.ps1 @@ -4,7 +4,7 @@ $ProgressPreference = 'SilentlyContinue' $installer = Get-ChildItem bin\*.exe | Sort-Object LastWriteTime -Descending | Select-Object -First 1 -ExpandProperty FullName Write-Host "Starting $installer" -$elapsed = Measure-Command { Start-Process -FilePath $installer -ArgumentList "/S" -Wait } +$elapsed = Measure-Command { Start-Process -FilePath $installer -ArgumentList "/S" -PassThru | Wait-Process } Write-Host ("Finished in {0:hh':'mm':'ss}" -f $elapsed) $uninstRegKey = "Microsoft\Windows\CurrentVersion\Uninstall\Raspberry Pi Pico SDK*" From 1adaeebd7a4e04749907f0df8fda2bb390fe09ca Mon Sep 17 00:00:00 2001 From: Nikhil Dabas Date: Sun, 15 Dec 2024 20:30:42 +0000 Subject: [PATCH 15/17] Use actual path to toolchain --- packages/pico-setup-windows/pico-env.cmd | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/pico-setup-windows/pico-env.cmd b/packages/pico-setup-windows/pico-env.cmd index 7bb0005..490b175 100644 --- a/packages/pico-setup-windows/pico-env.cmd +++ b/packages/pico-setup-windows/pico-env.cmd @@ -91,7 +91,10 @@ call :AddToPath "%PICO_INSTALL_PATH%\pico-sdk-tools\elf2uf2" call :AddToPath "%PICO_INSTALL_PATH%\pico-sdk-tools\pioasm" call :AddToPath "%PICO_INSTALL_PATH%\pico-sdk-tools\picotool" -set "PICO_ARM_TOOLCHAIN_PATH=%PICO_INSTALL_PATH%\arm-gnu-toolchain\bin" +for /f "usebackq tokens=*" %%f in (`where arm-none-eabi-gcc`) do ( + set "PICO_ARM_TOOLCHAIN_PATH=%%~dpf" +) + if exist "%PICO_INSTALL_PATH%\riscv-gnu-toolchain\bin" ( set "PICO_RISCV_TOOLCHAIN_PATH=%PICO_INSTALL_PATH%\riscv-gnu-toolchain\bin" ) From cd1c71802599d1b3091ca0863cb3ea01abc3b7af Mon Sep 17 00:00:00 2001 From: Nikhil Dabas Date: Mon, 16 Dec 2024 09:30:06 +0000 Subject: [PATCH 16/17] This should fail --- .github/workflows/build.yml | 9 +++++++-- tests/setup.ps1 | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3d24c30..e3b9a05 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -52,6 +52,10 @@ jobs: - name: Setup MSYS2 uses: msys2/setup-msys2@v2 + - name: Turn off git autocrlf + shell: pwsh + run: git config --global core.autocrlf false + - name: Check OpenOCD repository shell: pwsh run: .\packages\common\build-id.ps1 openocd .\config\${{ matrix.config }}.json >> $env:GITHUB_ENV @@ -114,8 +118,9 @@ jobs: - name: Test ${{ matrix.config }} (${{ matrix.build-type }}) shell: pwsh - run: docker run --rm -v "$(Get-Location):C:\repo" mcr.microsoft.com/windows/servercore:ltsc${{ matrix.winver }} - powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command "cd C:\repo; .\tests\setup.ps1" + run: docker run --rm -v "$(Get-Location):C:\repo" -w C:\repo + mcr.microsoft.com/windows/servercore:ltsc${{ matrix.winver }} + powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -File .\tests\setup.ps1 - name: Upload installer logs uses: actions/upload-artifact@v4 diff --git a/tests/setup.ps1 b/tests/setup.ps1 index 802803c..bc3a398 100644 --- a/tests/setup.ps1 +++ b/tests/setup.ps1 @@ -30,3 +30,4 @@ function Update-EnvironmentVariables { Update-EnvironmentVariables cmd /c call "$installPath\pico-setup.cmd" "$([Environment]::GetFolderPath("MyDocuments"))\Pico" "&&" call "$PSScriptRoot\pico-build.cmd" +exit $LASTEXITCODE From 079a7539fe2ebb35f439b8709b159f0ffd636c55 Mon Sep 17 00:00:00 2001 From: Nikhil Dabas Date: Mon, 16 Dec 2024 12:28:48 +0000 Subject: [PATCH 17/17] Remove trailing backslash from toolchain path --- packages/pico-setup-windows/pico-env.cmd | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/pico-setup-windows/pico-env.cmd b/packages/pico-setup-windows/pico-env.cmd index 490b175..77cd302 100644 --- a/packages/pico-setup-windows/pico-env.cmd +++ b/packages/pico-setup-windows/pico-env.cmd @@ -91,8 +91,12 @@ call :AddToPath "%PICO_INSTALL_PATH%\pico-sdk-tools\elf2uf2" call :AddToPath "%PICO_INSTALL_PATH%\pico-sdk-tools\pioasm" call :AddToPath "%PICO_INSTALL_PATH%\pico-sdk-tools\picotool" -for /f "usebackq tokens=*" %%f in (`where arm-none-eabi-gcc`) do ( - set "PICO_ARM_TOOLCHAIN_PATH=%%~dpf" +for %%f in (arm-none-eabi-gcc.exe) do ( + set "PICO_ARM_TOOLCHAIN_PATH=%%~dp$PATH:f" +) +rem Remove trailing backslash - add a . then resolve with the 'f' modifier +for %%f in ("%PICO_ARM_TOOLCHAIN_PATH%.") do ( + set "PICO_ARM_TOOLCHAIN_PATH=%%~ff" ) if exist "%PICO_INSTALL_PATH%\riscv-gnu-toolchain\bin" (