Skip to content

Commit 30b64bf

Browse files
authored
Add Harmony example project (#89)
As seen at FOSDEM 2025 Note: ignore formatting for now
1 parent 44da898 commit 30b64bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+4280
-3
lines changed

.editorconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
trim_trailing_whitespace = true
7+
insert_final_newline = true

.github/workflows/build-pico-sdk.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
board: pico
2121
- name: pico-w-blink-sdk
2222
board: pico_w
23+
- name: harmony
24+
board: pico_w
2325
swift: [swift-DEVELOPMENT-SNAPSHOT-2024-12-04-a]
2426

2527
steps:
@@ -41,8 +43,8 @@ jobs:
4143
- name: Install GNU ARM toolchain
4244
run: |
4345
ARCH=`uname -m`
44-
curl -sL https://developer.arm.com/-/media/Files/downloads/gnu/13.3.rel1/binrel/arm-gnu-toolchain-13.3.rel1-$ARCH-arm-none-eabi.tar.xz -O
45-
tar xf arm-gnu-toolchain-13.3.rel1-$ARCH-arm-none-eabi.tar.xz
46+
curl -sL https://developer.arm.com/-/media/Files/downloads/gnu/14.2.rel1/binrel/arm-gnu-toolchain-14.2.rel1-$ARCH-arm-none-eabi.tar.xz -O
47+
tar xf arm-gnu-toolchain-14.2.rel1-$ARCH-arm-none-eabi.tar.xz
4648
4749
- name: Install ${{ matrix.swift }}
4850
run: |
@@ -60,12 +62,20 @@ jobs:
6062
git submodule update --init --recursive
6163
cd ..
6264
65+
- name: Clone Pico Extras
66+
run: |
67+
git clone https://github.com/raspberrypi/pico-extras.git
68+
cd pico-extras
69+
git submodule update --init --recursive
70+
cd ..
71+
6372
- name: Set Pico environment variables
6473
run: |
6574
ARCH=`uname -m`
6675
echo "PICO_BOARD=${{ matrix.example.board }}" >> $GITHUB_ENV
6776
echo "PICO_SDK_PATH=`pwd`/pico-sdk" >> $GITHUB_ENV
68-
echo "PICO_TOOLCHAIN_PATH=`pwd`/arm-gnu-toolchain-13.3.rel1-$ARCH-arm-none-eabi" >> $GITHUB_ENV
77+
echo "PICO_EXTRAS_PATH=`pwd`/pico-extras" >> $GITHUB_ENV
78+
echo "PICO_TOOLCHAIN_PATH=`pwd`/arm-gnu-toolchain-14.2.rel1-$ARCH-arm-none-eabi" >> $GITHUB_ENV
6979
7080
- name: Build ${{ matrix.example.name }}
7181
run: |

.swiftformatignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./harmony/*

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Each example in this repository contains build and deployment instructions, howe
3939
| [pico-blink-sdk](./pico-blink-sdk) | Raspberry Pi Pico, Pico 2 | Pico SDK | Blink an LED repeatedly with Swift & the Pico SDK. | <img width="300" src="https://github.com/apple/swift-embedded-examples/assets/1186214/f2c45c18-f9a4-48b4-a941-1298ecc942cb"> |
4040
| [pico-blink](./pico-blink) | Raspberry Pi Pico | None | Blink an LED repeatedly. | <img width="300" src="https://github.com/apple/swift-embedded-examples/assets/1186214/f2c45c18-f9a4-48b4-a941-1298ecc942cb"> |
4141
| [pico-w-blink-sdk](./pico-w-blink-sdk) | Raspberry Pi Pico W | Pico SDK | Blink an LED to signal 'SOS' in Morse code repeatedly with Swift & the Pico SDK. | <img width="300" src="https://github.com/apple/swift-embedded-examples/assets/26223064/a4949a2e-1887-4325-8f5f-a681963c93d7"> |
42+
| [harmony](./harmony) | Raspberry Pi Pico W | Pico SDK | A bluetooth speaker and ferrofluidic music visualizer. Firmware, Electrical, and Mechanical designs fully available. | <img width="300" src="harmony/assets/harmony.jpeg"> |
4243
| [pico2-neopixel](./pico2-neopixel) | Raspberry Pi Pico 2 | None | Control Neopixel LEDs using the RP2350 PIO. | <img width="300" src="pico2-neopixel/assets/images/example.jpg"> |
4344
| [rpi4b-blink](./rpi4b-blink) | Raspberry Pi 4B | None | Blink the Pi's status green LED repeatedly using Swift MMIO. | <img width="300" src="rpi4b-blink/assets/rpi4.png"> |
4445
| [rpi5-blink](./rpi5-blink) | Raspberry Pi 5 | None | Blink the Pi's status green LED repeatedly with Swift MMIO. | <img width="300" src="rpi5-blink/assets/raspi5.png"> |

harmony/.vscode/settings.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"swift.path": "/Users/rauhul/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2025-01-05-a.xctoolchain/usr/bin",
3+
"swift.swiftEnvironmentVariables": {
4+
"DEVELOPER_DIR": "/Applications/Xcode.app/"
5+
},
6+
"cmake.environment": {
7+
"TOOLCHAINS": "org.swift.62202501051a",
8+
"PICO_BOARD": "pico_w",
9+
"PICO_PLATFORM": "rp2040",
10+
"PICO_SDK_PATH": "/Volumes/Developer/org.swift/swift-embedded-examples/harmony/pico-sdk",
11+
"PICO_TOOLCHAIN_PATH": "/Volumes/Developer/org.swift/swift-embedded-examples/harmony/arm-gnu-toolchain-14.2.rel1-darwin-arm64-arm-none-eabi",
12+
"PICO_EXTRAS_PATH": "/Volumes/Developer/org.swift/swift-embedded-examples/harmony/pico-extras",
13+
},
14+
"cmake.generator": "Ninja",
15+
"swift.disableAutoResolve": true
16+
}

harmony/.vscode/tasks.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "cmake",
6+
"label": "CMake: build",
7+
"command": "build",
8+
"targets": [
9+
"all"
10+
],
11+
"group": {
12+
"kind": "build",
13+
"isDefault": true
14+
},
15+
"presentation": {
16+
"clear": true
17+
}
18+
},
19+
{
20+
"label": "deploy",
21+
"type": "shell",
22+
"command": "cp build/app.uf2 /Volumes/RPI-RP2/",
23+
"group": {
24+
"kind": "build",
25+
"isDefault": false
26+
},
27+
"presentation": {
28+
"clear": true,
29+
"reveal": "always",
30+
"panel": "shared"
31+
}
32+
}
33+
]
34+
}

harmony/ACKNOWLEDGEMENTS.md

Lines changed: 277 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,277 @@
1+
2+
# Acknowledgements
3+
4+
Harmony is built on top of wonderful software provided by:
5+
6+
## Pico-SDK
7+
8+
Copyright 2020 (c) 2020 Raspberry Pi (Trading) Ltd.
9+
10+
Redistribution and use in source and binary forms, with or without modification,
11+
are permitted provided that the following conditions are met:
12+
13+
1. Redistributions of source code must retain the above copyright notice, this
14+
list of conditions and the following disclaimer.
15+
16+
2. Redistributions in binary form must reproduce the above copyright notice,
17+
this list of conditions and the following disclaimer in the documentation
18+
and/or other materials provided with the distribution.
19+
20+
3. Neither the name of the copyright holder nor the names of its contributors
21+
may be used to endorse or promote products derived from this software without
22+
specific prior written permission.
23+
24+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
25+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
28+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
31+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34+
35+
## Pico-Extras
36+
37+
Copyright 2020 (c) 2020 Raspberry Pi (Trading) Ltd.
38+
39+
Redistribution and use in source and binary forms, with or without modification,
40+
are permitted provided that the following conditions are met:
41+
42+
1. Redistributions of source code must retain the above copyright notice, this
43+
list of conditions and the following disclaimer.
44+
45+
2. Redistributions in binary form must reproduce the above copyright notice,
46+
this list of conditions and the following disclaimer in the documentation
47+
and/or other materials provided with the distribution.
48+
49+
3. Neither the name of the copyright holder nor the names of its contributors
50+
may be used to endorse or promote products derived from this software without
51+
specific prior written permission.
52+
53+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
54+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
55+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
56+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
57+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
58+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
59+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
60+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
61+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
62+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63+
64+
## BTStack
65+
66+
Copyright (C) 2009 BlueKitchen GmbH
67+
All rights reserved
68+
69+
Redistribution and use in source and binary forms, with or without modification,
70+
are permitted provided that the following conditions are met:
71+
72+
1. Redistributions of source code must retain the above copyright notice, this
73+
list of conditions and the following disclaimer.
74+
75+
2. Redistributions in binary form must reproduce the above copyright notice,
76+
this list of conditions and the following disclaimer in the documentation
77+
and/or other materials provided with the distribution.
78+
79+
3. Neither the name of the copyright holders nor the names of contributors may
80+
be used to endorse or promote products derived from this software without
81+
specific prior written permission.
82+
83+
4. Any redistribution, use, or modification is done solely for personal benefit
84+
and not for any commercial purpose or for monetary gain.
85+
86+
THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS ``AS IS'' AND ANY
87+
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
88+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
89+
DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN GMBH OR CONTRIBUTORS BE LIABLE FOR
90+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
91+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
92+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
93+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
94+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
95+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
96+
97+
Please inquire about commercial licensing options at
98+
99+
100+
## CMSIS-DSP
101+
102+
Apache License
103+
Version 2.0, January 2004
104+
http://www.apache.org/licenses/
105+
106+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
107+
108+
1. Definitions.
109+
110+
"License" shall mean the terms and conditions for use, reproduction,
111+
and distribution as defined by Sections 1 through 9 of this document.
112+
113+
"Licensor" shall mean the copyright owner or entity authorized by
114+
the copyright owner that is granting the License.
115+
116+
"Legal Entity" shall mean the union of the acting entity and all
117+
other entities that control, are controlled by, or are under common
118+
control with that entity. For the purposes of this definition,
119+
"control" means (i) the power, direct or indirect, to cause the
120+
direction or management of such entity, whether by contract or
121+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
122+
outstanding shares, or (iii) beneficial ownership of such entity.
123+
124+
"You" (or "Your") shall mean an individual or Legal Entity
125+
exercising permissions granted by this License.
126+
127+
"Source" form shall mean the preferred form for making modifications,
128+
including but not limited to software source code, documentation
129+
source, and configuration files.
130+
131+
"Object" form shall mean any form resulting from mechanical
132+
transformation or translation of a Source form, including but
133+
not limited to compiled object code, generated documentation,
134+
and conversions to other media types.
135+
136+
"Work" shall mean the work of authorship, whether in Source or
137+
Object form, made available under the License, as indicated by a
138+
copyright notice that is included in or attached to the work
139+
(an example is provided in the Appendix below).
140+
141+
"Derivative Works" shall mean any work, whether in Source or Object
142+
form, that is based on (or derived from) the Work and for which the
143+
editorial revisions, annotations, elaborations, or other modifications
144+
represent, as a whole, an original work of authorship. For the purposes
145+
of this License, Derivative Works shall not include works that remain
146+
separable from, or merely link (or bind by name) to the interfaces of,
147+
the Work and Derivative Works thereof.
148+
149+
"Contribution" shall mean any work of authorship, including
150+
the original version of the Work and any modifications or additions
151+
to that Work or Derivative Works thereof, that is intentionally
152+
submitted to Licensor for inclusion in the Work by the copyright owner
153+
or by an individual or Legal Entity authorized to submit on behalf of
154+
the copyright owner. For the purposes of this definition, "submitted"
155+
means any form of electronic, verbal, or written communication sent
156+
to the Licensor or its representatives, including but not limited to
157+
communication on electronic mailing lists, source code control systems,
158+
and issue tracking systems that are managed by, or on behalf of, the
159+
Licensor for the purpose of discussing and improving the Work, but
160+
excluding communication that is conspicuously marked or otherwise
161+
designated in writing by the copyright owner as "Not a Contribution."
162+
163+
"Contributor" shall mean Licensor and any individual or Legal Entity
164+
on behalf of whom a Contribution has been received by Licensor and
165+
subsequently incorporated within the Work.
166+
167+
2. Grant of Copyright License. Subject to the terms and conditions of
168+
this License, each Contributor hereby grants to You a perpetual,
169+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
170+
copyright license to reproduce, prepare Derivative Works of,
171+
publicly display, publicly perform, sublicense, and distribute the
172+
Work and such Derivative Works in Source or Object form.
173+
174+
3. Grant of Patent License. Subject to the terms and conditions of
175+
this License, each Contributor hereby grants to You a perpetual,
176+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
177+
(except as stated in this section) patent license to make, have made,
178+
use, offer to sell, sell, import, and otherwise transfer the Work,
179+
where such license applies only to those patent claims licensable
180+
by such Contributor that are necessarily infringed by their
181+
Contribution(s) alone or by combination of their Contribution(s)
182+
with the Work to which such Contribution(s) was submitted. If You
183+
institute patent litigation against any entity (including a
184+
cross-claim or counterclaim in a lawsuit) alleging that the Work
185+
or a Contribution incorporated within the Work constitutes direct
186+
or contributory patent infringement, then any patent licenses
187+
granted to You under this License for that Work shall terminate
188+
as of the date such litigation is filed.
189+
190+
4. Redistribution. You may reproduce and distribute copies of the
191+
Work or Derivative Works thereof in any medium, with or without
192+
modifications, and in Source or Object form, provided that You
193+
meet the following conditions:
194+
195+
(a) You must give any other recipients of the Work or
196+
Derivative Works a copy of this License; and
197+
198+
(b) You must cause any modified files to carry prominent notices
199+
stating that You changed the files; and
200+
201+
(c) You must retain, in the Source form of any Derivative Works
202+
that You distribute, all copyright, patent, trademark, and
203+
attribution notices from the Source form of the Work,
204+
excluding those notices that do not pertain to any part of
205+
the Derivative Works; and
206+
207+
(d) If the Work includes a "NOTICE" text file as part of its
208+
distribution, then any Derivative Works that You distribute must
209+
include a readable copy of the attribution notices contained
210+
within such NOTICE file, excluding those notices that do not
211+
pertain to any part of the Derivative Works, in at least one
212+
of the following places: within a NOTICE text file distributed
213+
as part of the Derivative Works; within the Source form or
214+
documentation, if provided along with the Derivative Works; or,
215+
within a display generated by the Derivative Works, if and
216+
wherever such third-party notices normally appear. The contents
217+
of the NOTICE file are for informational purposes only and
218+
do not modify the License. You may add Your own attribution
219+
notices within Derivative Works that You distribute, alongside
220+
or as an addendum to the NOTICE text from the Work, provided
221+
that such additional attribution notices cannot be construed
222+
as modifying the License.
223+
224+
You may add Your own copyright statement to Your modifications and
225+
may provide additional or different license terms and conditions
226+
for use, reproduction, or distribution of Your modifications, or
227+
for any such Derivative Works as a whole, provided Your use,
228+
reproduction, and distribution of the Work otherwise complies with
229+
the conditions stated in this License.
230+
231+
5. Submission of Contributions. Unless You explicitly state otherwise,
232+
any Contribution intentionally submitted for inclusion in the Work
233+
by You to the Licensor shall be under the terms and conditions of
234+
this License, without any additional terms or conditions.
235+
Notwithstanding the above, nothing herein shall supersede or modify
236+
the terms of any separate license agreement you may have executed
237+
with Licensor regarding such Contributions.
238+
239+
6. Trademarks. This License does not grant permission to use the trade
240+
names, trademarks, service marks, or product names of the Licensor,
241+
except as required for reasonable and customary use in describing the
242+
origin of the Work and reproducing the content of the NOTICE file.
243+
244+
7. Disclaimer of Warranty. Unless required by applicable law or
245+
agreed to in writing, Licensor provides the Work (and each
246+
Contributor provides its Contributions) on an "AS IS" BASIS,
247+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
248+
implied, including, without limitation, any warranties or conditions
249+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
250+
PARTICULAR PURPOSE. You are solely responsible for determining the
251+
appropriateness of using or redistributing the Work and assume any
252+
risks associated with Your exercise of permissions under this License.
253+
254+
8. Limitation of Liability. In no event and under no legal theory,
255+
whether in tort (including negligence), contract, or otherwise,
256+
unless required by applicable law (such as deliberate and grossly
257+
negligent acts) or agreed to in writing, shall any Contributor be
258+
liable to You for damages, including any direct, indirect, special,
259+
incidental, or consequential damages of any character arising as a
260+
result of this License or out of the use or inability to use the
261+
Work (including but not limited to damages for loss of goodwill,
262+
work stoppage, computer failure or malfunction, or any and all
263+
other commercial damages or losses), even if such Contributor
264+
has been advised of the possibility of such damages.
265+
266+
9. Accepting Warranty or Additional Liability. While redistributing
267+
the Work or Derivative Works thereof, You may choose to offer,
268+
and charge a fee for, acceptance of support, warranty, indemnity,
269+
or other liability obligations and/or rights consistent with this
270+
License. However, in accepting such obligations, You may act only
271+
on Your own behalf and on Your sole responsibility, not on behalf
272+
of any other Contributor, and only if You agree to indemnify,
273+
defend, and hold each Contributor harmless for any liability
274+
incurred by, or claims asserted against, such Contributor by reason
275+
of your accepting any such warranty or additional liability.
276+
277+
END OF TERMS AND CONDITIONS

0 commit comments

Comments
 (0)