1+ name : 👨🏻💻 QEMU
2+
3+ on :
4+ workflow_call :
5+ inputs :
6+ repo :
7+ type : string
8+ default : ${{ github.repository }}
9+ version :
10+ type : string
11+ default : " "
12+ conan_version :
13+ type : string
14+ default : " "
15+ compiler_profile_url :
16+ type : string
17+ required : true
18+ compiler_profile :
19+ type : string
20+ required : true
21+ compiler_profile_branch :
22+ type : string
23+ default : " main"
24+ platform_profile_url :
25+ type : string
26+ required : true
27+ platform_profile :
28+ type : string
29+ required : true
30+ platform_profile_branch :
31+ type : string
32+ default : " main"
33+ jobs :
34+ build_release : # b/c building the debug does not guarantee that normal build works
35+ uses :
libhal/ci/.github/workflows/[email protected] 36+ with :
37+ compiler_profile_url : ${{ inputs.compiler_profile_url }}
38+ compiler_profile : ${{ inputs.compiler_profile }}
39+ platform_profile_url : ${{ inputs.platform_profile_url }}
40+ platform_profile : ${{ inputs.platform_profile }}
41+ secrets : inherit
42+
43+ build_debug : # STOLEN from libhal/ci
44+ runs-on : ubuntu-22.04
45+ steps :
46+ 47+ if : ${{ inputs.version != '' }}
48+ with :
49+ submodules : true
50+ repository : ${{ inputs.repo }}
51+ ref : ${{ inputs.version }}
52+
53+ 54+ if : ${{ inputs.version == '' }}
55+ with :
56+ submodules : true
57+ repository : ${{ inputs.repo }}
58+
59+ - name : 📥 Install Conan ${{ inputs.conan_version }}
60+ if : ${{ inputs.conan_version != '' }}
61+ run : pipx install conan==${{ inputs.conan_version }}
62+
63+ - name : 📥 Install Conan Latest
64+ if : ${{ inputs.conan_version == '' }}
65+ run : pipx install conan
66+
67+ - name : 📡 Add `libhal` repo to conan remotes
68+ run : conan remote add libhal
69+ https://libhal.jfrog.io/artifactory/api/conan/trunk-conan
70+
71+ - name : 📡 Create and setup default profile
72+ run : conan profile detect --force
73+
74+ - name : 👁️🗨️ Show conan profile
75+ run : conan profile show
76+
77+ - name : Install libhal settings_user.yml
78+ run : conan config install -sf profiles/baremetal/v2 https://github.com/libhal/conan-config.git
79+
80+ - name : Install compiler profiles
81+ run : conan config install -tf profiles -sf conan/profiles --args "-b ${{ inputs.compiler_profile_branch }} --single-branch" ${{ inputs.compiler_profile_url }}
82+
83+ - name : Install platform profiles
84+ run : conan config install -tf profiles -sf conan/profiles --args "-b ${{ inputs.platform_profile_branch }} --single-branch" ${{ inputs.platform_profile_url }}
85+
86+ - name : 🏗️ Build debug demos for ${{ inputs.platform_profile }}
87+ run : conan build demos -pr ${{ inputs.compiler_profile }} -pr ${{ inputs.platform_profile }} -s build_type=Debug
88+
89+ - name : Trim profile version
90+ id : trim
91+ run : |
92+ profile="${{ inputs.platform_profile }}"
93+ echo "trimmed=${profile##*/}" >> $GITHUB_OUTPUT
94+
95+ - name : 🚀 Upload build artifacts
96+ uses : actions/upload-artifact@v4
97+ with :
98+ name : build-${{ steps.trim.outputs.trimmed }}
99+ path : demos/build/
100+
101+ check_single_level :
102+ runs-on : ubuntu-24.04
103+ needs : build_debug
104+ steps :
105+ - name : Install Dependencies
106+ run : |
107+ sudo apt-get update
108+ sudo apt-get install qemu-system-arm gdb-multiarch
109+
110+ - name : Trim profile version
111+ id : trim
112+ run : |
113+ profile="${{ inputs.platform_profile }}"
114+ echo "trimmed=${profile##*/}" >> $GITHUB_OUTPUT
115+
116+ - name : Download Build Artifacts
117+ uses : actions/download-artifact@v4
118+ with :
119+ name : build-${{ steps.trim.outputs.trimmed }}
120+
121+ - name : Run Single Level Demo
122+ run : |
123+ nohup qemu-system-arm \
124+ -M olimex-stm32-h405 \
125+ -kernel ${{ github.workspace }}/${{ steps.trim.outputs.trimmed }}/Debug/single_level.elf \
126+ -S -s -nographic \
127+ &
128+
129+ timeout 5s gdb-multiarch --batch \
130+ -ex "set output-radix 16" \
131+ -ex "target remote :1234" \
132+ -ex "watch global" \
133+ -ex "continue" \
134+ -ex "monitor quit" \
135+ ${{ github.workspace }}/${{ steps.trim.outputs.trimmed }}/Debug/single_level.elf \
136+ > gdb.log || {
137+ # Make timeouts more explicit
138+ code=$?
139+ if [ "$code" -eq 124 ]; then
140+ echo "❌ GDB timeout after 5 seconds" >&2
141+ else
142+ echo "❌ GDB failed with code $code" >&2
143+ fi
144+ exit $code
145+ }
146+
147+ - name : Check Single Level Result
148+ run : |
149+ cat gdb.log
150+ grep -q "New value = 0x5" gdb.log
151+
152+ check_multiple_inheritance :
153+ runs-on : ubuntu-24.04
154+ needs : build_debug
155+ steps :
156+ - name : Install Dependencies
157+ run : |
158+ sudo apt-get update
159+ sudo apt-get install qemu-system-arm gdb-multiarch
160+
161+ - name : Trim profile version
162+ id : trim
163+ run : |
164+ profile="${{ inputs.platform_profile }}"
165+ echo "trimmed=${profile##*/}" >> $GITHUB_OUTPUT
166+
167+ - name : Download Build Artifacts
168+ uses : actions/download-artifact@v4
169+ with :
170+ name : build-${{ steps.trim.outputs.trimmed }}
171+
172+ - name : Run Multiple Inheritance Demo
173+ run : |
174+ nohup qemu-system-arm \
175+ -M olimex-stm32-h405 \
176+ -kernel ${{ github.workspace }}/${{ steps.trim.outputs.trimmed }}/Debug/multiple_inheritance.elf \
177+ -S -s -nographic \
178+ &
179+
180+ timeout 5s gdb-multiarch --batch \
181+ -ex "set output-radix 16" \
182+ -ex "target remote :1234" \
183+ -ex "watch global" \
184+ -ex "continue" \
185+ -ex "monitor quit" \
186+ ${{ github.workspace }}/${{ steps.trim.outputs.trimmed }}/Debug/multiple_inheritance.elf \
187+ > gdb.log || {
188+ # Make timeouts more explicit
189+ code=$?
190+ if [ "$code" -eq 124 ]; then
191+ echo "❌ GDB timeout after 5 seconds" >&2
192+ else
193+ echo "❌ GDB failed with code $code" >&2
194+ fi
195+ exit $code
196+ }
197+
198+ - name : Check Multiple Inheritance Result
199+ run : |
200+ cat gdb.log
201+ grep -q "New value = 0x6666" gdb.log
202+
0 commit comments