Fix MSVC build and CI tests (#293)
* Add MSVC build test
* Check if UF2 files are actually zip files, and unzip them
diff --git a/.github/workflows/choco_packages.config b/.github/workflows/choco_packages.config
deleted file mode 100644
index d443f75..0000000
--- a/.github/workflows/choco_packages.config
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="gcc-arm-embedded" version="10.2.1" />
- <package id="mingw" version="12.2.0" />
- <package id="ninja" version="1.11.1" />
-</packages>
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 14d63af..c804cfa 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -11,24 +11,40 @@
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
- generator: ["Ninja", "Unix Makefiles"]
+ generator: ["Ninja", "Unix Makefiles", "Visual Studio 17 2022"]
mbedtls: ["mbedtls", ""]
libusb: ["libusb", ""]
compile: ["compile", ""]
exclude:
- os: 'windows-latest'
generator: "Unix Makefiles"
+ - os: 'ubuntu-latest'
+ generator: "Visual Studio 17 2022"
+ - os: 'macos-latest'
+ generator: "Visual Studio 17 2022"
- libusb: ""
compile: "compile"
+ - os: 'windows-latest'
+ # only precompiled ELFs supported for Windows MSVC
+ compile: "compile"
+ generator: "Visual Studio 17 2022"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
+ - name: Install mingw (Windows mingw)
+ if: runner.os == 'Windows' && matrix.generator == 'Ninja'
+ run: |
+ choco install -y mingw --version=12.2.0
+ - name: Install arm-none-eabi-gcc (Windows & MacOS)
+ if: runner.os == 'Windows' || runner.os == 'macOS'
+ uses: carlosperate/arm-none-eabi-gcc-action@v1
+ with:
+ release: 14.3.Rel1
- name: Install dependencies (Windows)
if: runner.os == 'Windows'
run: |
- choco install -y .github/workflows/choco_packages.config
curl -L https://github.com/libusb/libusb/releases/download/v1.0.27/libusb-1.0.27.7z -o libusb.7z
7z x libusb.7z -olibusb
ls libusb
@@ -45,7 +61,6 @@
if: runner.os == 'macOS'
run: |
brew install libusb ninja
- brew install --cask gcc-arm-embedded
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
@@ -62,7 +77,7 @@
run: |
cmake -S . -B build -G "${{ matrix.generator }}" -D PICO_SDK_PATH="${{ github.workspace }}/pico-sdk" ${{ !matrix.libusb && '-D PICOTOOL_NO_LIBUSB=1' || '' }} ${{ matrix.compile && '-D USE_PRECOMPILED=false' || '' }}
cmake --build build
- ${{ runner.os != 'Windows' && 'sudo' || '' }} cmake --install build
+ ${{ runner.os != 'Windows' && 'sudo' || '' }} cmake --install build --config Debug
- name: Add to path (Windows)
if: runner.os == 'Windows'
run: echo "C:\Program Files (x86)\picotool\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
@@ -71,8 +86,11 @@
run: |
picotool help
curl -L https://datasheets.raspberrypi.com/soft/blink.uf2 -o blink.uf2
+ unzip -o blink.uf2 || true
curl -L https://datasheets.raspberrypi.com/soft/hello_world.uf2 -o hello_world.uf2
+ unzip -o hello_world.uf2 || true
curl -L https://datasheets.raspberrypi.com/soft/flash_nuke.uf2 -o flash_nuke.uf2
+ unzip -o flash_nuke.uf2 || true
picotool info -a blink.uf2
picotool info -a hello_world.uf2
picotool info -a flash_nuke.uf2
diff --git a/model/model.h b/model/model.h
index f942ec8..e17e33c 100644
--- a/model/model.h
+++ b/model/model.h
@@ -12,6 +12,14 @@
#include "rp2350_a3_rom_end.h"
#include "rp2350_a4_rom_end.h"
+// tsk namespace is polluted on windows
+#ifdef _WIN32
+#undef min
+#undef max
+
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
enum memory_type {
rom,
flash,