Skip to content

Commit 2aad1d4

Browse files
authored
Merge pull request #41 from visrealm/feature/cmake-configurator
Feature/cmake configurator
2 parents f130afa + 2d962c9 commit 2aad1d4

28 files changed

+1986
-505
lines changed

.github/workflows/configurator.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Configurator
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Firmware"]
6+
types:
7+
- completed
8+
9+
jobs:
10+
windows:
11+
runs-on: windows-latest
12+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
submodules: recursive
18+
19+
- name: Install Python dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install pillow
23+
24+
- name: Download firmware artifact from workflow
25+
uses: actions/github-script@v7
26+
with:
27+
script: |
28+
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
29+
owner: context.repo.owner,
30+
repo: context.repo.repo,
31+
run_id: context.payload.workflow_run.id,
32+
});
33+
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
34+
return artifact.name == "firmware-windows"
35+
})[0];
36+
let download = await github.rest.actions.downloadArtifact({
37+
owner: context.repo.owner,
38+
repo: context.repo.repo,
39+
artifact_id: matchArtifact.id,
40+
archive_format: 'zip',
41+
});
42+
let fs = require('fs');
43+
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/firmware-windows.zip`, Buffer.from(download.data));
44+
45+
- name: Extract firmware artifact
46+
run: |
47+
Expand-Archive -Path firmware-windows.zip -DestinationPath build/dist
48+
Remove-Item firmware-windows.zip
49+
50+
- name: Setup build environment and build configurator
51+
run: |
52+
cd build
53+
cmake -S .. -B . -G Ninja -DBUILD_TOOLS_FROM_SOURCE=ON -DCONFIGURATOR_ONLY=ON
54+
cmake --build . --target configurator_all
55+
56+
- name: Upload Configurator Artifacts
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: configurator-windows
60+
path: |
61+
build/dist/*.rom
62+
build/dist/*.bin
63+
build/dist/*.nabu
64+
build/dist/*.npz
65+
66+
linux:
67+
runs-on: ubuntu-latest
68+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
69+
70+
steps:
71+
- uses: actions/checkout@v4
72+
with:
73+
submodules: recursive
74+
75+
- name: Download firmware artifact from workflow
76+
uses: actions/github-script@v7
77+
with:
78+
script: |
79+
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
80+
owner: context.repo.owner,
81+
repo: context.repo.repo,
82+
run_id: context.payload.workflow_run.id,
83+
});
84+
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
85+
return artifact.name == "firmware-linux"
86+
})[0];
87+
let download = await github.rest.actions.downloadArtifact({
88+
owner: context.repo.owner,
89+
repo: context.repo.repo,
90+
artifact_id: matchArtifact.id,
91+
archive_format: 'zip',
92+
});
93+
let fs = require('fs');
94+
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/firmware-linux.zip`, Buffer.from(download.data));
95+
96+
- name: Extract firmware artifact
97+
run: |
98+
mkdir -p build/dist
99+
unzip firmware-linux.zip -d build/dist
100+
rm firmware-linux.zip
101+
102+
- name: Setup build environment and build configurator
103+
run: |
104+
cd build
105+
cmake -S .. -B . -G Ninja -DBUILD_TOOLS_FROM_SOURCE=ON -DCONFIGURATOR_ONLY=ON
106+
cmake --build . --target configurator_all
107+
108+
- name: Upload Configurator Artifacts
109+
uses: actions/upload-artifact@v4
110+
with:
111+
name: configurator-linux
112+
path: |
113+
build/dist/*.rom
114+
build/dist/*.bin
115+
build/dist/*.nabu
116+
build/dist/*.npz

.github/workflows/firmware.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Firmware
2+
3+
on:
4+
push:
5+
branches: [ main, cmake-configurator ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
windows:
11+
runs-on: windows-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
submodules: recursive
17+
18+
- name: Install Python dependencies
19+
run: |
20+
python -m pip install --upgrade pip
21+
pip install pillow
22+
23+
- name: Install ARM GNU Toolchain
24+
run: |
25+
$url = "https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/download/v13.2.1-1.1/xpack-arm-none-eabi-gcc-13.2.1-1.1-win32-x64.zip"
26+
$output = "arm-toolchain.zip"
27+
Invoke-WebRequest -Uri $url -OutFile $output
28+
Expand-Archive -Path $output -DestinationPath "C:\arm-toolchain"
29+
echo "C:\arm-toolchain\xpack-arm-none-eabi-gcc-13.2.1-1.1\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
30+
31+
- name: Install Pico SDK 2.1.1 manually
32+
run: |
33+
git clone -b 2.1.1 --depth 1 https://github.com/raspberrypi/pico-sdk.git pico-sdk
34+
cd pico-sdk
35+
git submodule update --init
36+
git apply --ignore-whitespace --ignore-space-change --3way ../picosdk-2.0.0-visrealm-fastboot.patch || echo "Patch failed or already applied"
37+
cd ..
38+
39+
- name: Configure CMake
40+
run: |
41+
mkdir build
42+
cd build
43+
cmake -S .. -B . -G Ninja -DPICO_SDK_PATH="$PWD/../pico-sdk" -DPICO_BOARD_HEADER_DIRS="../src/boards" -DPICO_BOARD=pico9918
44+
45+
- name: Build Firmware
46+
run: |
47+
cd build
48+
cmake --build . --target firmware
49+
50+
- name: Upload Firmware Artifacts
51+
uses: actions/upload-artifact@v4
52+
with:
53+
name: firmware-windows
54+
path: build/dist/*.uf2
55+
56+
linux:
57+
runs-on: ubuntu-latest
58+
59+
steps:
60+
- uses: actions/checkout@v4
61+
with:
62+
submodules: recursive
63+
64+
- name: Install dependencies
65+
run: |
66+
sudo apt-get update
67+
sudo apt-get install -y build-essential cmake python3 python3-pip git gcc-arm-none-eabi
68+
pip3 install pillow
69+
70+
- name: Install Pico SDK 2.1.1 manually
71+
run: |
72+
git clone -b 2.1.1 --depth 1 https://github.com/raspberrypi/pico-sdk.git pico-sdk
73+
cd pico-sdk
74+
git submodule update --init
75+
git apply --ignore-whitespace --ignore-space-change --3way ../picosdk-2.0.0-visrealm-fastboot.patch || echo "Patch failed or already applied"
76+
cd ..
77+
78+
- name: Configure CMake
79+
run: |
80+
mkdir build
81+
cd build
82+
cmake -S .. -B . -G Ninja -DPICO_SDK_PATH="$PWD/../pico-sdk" -DPICO_BOARD_HEADER_DIRS="../src/boards" -DPICO_BOARD=pico9918
83+
84+
- name: Build Firmware
85+
run: |
86+
cd build
87+
cmake --build . --target firmware
88+
89+
- name: Upload Firmware Artifacts
90+
uses: actions/upload-artifact@v4
91+
with:
92+
name: firmware-linux
93+
path: build/dist/*.uf2

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
"cmake.configureOnOpen": false,
1717
"cmake.generator": "Ninja",
1818
"cmake.cmakePath": "${userHome}/.pico-sdk/cmake/v3.31.5/bin/cmake",
19+
"cmake.configureArgs": [
20+
"-DPICO9918_SCART_RGBS=OFF",
21+
"-DPICO9918_SCART_PAL=OFF",
22+
"-DPICO9918_NO_SPLASH=OFF",
23+
"-DPICO9918_DIAG=OFF"
24+
],
1925
"C_Cpp.debugShortcut": false,
2026
"terminal.integrated.env.windows": {
2127
"PICO_SDK_PATH": "${env:USERPROFILE}/.pico-sdk/sdk/2.1.1",

.vscode/tasks.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,58 @@
5353
"windows": {
5454
"command": "${env:USERPROFILE}/.pico-sdk/openocd/0.12.0+dev/openocd.exe",
5555
}
56+
},
57+
{
58+
"label": "Build All Configurator ROMs",
59+
"type": "shell",
60+
"command": "cmake",
61+
"args": ["--build", "./build", "--target", "configurator_all"],
62+
"group": "build",
63+
"presentation": {
64+
"reveal": "always",
65+
"panel": "shared"
66+
},
67+
"problemMatcher": "$gcc",
68+
"dependsOn": "Compile Project"
69+
},
70+
{
71+
"label": "Build TI-99 Configurator",
72+
"type": "shell",
73+
"command": "cmake",
74+
"args": ["--build", "./build", "--target", "ti99"],
75+
"group": "build",
76+
"presentation": {
77+
"reveal": "always",
78+
"panel": "shared"
79+
},
80+
"problemMatcher": "$gcc",
81+
"dependsOn": "Compile Project"
82+
},
83+
{
84+
"label": "Build ColecoVision Configurator",
85+
"type": "shell",
86+
"command": "cmake",
87+
"args": ["--build", "./build", "--target", "coleco"],
88+
"group": "build",
89+
"presentation": {
90+
"reveal": "always",
91+
"panel": "shared"
92+
},
93+
"problemMatcher": "$gcc",
94+
"dependsOn": "Compile Project"
95+
},
96+
{
97+
"label": "Build MSX Configurator",
98+
"type": "shell",
99+
"command": "cmake",
100+
"args": ["--build", "./build", "--target", "msx_asc16"],
101+
"group": "build",
102+
"presentation": {
103+
"reveal": "always",
104+
"panel": "shared"
105+
},
106+
"problemMatcher": "$gcc",
107+
"dependsOn": "Compile Project"
56108
}
57109
]
58110
}

0 commit comments

Comments
 (0)