├── .github └── workflows │ └── build.yml ├── .gitignore ├── LICENSE ├── README.md ├── build.ps1 ├── build_linux.sh ├── build_macos.sh ├── config ├── repositories.json ├── tools.json └── x64-win.json ├── merge_macos.sh ├── packages ├── linux │ ├── openocd │ │ └── build-openocd.sh │ ├── picotool │ │ └── build-picotool.sh │ └── riscv │ │ └── build-riscv-gcc.sh ├── macos │ ├── get-dylibs.sh │ ├── make-universal.sh │ ├── openocd │ │ └── build-openocd.sh │ ├── picotool │ │ └── build-picotool.sh │ └── riscv │ │ └── build-riscv-gcc.sh └── windows │ ├── copy-deps.sh │ ├── openocd │ └── build-openocd.sh │ ├── pico-sdk-tools │ ├── pico-sdk-tools-config-version.cmake │ └── pico-sdk-tools-config.cmake │ ├── pico-setup-windows │ └── pico-sdk-version.cmake │ ├── picotool │ └── build-picotool.sh │ └── riscv │ └── build-riscv-gcc.sh └── version.txt /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | pull_request: 4 | 5 | permissions: 6 | contents: write 7 | 8 | env: 9 | SKIP_RISCV: 0 10 | SKIP_OPENOCD: 0 11 | 12 | jobs: 13 | build_windows: 14 | name: Build Windows 15 | runs-on: 'windows-latest' 16 | 17 | steps: 18 | - name: Checkout 19 | uses: actions/checkout@v4 20 | - name: Setup MSYS2 21 | uses: msys2/setup-msys2@v2 22 | - name: Build 23 | run: | 24 | subst P: . 25 | P: 26 | ./build.ps1 ./config/x64-win.json -SkipSigning -MSYS2Path (msys2 -c 'cygpath -m /').TrimEnd('\/') 27 | - name: Upload Artifact 28 | uses: actions/upload-artifact@v4 29 | with: 30 | name: tools-win-${{ runner.arch }} 31 | path: | 32 | bin/picotool-*-x64-win.zip 33 | bin/pico-sdk-tools-*-x64-win.zip 34 | bin/openocd-*-x64-win.zip 35 | bin/riscv-toolchain-*-x64-win.zip 36 | - name: Add Release Asset 37 | uses: softprops/action-gh-release@v2 38 | if: startsWith(github.ref, 'refs/tags/') 39 | with: 40 | files: | 41 | bin/picotool-*-x64-win.zip 42 | bin/pico-sdk-tools-*-x64-win.zip 43 | bin/openocd-*-x64-win.zip 44 | bin/riscv-toolchain-*-x64-win.zip 45 | 46 | build_macos: 47 | name: Build MacOS 48 | runs-on: 'macos-14' 49 | 50 | steps: 51 | - name: Checkout 52 | uses: actions/checkout@v4 53 | - name: Set up arm64 Homebrew 54 | id: set-up-homebrew 55 | uses: Homebrew/actions/setup-homebrew@master 56 | - name: Build arm64 57 | run: ./build_macos.sh 58 | - name: Uninstall arm64 Homebrew 59 | run: | 60 | NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" 61 | rm -rf /opt/homebrew || true 62 | - name: Set up x86_64 Homebrew 63 | run: | 64 | NONINTERACTIVE=1 arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 65 | - name: Install x86_64 pkg-config & cmake 66 | run: | 67 | arch -x86_64 /usr/local/bin/brew install pkg-config cmake 68 | - name: Build x86_64 69 | run: arch -x86_64 ./build_macos.sh 70 | - name: Merge Universal Binaries 71 | run: ./merge_macos.sh 72 | - name: Upload Artifact 73 | uses: actions/upload-artifact@v4 74 | with: 75 | name: tools-mac-universal 76 | path: | 77 | bin/picotool-*-mac.zip 78 | bin/pico-sdk-tools-*-mac.zip 79 | bin/openocd-*-mac.zip 80 | bin/riscv-toolchain-*-mac.zip 81 | - name: Add Release Asset 82 | uses: softprops/action-gh-release@v2 83 | if: startsWith(github.ref, 'refs/tags/') 84 | with: 85 | files: | 86 | bin/picotool-*-mac.zip 87 | bin/pico-sdk-tools-*-mac.zip 88 | bin/openocd-*-mac.zip 89 | bin/riscv-toolchain-*-mac.zip 90 | 91 | build_linux: 92 | name: Build Linux 93 | strategy: 94 | fail-fast: false 95 | matrix: 96 | os: [ubuntu-22.04, [self-hosted, linux, arm64, bookworm, 8G]] 97 | runs-on: ${{ matrix.os }} 98 | 99 | steps: 100 | - name: Checkout 101 | uses: actions/checkout@v4 102 | - name: Build 103 | run: ./build_linux.sh 104 | - name: Upload Artifact 105 | uses: actions/upload-artifact@v4 106 | with: 107 | name: tools-lin-${{ runner.arch }} 108 | path: | 109 | bin/picotool-*-lin.tar.gz 110 | bin/pico-sdk-tools-*-lin.tar.gz 111 | bin/openocd-*-lin.tar.gz 112 | bin/riscv-toolchain-*-lin.tar.gz 113 | - name: Add Release Asset 114 | uses: softprops/action-gh-release@v2 115 | if: startsWith(github.ref, 'refs/tags/') 116 | with: 117 | files: | 118 | bin/picotool-*-lin.tar.gz 119 | bin/pico-sdk-tools-*-lin.tar.gz 120 | bin/openocd-*-lin.tar.gz 121 | bin/riscv-toolchain-*-lin.tar.gz 122 | 123 | test_binaries: 124 | name: Test Binaries 125 | needs: [build_linux, build_macos, build_windows] 126 | if: always() && contains(needs.*.result, 'success') 127 | strategy: 128 | fail-fast: false 129 | matrix: 130 | # Test all GitHub supported versions, except for windows-11-arm 131 | os: [macos-15, macos-15-intel, macos-14, windows-2025, windows-2022, windows-11-arm, ubuntu-24.04, ubuntu-22.04, ubuntu-24.04-arm, ubuntu-22.04-arm, [self-hosted, linux, arm64, trixie_desktop], [self-hosted, linux, arm64, bookworm_desktop]] 132 | runs-on: ${{ matrix.os }} 133 | steps: 134 | - name: Download build (Windows) 135 | if: runner.os == 'Windows' 136 | uses: actions/download-artifact@v5 137 | with: 138 | # Only built for x64, but arm should still run it fine 139 | name: tools-win-X64 140 | - name: Download build (MacOS) 141 | if: runner.os == 'macOS' 142 | uses: actions/download-artifact@v5 143 | with: 144 | name: tools-mac-universal 145 | - name: Download build (Linux) 146 | if: runner.os == 'Linux' 147 | uses: actions/download-artifact@v5 148 | with: 149 | name: tools-lin-${{ runner.arch }} 150 | 151 | - name: Extract build (zip) 152 | if: runner.os == 'Windows' || runner.os == 'macOS' 153 | shell: bash # Windows only has unzip in bash shell 154 | run: | 155 | unzip -o pico-sdk-tools*.zip 156 | ls 157 | unzip -o picotool*.zip 158 | ls 159 | unzip -o openocd*.zip || true 160 | ls 161 | unzip -o riscv-toolchain*.zip || true 162 | ls 163 | - name: Extract build (tar.gz) 164 | if: runner.os == 'Linux' 165 | run: | 166 | tar -xvf pico-sdk-tools*.tar.gz 167 | ls 168 | tar -xvf picotool*.tar.gz 169 | ls 170 | tar -xvf openocd*.tar.gz || true 171 | ls 172 | tar -xvf riscv-toolchain*.tar.gz || true 173 | ls 174 | 175 | - name: Clean runner (MacOS) 176 | if: runner.os == 'macOS' 177 | run: | 178 | NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" 179 | - name: Install prerequisites (Ubuntu) 180 | if: runner.os == 'Linux' && runner.environment == 'github-hosted' 181 | run: sudo apt install libftdi1-2 libhidapi-hidraw0 182 | 183 | - name: Test default stuff runs 184 | run: | 185 | ./picotool/picotool version 186 | ./pioasm/pioasm --version 187 | - name: Test openocd runs 188 | if: env.SKIP_OPENOCD != 1 189 | run: | 190 | ./openocd --version 191 | - name: Test riscv-toolchain runs 192 | if: env.SKIP_RISCV != 1 193 | run: | 194 | ./bin/riscv32-unknown-elf-gcc --version 195 | ./bin/riscv32-unknown-elf-gdb --version 196 | 197 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | build 3 | downloads -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pico SDK Tools 2 | 3 | This repository is used to provide pre-built binaries of the SDK tools for Windows, macOS, Raspberry Pi OS, and other Linux operating systems (builds performed on Ubuntu). 4 | These binaries are primarilly for use by the [pico-vscode](https://github.com/raspberrypi/pico-vscode) extension, and the release format is subject to change at any time. 5 | 6 | The tools currently included are: 7 | * **picotool** 8 | * **OpenOCD** (includes `linuxgpiod` and `cmsis-dap` adapters) 9 | * **pioasm** 10 | * **RISC-V Toolchain** 11 | -------------------------------------------------------------------------------- /build.ps1: -------------------------------------------------------------------------------- 1 | # Heavily trimmed down from pico-setup-windows build.ps1 2 | 3 | [CmdletBinding()] 4 | param ( 5 | [Parameter(Mandatory = $true, 6 | Position = 0, 7 | HelpMessage = "Path to a JSON installer configuration file.")] 8 | [Alias("PSPath")] 9 | [ValidateNotNullOrEmpty()] 10 | [string] 11 | $ConfigFile, 12 | 13 | [Parameter(HelpMessage = "SDK Version to build")] 14 | [ValidateNotNullOrEmpty()] 15 | [string] 16 | $Version, 17 | 18 | [Parameter(HelpMessage = "Path to MSYS2 installation. MSYS2 will be downloaded and installed to this path if it doesn't exist.")] 19 | [ValidatePattern('[\\\/]msys64$')] 20 | [string] 21 | $MSYS2Path = '.\build\msys64', 22 | 23 | [switch] 24 | $SkipDownload, 25 | 26 | [switch] 27 | $SkipSigning 28 | ) 29 | 30 | #Requires -Version 7.2 31 | 32 | function mkdirp { 33 | param ([string] $dir, [switch] $clean) 34 | 35 | New-Item -Path $dir -Type Directory -Force | Out-Null 36 | 37 | if ($clean) { 38 | Remove-Item -Path "$dir\*" -Recurse -Force 39 | } 40 | } 41 | 42 | function exec { 43 | param ([scriptblock]$private:cmd) 44 | 45 | $global:LASTEXITCODE = 0 46 | 47 | & $cmd 48 | 49 | if ($LASTEXITCODE -ne 0) { 50 | throw "Command '$cmd' exited with code $LASTEXITCODE" 51 | } 52 | } 53 | 54 | 55 | Set-StrictMode -Version Latest 56 | $ErrorActionPreference = 'Stop' 57 | $ProgressPreference = 'SilentlyContinue' 58 | 59 | Write-Host "Building from $ConfigFile" 60 | 61 | $suffix = [io.path]::GetFileNameWithoutExtension($ConfigFile) 62 | 63 | $tools = (Get-Content '.\config\tools.json' | ConvertFrom-Json).tools 64 | $repositories = (Get-Content '.\config\repositories.json' | ConvertFrom-Json).repositories 65 | if ("" -ne $Version) { 66 | Write-Host "Version set to $Version" 67 | $repositories[0].tree = $Version 68 | } else { 69 | $version = (Get-Content "$PSScriptRoot\version.txt").Trim() 70 | } 71 | $config = Get-Content $ConfigFile | ConvertFrom-Json 72 | $env:MSYSTEM = $config.msysEnv 73 | $msysEnv = $config.msysEnv.ToLowerInvariant() 74 | $downloads = $config.downloads 75 | 76 | mkdirp "build" 77 | mkdirp "bin" 78 | 79 | ($downloads + $tools) | ForEach-Object { 80 | $_ | Add-Member -NotePropertyName 'shortName' -NotePropertyValue ($_.name -replace '[^a-zA-Z0-9]', '') 81 | $outfile = "downloads/$($_.file)" 82 | 83 | if ($SkipDownload) { 84 | Write-Host "Checking $($_.name): " -NoNewline 85 | if (-not (Test-Path $outfile)) { 86 | Write-Error "$outfile not found" 87 | } 88 | } 89 | else { 90 | Write-Host "Downloading $($_.name): " -NoNewline 91 | exec { curl.exe --fail --silent --show-error --url "$($_.href)" --location --output "$outfile" --create-dirs --remote-time --time-cond "downloads/$($_.file)" } 92 | } 93 | 94 | # Display versions of packaged installers, for information only. We try to 95 | # extract it from: 96 | # 1. The file name 97 | # 2. The download URL 98 | # 3. The version metadata in the file 99 | # 100 | # This fails for MSYS2, because there is no version number (only a timestamp) 101 | # and the version that gets reported is 7-zip SFX version. 102 | $fileVersion = '' 103 | $versionRegEx = '([0-9]+\.)+[0-9]+' 104 | if ($_.file -match $versionRegEx -or $_.href -match $versionRegEx) { 105 | $fileVersion = $Matches[0] 106 | } else { 107 | $fileVersion = (Get-ChildItem $outfile).VersionInfo.ProductVersion 108 | } 109 | 110 | if ($fileVersion) { 111 | Write-Host $fileVersion 112 | } else { 113 | Write-Host $_.file 114 | } 115 | 116 | if ($_ | Get-Member dirName) { 117 | $strip = 0; 118 | if ($_ | Get-Member extractStrip) { $strip = $_.extractStrip } 119 | 120 | mkdirp "build\$($_.dirName)" -clean 121 | exec { tar -xf $outfile -C "build\$($_.dirName)" --strip-components $strip } 122 | } 123 | } 124 | 125 | if (-not (Get-Command cmake -ErrorAction SilentlyContinue)) { 126 | $env:PATH = $env:PATH + ';' + (Resolve-Path .\build\cmake\bin).Path 127 | } 128 | 129 | if (-not (Get-Command git -ErrorAction SilentlyContinue)) { 130 | $env:PATH = $env:PATH + ';' + (Resolve-Path .\build\git\cmd).Path 131 | } 132 | 133 | exec { git config --global core.autocrlf false } 134 | 135 | $repositories | ForEach-Object { 136 | $repodir = Join-Path 'build' ([IO.Path]::GetFileNameWithoutExtension($_.href)) 137 | $repodir = $repodir.TrimEnd("-rp2350") 138 | 139 | if ($_ | Get-Member pi_only) { 140 | Write-Host "Skipping Pi only ${repodir}" 141 | } 142 | elseif ($SkipDownload) { 143 | Write-Host "Checking ${repodir}: " -NoNewline 144 | if (-not (Test-Path $repodir)) { 145 | Write-Error "$repodir not found" 146 | } 147 | exec { git -C "$repodir" describe --all } 148 | } 149 | else { 150 | if (Test-Path $repodir) { 151 | Remove-Item $repodir -Recurse -Force 152 | } 153 | 154 | exec { git clone -b "$($_.tree)" --depth=1 -c advice.detachedHead=false "$($_.href)" "$repodir" } 155 | 156 | if ($_ | Get-Member submodules) { 157 | exec { git -C "$repodir" submodule update --init --depth=1 } 158 | } 159 | } 160 | } 161 | 162 | $sdkVersion = (cmake -P .\packages\windows\pico-setup-windows\pico-sdk-version.cmake -N | Select-String -Pattern 'PICO_SDK_VERSION_STRING=(.*)$').Matches.Groups[1].Value 163 | if (-not ($sdkVersion -match $versionRegEx)) { 164 | Write-Error 'Could not determine Pico SDK version.' 165 | } 166 | 167 | if (-not (Test-Path $MSYS2Path)) { 168 | Write-Host 'Extracting MSYS2' 169 | exec { & .\downloads\msys2.exe -y "-o$(Resolve-Path (Split-Path $MSYS2Path -Parent))" } 170 | } 171 | 172 | function sign { 173 | param ([string[]] $filesToSign) 174 | 175 | if ($SkipSigning) { 176 | Write-Warning "Skipping code signing." 177 | } else { 178 | $cert = Get-ChildItem -Path Cert:\CurrentUser\My -CodeSigningCert | Where-Object { $_.Subject -like "CN=Raspberry Pi*" } 179 | if (-not $cert) { 180 | Write-Error "No suitable code signing certificates found." 181 | } 182 | 183 | $filesToSign | Set-AuthenticodeSignature -Certificate $cert -TimestampServer "http://timestamp.digicert.com" -HashAlgorithm SHA256 | Tee-Object -Variable signatures 184 | $signatures | ForEach-Object { 185 | if ($_.Status -ne 0) { 186 | Write-Error "Error signing $($_.Path)" 187 | } 188 | } 189 | } 190 | } 191 | 192 | function msys { 193 | param ([string] $cmd) 194 | 195 | exec { & "$MSYS2Path\usr\bin\bash" -leo pipefail -c "$cmd" } 196 | } 197 | 198 | # Preserve the current working directory 199 | $env:CHERE_INVOKING = 'yes' 200 | # Use real symlinks 201 | $env:MSYS = "winsymlinks:nativestrict" 202 | 203 | if (-not $SkipDownload) { 204 | # First run setup 205 | msys 'uname -a' 206 | # Core update 207 | msys 'pacman --noconfirm -Syuu' 208 | # Normal update 209 | msys 'pacman --noconfirm -Suu' 210 | 211 | msys "pacman -S --noconfirm --needed autoconf automake base-devel expat git libtool pactoys patchutils pkg-config" 212 | # pacboy adds MINGW_PACKAGE_PREFIX to package names suffixed with :p 213 | msys "pacboy -S --noconfirm --needed cmake:p ninja:p toolchain:p libusb:p hidapi:p libslirp:p" 214 | } 215 | 216 | if (-not (Test-Path ".\build\riscv-install\$msysEnv") -and ($env:SKIP_RISCV -ne '1')) { 217 | msys "cd build && ../packages/windows/riscv/build-riscv-gcc.sh" 218 | } 219 | 220 | if (-not (Test-Path ".\build\openocd-install\$msysEnv") -and ($env:SKIP_OPENOCD -ne '1')) { 221 | msys "cd build && ../packages/windows/openocd/build-openocd.sh" 222 | } 223 | 224 | if (-not (Test-Path ".\build\picotool-install\$msysEnv")) { 225 | msys "cd build && ../packages/windows/picotool/build-picotool.sh $version" 226 | } 227 | 228 | if ($version.Substring(0, 1) -ge 2) { 229 | # Sign files before packaging up the installer 230 | sign "build\openocd-install\$msysEnv\bin\openocd.exe", 231 | "build\pico-sdk-tools\$msysEnv\pioasm\pioasm.exe", 232 | "build\picotool-install\$msysEnv\picotool\picotool.exe" 233 | } else { 234 | $template = Get-Content ".\packages\windows\pico-sdk-tools\pico-sdk-tools-config-version.cmake" -Raw 235 | $ExecutionContext.InvokeCommand.ExpandString($template) | Set-Content ".\build\pico-sdk-tools\$msysEnv\pico-sdk-tools-config-version.cmake" 236 | 237 | # Sign files before packaging up the installer 238 | sign "build\openocd-install\$msysEnv\bin\openocd.exe", 239 | "build\pico-sdk-tools\$msysEnv\elf2uf2.exe", 240 | "build\pico-sdk-tools\$msysEnv\pioasm.exe", 241 | "build\picotool-install\$msysEnv\picotool.exe" 242 | } 243 | 244 | # Package pico-sdk-tools separately as well 245 | 246 | $filename = 'pico-sdk-tools-{0}-{1}.zip' -f 247 | $version, 248 | $suffix 249 | 250 | Write-Host "Saving pico-sdk-tools package to $filename" 251 | exec { tar -a -cf "bin\$filename" -C "build\pico-sdk-tools\$msysEnv" '*' } 252 | 253 | # Package picotool separately as well 254 | 255 | $version = (cmd /c ".\build\picotool-install\$msysEnv\picotool\picotool.exe" version -s '2>&1') 256 | Write-Host "Picotool version $version" 257 | 258 | $filename = 'picotool-{0}-{1}.zip' -f 259 | $version, 260 | $suffix 261 | 262 | Write-Host "Saving picotool package to $filename" 263 | exec { tar -a -cf "bin\$filename" -C "build\picotool-install\$msysEnv" '*' } 264 | 265 | if ($env:SKIP_OPENOCD -ne '1') { 266 | # Package OpenOCD separately as well 267 | 268 | $version = (cmd /c ".\build\openocd-install\$msysEnv\bin\openocd.exe" --version '2>&1')[0] 269 | if (-not ($version -match 'Open On-Chip Debugger (?[a-zA-Z0-9\.\-+]+) \((?[0-9\-:]+)\)')) { 270 | Write-Error 'Could not determine openocd version' 271 | } 272 | 273 | $filename = 'openocd-{0}-{1}.zip' -f 274 | ($Matches.version -replace '-.*$', ''), 275 | $suffix 276 | 277 | # Removing files with special char in their names 278 | # they cause issues with some decompression libraries 279 | Remove-Item "build\openocd-install\$msysEnv\share\openocd\scripts\target\1986*.cfg" 280 | 281 | Write-Host "Saving OpenOCD package to $filename" 282 | exec { tar -a -cf "bin\$filename" -C "build\openocd-install\$msysEnv\bin" '*' -C "..\share\openocd" "scripts" } 283 | } 284 | 285 | if ($env:SKIP_RISCV -ne '1') { 286 | # Package Risc-V separately as well 287 | 288 | $version = ((. ".\build\riscv-install\$msysEnv\bin\riscv32-unknown-elf-gcc.exe" -dumpversion) -split '\.')[0] 289 | 290 | $filename = 'riscv-toolchain-{0}-{1}.zip' -f 291 | $version, 292 | $suffix 293 | 294 | Write-Host "Saving Risc-V toolchain package to $filename" 295 | exec { tar -a -cf "bin\$filename" -C "build\riscv-install\$msysEnv" '*' } 296 | } 297 | -------------------------------------------------------------------------------- /build_linux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # Defaults 6 | SKIP_RISCV=${SKIP_RISCV-0} 7 | SKIP_OPENOCD=${SKIP_OPENOCD-0} 8 | 9 | # Install prerequisites 10 | sudo apt install -y jq cmake libtool automake libusb-1.0-0-dev libhidapi-dev libftdi1-dev patchelf 11 | # RISC-V prerequisites 12 | sudo apt install -y autoconf automake autotools-dev curl python3 python3-pip libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev ninja-build git cmake libglib2.0-dev libslirp-dev 13 | # RPi Only prerequisites 14 | if [[ $(uname -m) == 'aarch64' ]]; then 15 | sudo apt install -y libgpiod-dev 16 | fi 17 | 18 | repos=$(cat config/repositories.json | jq -c '.repositories[]') 19 | export version=$(cat ./version.txt) 20 | suffix="$(uname -m)-lin" 21 | builddir="build" 22 | 23 | mkdir -p $builddir 24 | mkdir -p "bin" 25 | 26 | while read -r repo 27 | do 28 | tree=$(echo "$repo" | jq -r .tree) 29 | href=$(echo "$repo" | jq -r .href) 30 | filename=$(basename -- "$href") 31 | extension="${filename##*.}" 32 | filename="${filename%.*}" 33 | filename=${filename%"-rp2350"} 34 | repodir="$builddir/${filename}" 35 | 36 | echo "${href} ${tree} ${filename} ${extension} ${repodir}" 37 | rm -rf "${repodir}" 38 | git clone -b "${tree}" --depth=1 -c advice.detachedHead=false "${href}" "${repodir}" 39 | submodules=$(echo "$repo" | jq -r .submodules) 40 | if [[ "$submodules" == "true" ]]; then 41 | git -C "${repodir}" submodule update --init --depth=1 42 | fi 43 | done < <(echo "$repos") 44 | 45 | 46 | cd $builddir 47 | if [[ "$SKIP_OPENOCD" != 1 ]]; then 48 | if ! ../packages/linux/openocd/build-openocd.sh; then 49 | echo "::error title=openocd-fail-${suffix}::OpenOCD Build Failed on Linux $(uname -m)" 50 | SKIP_OPENOCD=1 51 | fi 52 | fi 53 | if [[ "$SKIP_RISCV" != 1 ]]; then 54 | # Takes ages to build 55 | ../packages/linux/riscv/build-riscv-gcc.sh 56 | fi 57 | ../packages/linux/picotool/build-picotool.sh 58 | cd .. 59 | 60 | topd=$PWD 61 | 62 | if [ ${version:0:1} -ge 2 ]; then 63 | # Package pico-sdk-tools separately as well 64 | 65 | filename="pico-sdk-tools-${version}-${suffix}.tar.gz" 66 | 67 | echo "Saving pico-sdk-tools package to $filename" 68 | pushd "$builddir/pico-sdk-tools/" 69 | tar -a -cf "$topd/bin/$filename" * .keep 70 | popd 71 | fi 72 | 73 | # Package picotool separately as well 74 | version=$("./$builddir/picotool-install/picotool/picotool" version -s) 75 | echo "Picotool version $version" 76 | 77 | filename="picotool-${version}-${suffix}.tar.gz" 78 | 79 | echo "Saving picotool package to $filename" 80 | pushd "$builddir/picotool-install/" 81 | tar -a -cf "$topd/bin/$filename" * .keep 82 | popd 83 | 84 | if [[ "$SKIP_OPENOCD" != 1 ]]; then 85 | # Package OpenOCD separately as well 86 | 87 | version=($("./$builddir/openocd-install/usr/local/bin/openocd" --version 2>&1)) 88 | version=${version[0]} 89 | version=${version[3]} 90 | version=$(echo $version | cut -d "-" -f 1) 91 | 92 | echo "OpenOCD version $version" 93 | 94 | filename="openocd-${version}-${suffix}.tar.gz" 95 | 96 | echo "Saving OpenOCD package to $filename" 97 | pushd "$builddir/openocd-install/usr/local/bin" 98 | tar -a -cf "$topd/bin/$filename" * -C "../share/openocd" "scripts" 99 | popd 100 | fi 101 | 102 | if [[ "$SKIP_RISCV" != 1 ]]; then 103 | # Package riscv toolchain separately as well 104 | version=$("./$builddir/riscv-install/bin/riscv32-unknown-elf-gcc" -dumpversion) 105 | version=$(echo $version | cut -d "." -f 1) 106 | echo "RISC-V Toolchain version $version" 107 | 108 | filename="riscv-toolchain-${version}-${suffix}.tar.gz" 109 | 110 | echo "Saving RISC-V Toolchain package to $filename" 111 | pushd "$builddir/riscv-install/" 112 | tar -a -cf "$topd/bin/$filename" * 113 | popd 114 | fi 115 | -------------------------------------------------------------------------------- /build_macos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # Defaults 6 | SKIP_RISCV=${SKIP_RISCV-0} 7 | SKIP_OPENOCD=${SKIP_OPENOCD-0} 8 | SKIP_PICOTOOL=${SKIP_PICOTOOL-0} 9 | 10 | echo "Running on $(uname -m)" 11 | 12 | # Install prerequisites 13 | if [[ $(uname -m) == 'arm64' ]]; then 14 | arch -arm64 /opt/homebrew/bin/brew install jq libtool libusb automake hidapi --quiet 15 | else 16 | arch -x86_64 /usr/local/bin/brew install jq libtool libusb automake hidapi --quiet 17 | fi 18 | # RISC-V prerequisites 19 | echo "Listing local" 20 | ls /usr/local/bin 21 | rm /usr/local/bin/2to3* || true 22 | rm /usr/local/bin/idle3* || true 23 | rm /usr/local/bin/pip* || true 24 | rm /usr/local/bin/py* || true 25 | if [[ $(uname -m) == 'arm64' ]]; then 26 | arch -arm64 /opt/homebrew/bin/brew install python3 gawk gnu-sed make gmp mpfr libmpc isl zlib expat texinfo flock libslirp --quiet 27 | else 28 | arch -x86_64 /usr/local/bin/brew install python3 gawk gnu-sed make gmp mpfr libmpc isl zlib expat texinfo flock libslirp --quiet 29 | fi 30 | 31 | repos=$(cat config/repositories.json | jq -c '.repositories.[]') 32 | export version=$(cat ./version.txt) 33 | suffix="mac" 34 | builddir="build" 35 | 36 | # nproc alias 37 | alias nproc="sysctl -n hw.logicalcpu" 38 | 39 | mkdir -p $builddir 40 | mkdir -p "bin" 41 | 42 | while read -r repo 43 | do 44 | tree=$(echo "$repo" | jq -r .tree) 45 | href=$(echo "$repo" | jq -r .href) 46 | filename=$(basename -- "$href") 47 | extension="${filename##*.}" 48 | filename="${filename%.*}" 49 | filename=${filename%"-rp2350"} 50 | repodir="$builddir/${filename}" 51 | 52 | echo "${href} ${tree} ${filename} ${extension} ${repodir}" 53 | rm -rf "${repodir}" 54 | git clone -b "${tree}" --depth=1 -c advice.detachedHead=false "${href}" "${repodir}" 55 | submodules=$(echo "$repo" | jq -r .submodules) 56 | if [[ "$submodules" == "true" ]]; then 57 | git -C "${repodir}" submodule update --init --depth=1 58 | fi 59 | done < <(echo "$repos") 60 | 61 | 62 | cd $builddir 63 | if [[ "$SKIP_OPENOCD" != 1 ]]; then 64 | if ! ../packages/macos/openocd/build-openocd.sh; then 65 | echo "::error title=openocd-fail-macos::OpenOCD Build Failed on macOS" 66 | SKIP_OPENOCD=1 67 | fi 68 | echo "OpenOCD Build Complete" 69 | if [[ "$SKIP_OPENOCD" != 1 ]]; then 70 | ../packages/macos/get-dylibs.sh "openocd-install-$(uname -m)" 71 | echo "OpenOCD dylibs copied" 72 | fi 73 | fi 74 | if [[ "$SKIP_RISCV" != 1 ]]; then 75 | # Takes ages to build 76 | ../packages/macos/riscv/build-riscv-gcc.sh 77 | echo "RISC-V Build Complete" 78 | 79 | ../packages/macos/get-dylibs.sh "riscv-install-$(uname -m)" 80 | echo "RISC-V dylibs copied" 81 | fi 82 | if [[ "$SKIP_PICOTOOL" != 1 ]]; then 83 | ../packages/macos/picotool/build-picotool.sh 84 | echo "Picotool Build Complete" 85 | 86 | ../packages/macos/get-dylibs.sh "picotool-install-$(uname -m)" 87 | echo "Picotool dylibs copied" 88 | fi 89 | cd .. 90 | -------------------------------------------------------------------------------- /config/repositories.json: -------------------------------------------------------------------------------- 1 | { 2 | "repositories": [ 3 | { 4 | "href": "https://github.com/raspberrypi/pico-sdk.git", 5 | "tree": "2.2.0" 6 | }, 7 | { 8 | "href": "https://github.com/raspberrypi/picotool.git", 9 | "tree": "2.2.0-a4" 10 | }, 11 | { 12 | "href": "https://github.com/raspberrypi/openocd.git", 13 | "tree": "sdk-2.2.0", 14 | "submodules": true 15 | }, 16 | { 17 | "href": "https://github.com/riscv/riscv-gnu-toolchain.git", 18 | "tree": "2025.08.29" 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /config/tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "tools": [ 3 | { 4 | "name": "NSIS", 5 | "file": "nsis-3.08.zip", 6 | "href": "https://sourceforge.net/projects/nsis/files/NSIS%203/3.08/nsis-3.08.zip/download", 7 | "dirName": "NSIS", 8 | "extractStrip": 1 9 | }, 10 | { 11 | "name": "MSYS2", 12 | "file": "msys2.exe", 13 | "href": "https://github.com/msys2/msys2-installer/releases/download/2024-12-08/msys2-base-x86_64-20241208.sfx.exe" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /config/x64-win.json: -------------------------------------------------------------------------------- 1 | { 2 | "msysEnv": "UCRT64", 3 | "downloads": [ 4 | { 5 | "name": "CMake", 6 | "file": "cmake-3.25.2-windows-x86_64.zip", 7 | "href": "https://github.com/Kitware/CMake/releases/download/v3.25.2/cmake-3.25.2-windows-x86_64.zip", 8 | "dirName": "cmake", 9 | "extractStrip": 1 10 | }, 11 | { 12 | "name": "Ninja", 13 | "file": "ninja-win.zip", 14 | "href": "https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-win.zip", 15 | "dirName": "ninja" 16 | }, 17 | { 18 | "name": "Python 3.9", 19 | "file": "python-3.9.13-embed-amd64.zip", 20 | "href": "https://www.python.org/ftp/python/3.9.13/python-3.9.13-embed-amd64.zip", 21 | "dirName": "python" 22 | }, 23 | { 24 | "name": "Git for Windows", 25 | "file": "MinGit-2.39.1-64-bit.zip", 26 | "href": "https://github.com/git-for-windows/git/releases/download/v2.39.1.windows.1/MinGit-2.39.1-64-bit.zip", 27 | "dirName": "git" 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /merge_macos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # Defaults 6 | SKIP_RISCV=${SKIP_RISCV-0} 7 | SKIP_OPENOCD=${SKIP_OPENOCD-0} 8 | SKIP_PICOTOOL=${SKIP_PICOTOOL-0} 9 | 10 | echo "Running on $(uname -m)" 11 | 12 | export version=$(cat ./version.txt) 13 | suffix="mac" 14 | builddir="build" 15 | 16 | cd $builddir 17 | if [[ "$SKIP_OPENOCD" != 1 ]]; then 18 | ../packages/macos/make-universal.sh "openocd-install" 19 | echo "OpenOCD Merge Complete" 20 | fi 21 | if [[ "$SKIP_RISCV" != 1 ]]; then 22 | ../packages/macos/make-universal.sh "riscv-install" 23 | echo "RISC-V Merge Complete" 24 | fi 25 | if [[ "$SKIP_PICOTOOL" != 1 ]]; then 26 | ../packages/macos/make-universal.sh "picotool-install" 27 | echo "Picotool Merge Complete" 28 | 29 | if [ ${version:0:1} -ge 2 ]; then 30 | ../packages/macos/make-universal.sh "pico-sdk-tools" 31 | echo "Pico SDK Tools Merge Complete" 32 | fi 33 | fi 34 | cd .. 35 | 36 | topd=$PWD 37 | 38 | if [[ "$SKIP_PICOTOOL" != 1 ]]; then 39 | echo "Packaging picotool" 40 | if [ ${version:0:1} -ge 2 ]; then 41 | # Package pico-sdk-tools separately as well 42 | 43 | filename="pico-sdk-tools-${version}-${suffix}.zip" 44 | 45 | echo "Saving pico-sdk-tools package to $filename" 46 | pushd "$builddir/pico-sdk-tools/" 47 | tar -a -cf "$topd/bin/$filename" * .keep 48 | popd 49 | fi 50 | 51 | # Package picotool separately as well 52 | version=$("./$builddir/picotool-install/picotool/picotool" version -s) 53 | echo "Picotool version $version" 54 | 55 | filename="picotool-${version}-${suffix}.zip" 56 | 57 | echo "Saving picotool package to $filename" 58 | pushd "$builddir/picotool-install/" 59 | tar -a -cf "$topd/bin/$filename" * .keep 60 | popd 61 | fi 62 | 63 | if [[ "$SKIP_OPENOCD" != 1 ]]; then 64 | echo "Packaging OpenOCD" 65 | # Package OpenOCD separately as well 66 | 67 | version=($("./$builddir/openocd-install/usr/local/bin/openocd" --version 2>&1)) 68 | version=${version[0]} 69 | version=${version[3]} 70 | version=$(echo $version | cut -d "-" -f 1) 71 | 72 | echo "OpenOCD version $version" 73 | 74 | filename="openocd-${version}-${suffix}.zip" 75 | 76 | echo "Saving OpenOCD package to $filename" 77 | pushd "$builddir/openocd-install/usr/local/bin" 78 | tar -a -cf "$topd/bin/$filename" * -C "../share/openocd" "scripts" 79 | popd 80 | fi 81 | 82 | if [[ "$SKIP_RISCV" != 1 ]]; then 83 | echo "Packaging RISC-V Toolchain" 84 | # Package riscv toolchain separately as well 85 | version=$("./$builddir/riscv-install/bin/riscv32-unknown-elf-gcc" -dumpversion) 86 | version=$(echo $version | cut -d "." -f 1) 87 | echo "Risc-V Toolchain version $version" 88 | 89 | filename="riscv-toolchain-${version}-${suffix}.zip" 90 | 91 | echo "Saving RISC-V Toolchain package to $filename" 92 | pushd "$builddir/riscv-install/" 93 | tar -a -cf "$topd/bin/$filename" * 94 | popd 95 | fi 96 | -------------------------------------------------------------------------------- /packages/linux/openocd/build-openocd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | export CFLAGS=-static 6 | export LDFLAGS=-static 7 | 8 | cd openocd 9 | ./bootstrap 10 | ./configure --disable-werror --enable-internal-jimtcl 11 | make clean 12 | make 13 | INSTALLDIR="$PWD/../openocd-install/usr/local/bin" 14 | rm -rf "$PWD/../openocd-install" 15 | DESTDIR="$PWD/../openocd-install" make install 16 | 17 | # Add libraries that may be different versions on the system 18 | cd $INSTALLDIR 19 | if [[ $(uname -m) == 'aarch64' ]]; then 20 | cp $(ldd openocd | egrep -o "(/.*/libgpiod\.so\.\S*)") ./ 21 | fi 22 | patchelf --set-rpath '$ORIGIN' openocd 23 | -------------------------------------------------------------------------------- /packages/linux/picotool/build-picotool.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | export PICO_SDK_PATH="$PWD/pico-sdk" 6 | 7 | git -C "$PICO_SDK_PATH" submodule update --init --depth=1 lib/mbedtls 8 | 9 | if [ ${version:0:1} -ge 2 ]; then 10 | cd pico-sdk/tools/pioasm 11 | rm -rf build 12 | mkdir -p build 13 | cd build 14 | cmake .. -DCMAKE_BUILD_TYPE=Release -DPIOASM_FLAT_INSTALL=1 -DPIOASM_VERSION_STRING=$version -Wno-dev 15 | cmake --build . 16 | 17 | cd ../../../.. 18 | INSTALLDIR="pico-sdk-tools" 19 | rm -rf $INSTALLDIR 20 | mkdir -p $INSTALLDIR 21 | cmake --install pico-sdk/tools/pioasm/build/ --prefix $INSTALLDIR 22 | touch $INSTALLDIR/.keep 23 | fi 24 | 25 | cd picotool 26 | rm -rf build 27 | mkdir -p build 28 | cd build 29 | cmake .. -DCMAKE_BUILD_TYPE=Release -DPICOTOOL_FLAT_INSTALL=1 30 | cmake --build . 31 | 32 | cd ../.. 33 | INSTALLDIR="picotool-install" 34 | rm -rf $INSTALLDIR 35 | mkdir -p $INSTALLDIR 36 | cmake --install picotool/build/ --prefix $INSTALLDIR 37 | touch $INSTALLDIR/.keep 38 | -------------------------------------------------------------------------------- /packages/linux/riscv/build-riscv-gcc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | export CFLAGS=-static 6 | export LDFLAGS=-static 7 | 8 | INSTALLDIR="riscv-install" 9 | rm -rf $INSTALLDIR 10 | mkdir -p $INSTALLDIR 11 | 12 | BUILDDIR=$(pwd) 13 | 14 | cd riscv-gnu-toolchain 15 | ./configure --prefix=$BUILDDIR/$INSTALLDIR --enable-strip --with-arch=rv32ima_zicsr_zifencei_zba_zbb_zbs_zbkb_zca_zcb_zcmp --with-abi=ilp32 --with-multilib-generator="rv32ima_zicsr_zifencei_zba_zbb_zbs_zbkb_zca_zcb_zcmp-ilp32--;rv32imac_zicsr_zifencei_zba_zbb_zbs_zbkb-ilp32--" 16 | make -j$(nproc) 17 | -------------------------------------------------------------------------------- /packages/macos/get-dylibs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | INSTALLDIR=$1 4 | 5 | EXES=$(find $INSTALLDIR -type f -perm -u+x) 6 | LIBS=$(otool -L $EXES | grep -E "/opt/homebrew|/usr/local/opt" | grep -v python | sort | uniq | grep -o -E "/.*\.dylib") 7 | 8 | if [ ! $LIBS ]; then 9 | exit 1; 10 | fi 11 | 12 | while IFS= read -r lib; do 13 | echo 14 | echo $lib 15 | libname=$(echo $lib | grep -o -E "[^/]*\.dylib") 16 | echo $libname 17 | echo 18 | while IFS= read -r exe; do 19 | if file $exe | grep "Mach-O 64-bit executable" > /dev/null; then 20 | if otool -L $exe | grep -o $lib > /dev/null; then 21 | echo "$exe $(otool -L $exe | grep -o $lib)" 22 | exedir=$(echo $exe | grep -o -E ".*/") 23 | install_name_tool -change $lib @loader_path/$libname $exe 24 | if ! otool -l $exe | grep "LC_RPATH" -A2 | grep "@loader_path" > /dev/null; then 25 | install_name_tool -add_rpath @loader_path/ $exe 26 | fi 27 | if [ ! -f $exedir$libname ]; then 28 | cp $lib $exedir$libname 29 | fi 30 | fi 31 | fi 32 | done <<< "$EXES" 33 | done <<< "$LIBS" 34 | -------------------------------------------------------------------------------- /packages/macos/make-universal.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | INSTALLDIR=$1 6 | 7 | rm -rf $INSTALLDIR 8 | mkdir -p $INSTALLDIR 9 | 10 | cp -r $INSTALLDIR-arm64/* $INSTALLDIR 11 | touch $INSTALLDIR/.keep 12 | 13 | EXES_arm=$(find $INSTALLDIR-arm64 -type f -perm -u+x) 14 | LIBS_arm=$(find $INSTALLDIR-arm64 -type f -name "*.dylib") 15 | FILES_arm=$(echo "$EXES_arm"$'\n'"$LIBS_arm" | sed "s|$INSTALLDIR-arm64|$INSTALLDIR|g") 16 | 17 | EXES_x64=$(find $INSTALLDIR-x86_64 -type f -perm -u+x) 18 | LIBS_x64=$(find $INSTALLDIR-x86_64 -type f -name "*.dylib") 19 | FILES_x64=$(echo "$EXES_x64"$'\n'"$LIBS_x64" | sed "s|$INSTALLDIR-x86_64|$INSTALLDIR|g") 20 | 21 | FILES=$(echo "$FILES_arm"$'\n'"$FILES_x64" | sort | uniq) 22 | 23 | echo "Files: $FILES" 24 | while IFS= read -r file; do 25 | file_arm64=$(sed "s|$INSTALLDIR|$INSTALLDIR-arm64|" <<< $file) 26 | file_x86_64=$(sed "s|$INSTALLDIR|$INSTALLDIR-x86_64|" <<< $file) 27 | if [ -f $file_x86_64 ]; then 28 | if [ -f $file_arm64 ]; then 29 | if file $file | grep "Mach-O 64-bit executable" > /dev/null; then 30 | echo "Processing executable: $file $file_x86_64 $file_arm64" 31 | lipo -create -output $file $file_x86_64 $file_arm64 32 | elif file $file | grep "Mach-O 64-bit dynamically linked shared library" > /dev/null; then 33 | echo "Processing dynamic library: $file $file_x86_64 $file_arm64" 34 | lipo -create -output $file $file_x86_64 $file_arm64 35 | fi 36 | else 37 | echo "Copying $file_x86_64 to $file" 38 | cp $file_x86_64 $file 39 | fi 40 | else 41 | echo "Leaving $file as is" 42 | fi 43 | done <<< "$FILES" 44 | -------------------------------------------------------------------------------- /packages/macos/openocd/build-openocd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | cd openocd 6 | 7 | ./bootstrap 8 | # See https://github.com/raspberrypi/openocd/issues/30 9 | # ./configure --disable-werror CAPSTONE_CFLAGS="$(pkg-config capstone --cflags | sed s/.capstone\$//)" 10 | ./configure --disable-werror --enable-internal-jimtcl 11 | make clean 12 | make 13 | INSTALLDIR="$PWD/../openocd-install-$(uname -m)/usr/local/bin" 14 | rm -rf "$PWD/../openocd-install-$(uname -m)" 15 | DESTDIR="$PWD/../openocd-install-$(uname -m)" make install 16 | -------------------------------------------------------------------------------- /packages/macos/picotool/build-picotool.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | export PICO_SDK_PATH="$PWD/pico-sdk" 6 | 7 | git -C "$PICO_SDK_PATH" submodule update --init --depth=1 lib/mbedtls 8 | 9 | if [ ${version:0:1} -ge 2 ]; then 10 | cd pico-sdk/tools/pioasm 11 | rm -rf build 12 | mkdir -p build 13 | cd build 14 | cmake .. -DCMAKE_BUILD_TYPE=Release -DPIOASM_FLAT_INSTALL=1 -DPIOASM_VERSION_STRING=$version -Wno-dev 15 | cmake --build . 16 | 17 | cd ../../../.. 18 | INSTALLDIR="pico-sdk-tools-$(uname -m)" 19 | rm -rf $INSTALLDIR 20 | mkdir -p $INSTALLDIR 21 | cmake --install pico-sdk/tools/pioasm/build/ --prefix $INSTALLDIR 22 | touch $INSTALLDIR/.keep 23 | fi 24 | 25 | cd picotool 26 | rm -rf build 27 | mkdir -p build 28 | cd build 29 | cmake .. -DCMAKE_BUILD_TYPE=Release -DPICOTOOL_FLAT_INSTALL=1 30 | cmake --build . 31 | 32 | cd ../.. 33 | INSTALLDIR="picotool-install-$(uname -m)" 34 | rm -rf $INSTALLDIR 35 | mkdir -p $INSTALLDIR 36 | cmake --install picotool/build/ --prefix $INSTALLDIR 37 | touch $INSTALLDIR/.keep 38 | -------------------------------------------------------------------------------- /packages/macos/riscv/build-riscv-gcc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | INSTALLDIR="riscv-install-$(uname -m)" 6 | rm -rf $INSTALLDIR 7 | mkdir -p $INSTALLDIR 8 | 9 | BUILDDIR=$(pwd) 10 | 11 | if [[ $(uname -m) == 'arm64' ]]; then 12 | GDB_TARGET_FLAGS_EXTRA="--with-gmp=/opt/homebrew --with-mpfr=/opt/homebrew" 13 | export GDB_TARGET_FLAGS_EXTRA 14 | fi 15 | 16 | cd riscv-gnu-toolchain 17 | ./configure --prefix=$BUILDDIR/$INSTALLDIR --enable-strip --with-arch=rv32ima_zicsr_zifencei_zba_zbb_zbs_zbkb_zca_zcb_zcmp --with-abi=ilp32 --with-multilib-generator="rv32ima_zicsr_zifencei_zba_zbb_zbs_zbkb_zca_zcb_zcmp-ilp32--;rv32imac_zicsr_zifencei_zba_zbb_zbs_zbkb-ilp32--" 18 | # 4 threads, as 8 threads runs out of memory 19 | gmake -j4 20 | -------------------------------------------------------------------------------- /packages/windows/copy-deps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | # Find all directories with exe files 6 | find . -name '*.exe' -printf '%h\n' | sort -u | while read i 7 | do 8 | echo "Copying DLLs to $i" 9 | pushd "$i" > /dev/null 10 | 11 | # We need to match just the DLL names, if they are from the MSYS2 libraries. 12 | # (?<=...) is a positive lookbehind assertion, because we are looking for something like 13 | # "libusb-1.0.dll => /mingw64/.../libusb-1.0.dll" 14 | find . -maxdepth 1 -name '*.exe' -exec ldd {} ';' | (grep -Po "(?<==> )/${MSYSTEM,,}[^ ]+" || true) | sort -u | xargs -I{} cp -v {} . 15 | 16 | popd > /dev/null 17 | done 18 | -------------------------------------------------------------------------------- /packages/windows/openocd/build-openocd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | BUILDDIR=$(pwd) 6 | INSTALLDIR="openocd-install" 7 | 8 | cd openocd 9 | 10 | ./bootstrap 11 | ./configure --disable-werror --enable-internal-jimtcl 12 | make clean 13 | make 14 | DESTDIR="$BUILDDIR/$INSTALLDIR" make install 15 | 16 | cd "$BUILDDIR/$INSTALLDIR/${MSYSTEM,,}/bin" 17 | "$BUILDDIR/../packages/windows/copy-deps.sh" 18 | -------------------------------------------------------------------------------- /packages/windows/pico-sdk-tools/pico-sdk-tools-config-version.cmake: -------------------------------------------------------------------------------- 1 | set(PACKAGE_VERSION "$sdkVersion") 2 | 3 | if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) 4 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 5 | else() 6 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 7 | if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) 8 | set(PACKAGE_VERSION_EXACT TRUE) 9 | endif() 10 | endif() 11 | -------------------------------------------------------------------------------- /packages/windows/pico-sdk-tools/pico-sdk-tools-config.cmake: -------------------------------------------------------------------------------- 1 | set(Pioasm_TARGET Pioasm) 2 | set(Pioasm_EXECUTABLE ${pico-sdk-tools_DIR}/pioasm.exe) 3 | if(NOT TARGET ${Pioasm_TARGET}) 4 | add_executable(${Pioasm_TARGET} IMPORTED) 5 | endif() 6 | set_property(TARGET ${Pioasm_TARGET} PROPERTY IMPORTED_LOCATION ${Pioasm_EXECUTABLE}) 7 | set(Pioasm_FOUND 1) 8 | 9 | set(ELF2UF2_TARGET ELF2UF2) 10 | set(ELF2UF2_EXECUTABLE ${pico-sdk-tools_DIR}/elf2uf2.exe) 11 | if(NOT TARGET ${ELF2UF2_TARGET}) 12 | add_executable(${ELF2UF2_TARGET} IMPORTED) 13 | endif() 14 | set_property(TARGET ${ELF2UF2_TARGET} PROPERTY IMPORTED_LOCATION ${ELF2UF2_EXECUTABLE}) 15 | set(ELF2UF2_FOUND 1) 16 | -------------------------------------------------------------------------------- /packages/windows/pico-setup-windows/pico-sdk-version.cmake: -------------------------------------------------------------------------------- 1 | include(build/pico-sdk/pico_sdk_version.cmake) 2 | 3 | message(STATUS "PICO_SDK_VERSION_STRING=${PICO_SDK_VERSION_STRING}") 4 | -------------------------------------------------------------------------------- /packages/windows/picotool/build-picotool.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | BUILDDIR=$(pwd) 6 | 7 | sdkVersion=$1 8 | 9 | export PICO_SDK_PATH="$PWD/pico-sdk" 10 | export LDFLAGS="-static -static-libgcc -static-libstdc++" 11 | 12 | git -C "$PICO_SDK_PATH" submodule update --init --depth=1 lib/mbedtls 13 | 14 | echo "Version is $sdkVersion" 15 | if [ ${sdkVersion:0:1} -ge 2 ]; then 16 | echo "Version 2+" 17 | cd pico-sdk/tools/pioasm 18 | mkdir -p build 19 | cd build 20 | cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release -DPIOASM_FLAT_INSTALL=1 -DPIOASM_VERSION_STRING=$sdkVersion -Wno-dev 21 | cmake --build . 22 | 23 | cd ../../../.. 24 | INSTALLDIR="pico-sdk-tools/${MSYSTEM,,}" 25 | mkdir -p $INSTALLDIR 26 | cmake --install pico-sdk/tools/pioasm/build/ --prefix $INSTALLDIR 27 | touch $INSTALLDIR/.keep 28 | else 29 | echo "Version <2" 30 | 31 | echo "Cloning older SDK for tools" 32 | rm -rf "pico-sdk-$sdkVersion" 33 | git clone -b "$sdkVersion" --depth=1 -c advice.detachedHead=false "https://github.com/raspberrypi/pico-sdk.git" "pico-sdk-$sdkVersion" 34 | 35 | cd pico-sdk-$sdkVersion/tools/elf2uf2 36 | mkdir -p build 37 | cd build 38 | cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release -Wno-dev 39 | cmake --build . 40 | 41 | cd ../../pioasm 42 | mkdir -p build 43 | cd build 44 | cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release -Wno-dev 45 | cmake --build . 46 | 47 | cd ../../../.. 48 | INSTALLDIR="pico-sdk-tools/${MSYSTEM,,}" 49 | mkdir -p $INSTALLDIR 50 | cp pico-sdk-$sdkVersion/tools/elf2uf2/build/elf2uf2.exe $INSTALLDIR 51 | cp pico-sdk-$sdkVersion/tools/pioasm/build/pioasm.exe $INSTALLDIR 52 | cp ../packages/windows/pico-sdk-tools/pico-sdk-tools-config.cmake $INSTALLDIR 53 | fi 54 | 55 | cd picotool 56 | 57 | mkdir -p build 58 | cd build 59 | cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release -DPICOTOOL_FLAT_INSTALL=1 60 | cmake --build . 61 | 62 | cd ../.. 63 | INSTALLDIR="picotool-install/${MSYSTEM,,}" 64 | mkdir -p $INSTALLDIR 65 | cmake --install picotool/build/ --prefix $INSTALLDIR 66 | touch $INSTALLDIR/.keep 67 | cd $INSTALLDIR/picotool 68 | "$BUILDDIR/../packages/windows/copy-deps.sh" 69 | -------------------------------------------------------------------------------- /packages/windows/riscv/build-riscv-gcc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | INSTALLDIR="riscv-install/${MSYSTEM,,}" 6 | rm -rf $INSTALLDIR 7 | mkdir -p $INSTALLDIR 8 | 9 | BUILDDIR=$(pwd) 10 | 11 | cd riscv-gnu-toolchain 12 | ./configure --prefix=$BUILDDIR/$INSTALLDIR --enable-strip --with-arch=rv32ima_zicsr_zifencei_zba_zbb_zbs_zbkb_zca_zcb_zcmp --with-abi=ilp32 --with-multilib-generator="rv32ima_zicsr_zifencei_zba_zbb_zbs_zbkb_zca_zcb_zcmp-ilp32--;rv32imac_zicsr_zifencei_zba_zbb_zbs_zbkb-ilp32--" 13 | make -j$(nproc) 14 | 15 | cd "$BUILDDIR/$INSTALLDIR" 16 | "$BUILDDIR/../packages/windows/copy-deps.sh" 17 | -------------------------------------------------------------------------------- /version.txt: -------------------------------------------------------------------------------- 1 | 2.2.0 2 | --------------------------------------------------------------------------------