Skip to content

Commit de439d7

Browse files
authored
Merge branch 'swiftlang:main' into main
2 parents b210164 + 3134ab4 commit de439d7

File tree

48 files changed

+4465
-598
lines changed

Some content is hidden

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

48 files changed

+4465
-598
lines changed

.github/actions/install-swift/action.yml

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@ description: Installs the Swift specified by a .swift-version file
44
runs:
55
using: "composite"
66
steps:
7-
# - name: "Cache: Swift"
8-
# id: cache-swift
9-
# uses: actions/cache@v4
10-
# with:
11-
# path: "$HOME/.local/share/swiftly"
12-
# key: swift-${{ hashFiles('.swift-version') }}
13-
147
- name: Setup Environment
158
shell: bash
169
run: |
10+
mkdir -p "$HOME/.local/share"
11+
12+
export SWIFTLY_TOOLCHAINS_DIR="$HOME/.local/share/swiftly/toolchains"
13+
echo "SWIFTLY_TOOLCHAINS_DIR=$SWIFTLY_TOOLCHAINS_DIR" >> $GITHUB_ENV
14+
echo "SWIFTLY_TOOLCHAINS_DIR=$SWIFTLY_TOOLCHAINS_DIR" >> $HOME/.bashrc
15+
1716
export SWIFTLY_HOME_DIR="$HOME/.local/share/swiftly"
1817
echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> $GITHUB_ENV
1918
echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> $HOME/.bashrc
@@ -25,15 +24,15 @@ runs:
2524
echo "PATH=$SWIFTLY_BIN_DIR:$PATH" >> $GITHUB_ENV
2625
echo "PATH=\$SWIFTLY_BIN_DIR:\$PATH" >> $HOME/.bashrc
2726
28-
- name: "Restore: Swift"
27+
- name: Restore Swift
2928
uses: actions/cache/restore@v4
3029
id: cache-swift
3130
with:
3231
path: "~/.local/share/swiftly"
33-
key: swift-${{ hashFiles('**/.swift-version') }}
32+
key: swift-${{ runner.os }}-${{ hashFiles('**/.swift-version', '.github/actions/install-swift/action.yml') }}
3433

3534
- name: Install `apt` Dependencies
36-
if: steps.cache-swift.outputs.cache-hit != 'true'
35+
if: runner.os == 'Linux' && steps.cache-swift.outputs.cache-hit != 'true'
3736
shell: bash
3837
run: |
3938
SUDO=$(if [[ $EUID -ne 0 ]]; then echo sudo; fi)
@@ -43,29 +42,47 @@ runs:
4342
DEBIAN_FRONTEND: noninteractive
4443

4544
- name: Install Swiftly
46-
if: steps.cache-swift.outputs.cache-hit != 'true'
45+
if: runner.os == 'Linux' && steps.cache-swift.outputs.cache-hit != 'true'
4746
shell: bash
4847
run: |
48+
SWIFTLY_VERSION=1.0.1
4949
UNAME=$(uname -m)
50-
curl -O "https://download.swift.org/swiftly/linux/swiftly-$UNAME.tar.gz"
51-
tar zxf "swiftly-$UNAME.tar.gz"
50+
SWIFTLY_TGZ=swiftly-$SWIFTLY_VERSION-$UNAME.tar.gz
51+
curl -O "https://download.swift.org/swiftly/linux/$SWIFTLY_TGZ"
52+
tar zxf "$SWIFTLY_TGZ"
5253
./swiftly init \
5354
--skip-install \
5455
--assume-yes \
5556
--quiet-shell-followup \
5657
--no-modify-profile
5758
59+
- name: Install Swiftly
60+
if: runner.os == 'macOS' && steps.cache-swift.outputs.cache-hit != 'true'
61+
shell: bash
62+
run: |
63+
SWIFTLY_VERSION=1.0.1
64+
SWIFTLY_PKG=swiftly-$SWIFTLY_VERSION.pkg
65+
curl -O "https://download.swift.org/swiftly/darwin/$SWIFTLY_PKG"
66+
pkgutil --check-signature $SWIFTLY_PKG
67+
pkgutil --verbose --expand $SWIFTLY_PKG $SWIFTLY_HOME_DIR
68+
tar -C $SWIFTLY_HOME_DIR -xvf $SWIFTLY_HOME_DIR/swiftly-*/Payload
69+
"$SWIFTLY_BIN_DIR/swiftly" init \
70+
--skip-install \
71+
--assume-yes \
72+
--quiet-shell-followup \
73+
--no-modify-profile
74+
5875
- name: Install Swift
5976
if: steps.cache-swift.outputs.cache-hit != 'true'
6077
shell: bash
6178
run: swiftly install --post-install-file ./out.sh
6279

63-
- name: "Save: Swift"
80+
- name: Save Swift
6481
if: steps.cache-swift.outputs.cache-hit != 'true'
6582
uses: actions/cache/save@v4
6683
with:
6784
path: "~/.local/share/swiftly"
68-
key: swift-${{ hashFiles('**/.swift-version') }}
85+
key: swift-${{ runner.os }}-${{ hashFiles('**/.swift-version', '.github/actions/install-swift/action.yml') }}
6986

7087
- name: Print Swift Version
7188
shell: bash
Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: STM32
1+
name: STM32 ELF
22

33
on:
44
push:
@@ -15,16 +15,12 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
example: [stm32-blink, stm32-lvgl]
18+
example: [stm32-lvgl]
1919

2020
steps:
2121
- name: Checkout repo
2222
uses: actions/checkout@v4
2323

24-
- name: Fixup for running locally in act
25-
if: ${{ env.ACT }}
26-
run: echo /opt/acttoolcache/node/18.20.8/x64/bin >> $GITHUB_PATH
27-
2824
- name: Set up Python
2925
uses: actions/setup-python@v5
3026
with:
@@ -36,21 +32,11 @@ jobs:
3632
- name: Install Swift
3733
uses: ./.github/actions/install-swift
3834

39-
- name: Set environment variables
40-
run: |
41-
echo "STM_BOARD=STM32F746G_DISCOVERY" >> $GITHUB_ENV
42-
4335
- name: Build ${{ matrix.example }}
4436
working-directory: ${{ matrix.example }}
4537
run: |
4638
if [[ -f ./fetch-dependencies.sh ]]; then
4739
./fetch-dependencies.sh
4840
fi
4941
50-
if [[ -f ./build-elf.sh ]]; then
51-
./build-elf.sh
52-
fi
53-
54-
if [[ -f Makefile ]]; then
55-
make
56-
fi
42+
make
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: STM32 Macho
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
types: [opened, reopened, synchronize, ready_for_review]
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
name: Build
13+
runs-on: [self-hosted, macos, sequoia, ARM64]
14+
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
example: [stm32-blink, stm32-lcd-logo, stm32-neopixel, stm32-uart-echo]
19+
20+
steps:
21+
- name: Checkout repo
22+
uses: actions/checkout@v4
23+
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@v5
26+
with:
27+
python-version: 3.11
28+
29+
- name: Install Swift
30+
uses: ./.github/actions/install-swift
31+
32+
- name: Build ${{ matrix.example }}
33+
working-directory: ${{ matrix.example }}
34+
run: make

.swift-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
main-snapshot-2025-06-01
1+
main-snapshot-2025-09-06

.swiftformatignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
./harmony/*
2-
./stm32-lvgl/*
2+
./stm32-blink/Sources/STM32F7X6/*
33
./stm32-lcd-logo/Sources/STM32F7X6/*
4+
./stm32-lvgl/*
45
./stm32-lvgl/Sources/Registers/*
56
./stm32-neopixel/Sources/STM32F7X6/*
67
./stm32-uart-echo/Sources/STM32F7X6/*

Documentation/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ Documentation for Embedded Swift
22
================================
33

44
Documentation for Embedded Swift can be found at these locations:
5-
- [in rendered form](https://swiftpackageindex.com/swiftlang/swift-embedded-examples/documentation/embeddedswift)
5+
- [in rendered form at docs.swift.org](https://docs.swift.org/embedded/documentation/embedded/)
66
- [DocC source code](/Sources/EmbeddedSwift/Documentation.docc)

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This repository is a set of demonstration projects of **Embedded Swift**. Embedd
1212

1313
Each example in this repository contains build and deployment instructions, however there are a couple common steps needed for many of the examples included below:
1414

15-
1. Install [`swift`](https://swift.org) using the [instructions here](https://swiftpackageindex.com/swiftlang/swift-embedded-examples/main/documentation/embeddedswift/installembeddedswift).
15+
1. Install [`swift`](https://swift.org) using the [instructions here](https://docs.swift.org/embedded/documentation/embedded/installembeddedswift).
1616

1717
2. Install [`uv`](https://github.com/astral-sh/uv), "an extremely fast Python package and project manager", using the [instructions here](https://docs.astral.sh/uv/getting-started/installation/).
1818

@@ -30,7 +30,7 @@ Each example in this repository contains build and deployment instructions, howe
3030
| [rpi-pico-blink-sdk](./rpi-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/swiftlang/swift-embedded-examples/assets/1186214/f2c45c18-f9a4-48b4-a941-1298ecc942cb"> |
3131
| [rpi-pico-blink](./rpi-pico-blink) | Raspberry Pi Pico | None | Blink an LED repeatedly. | <img width="300" src="https://github.com/swiftlang/swift-embedded-examples/assets/1186214/f2c45c18-f9a4-48b4-a941-1298ecc942cb"> |
3232
| [rpi-pico2-neopixel](./rpi-pico2-neopixel) | Raspberry Pi Pico 2 | None | Control Neopixel LEDs using the RP2350 PIO. | <img width="300" src="rpi-pico2-neopixel/assets/images/example.jpg"> |
33-
| [rpi-picow-blink-sdk](./rpi-picow-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/swiftlang/swift-embedded-examples/assets/26223064/a4949a2e-1887-4325-8f5f-a681963c93d7"> |
33+
| [rpi-picow-blink-sdk](./rpi-picow-blink-sdk) | Raspberry Pi Pico W, Pico 2W | Pico SDK | Blink an LED to signal 'SOS' in Morse code repeatedly with Swift & the Pico SDK. | <img width="300" src="https://github.com/swiftlang/swift-embedded-examples/assets/26223064/a4949a2e-1887-4325-8f5f-a681963c93d7"> |
3434
| [stm32-blink](./stm32-blink) | STM32F746G-DISCO | None | Blink an LED repeatedly. | <img width="300" src="https://github.com/swiftlang/swift-embedded-examples/assets/1186214/739e98fd-a438-4a64-a7aa-9dddee25034b"> |
3535
| [stm32-lcd-logo](./stm32-lcd-logo) | STM32F746G-DISCO | None | Animate the Swift Logo on the built-in LCD. | <img width="300" src="https://github.com/swiftlang/swift-embedded-examples/assets/1186214/9e117d81-e808-493e-a20c-7284ea630f37"> |
3636
| [stm32-lvgl](./stm32-lvgl) | STM32F746G-DISCO || Baremetal setup of LCD, touch panel, DRAM, using the LLVM Embedded toolchain for ARM. Renders graphics, animations, and reacts to user input via LVGL. Includes a macOS/Linux SDL based host simulation app. | <img width="300" src="https://github.com/user-attachments/assets/3b4fefd3-1656-4768-9c64-6cbcb3ff9665"> |
@@ -53,6 +53,7 @@ Note that the SDK integration examples (Pico SDK, Zephyr SDK, etc.) are not reco
5353
| [EmbeddedSwift nRF52 Examples](https://github.com/nelcea/EmbeddedSwift-nRF52-Examples) | nRF52840 (Development Kit) | A collection of examples using Embedded Swift on top of nRF Connect SDK (Zephyr). |
5454
| [Swatak](https://github.com/nelcea/EmbeddedSwift-nRF52-Swatak) | nRF52840 (Seeed Studio XIAO) | A reaction time game inspired by BATAK© boards, implemented in Embedded Swift using nRF Connect SDK. |
5555
| [swift-picosystem-example](https://github.com/jerrodputman/swift-picosystem-example) | PicoSystem | An Embedded Swift demo running on the Pimoroni PicoSystem |
56+
| [pico-swift-sh1106](https://github.com/mkbrwr/pico-swift-sh1106) | Pico 2 | Display Driver for SH1106 |
5657
| [PlaydateKit](https://github.com/finnvoor/PlaydateKit) | Playdate | A full featured framework for building Playdate games using Embedded Swift. |
5758
| [swift-playdate-examples](https://github.com/swiftlang/swift-playdate-examples) | Playdate | An Embedded Swift game running on Playdate by Panic. |
5859
| [swift-stm32c011-examples](https://github.com/xtremekforever/swift-stm32c011-examples) | STM32 | Examples of running Embedded Swift on the STM32C011, which is a tiny MCU with only 6KB of SRAM and 32KB of flash. |

Sources/EmbeddedSwift/Documentation.docc/GuidedExamples/PicoGuide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ $ export PICO_SDK_PATH=... # location to your Pico SDK
2323
$ export PICO_TOOLCHAIN_PATH=... # location to the Arm Embedded Toolchain
2424
```
2525

26-
If you have the Wi-Fi enabled Pico W board instead of the regular Pico, note that you will need a slightly different setup described in the [Pico W example project](https://github.com/swiftlang/swift-embedded-examples/tree/main/rpi-picow-blink-sdk), and just specifying `PICO_BOARD=pico_w` is not going to work.
26+
If you have the Wi-Fi enabled Pico W / Pico 2W board instead of the regular Pico, note that you will need a slightly different setup described in the [Pico W example project](https://github.com/swiftlang/swift-embedded-examples/tree/main/rpi-picow-blink-sdk), and just specifying `PICO_BOARD=pico_w` is not going to work.
2727

2828
Install [CMake 3.29](https://cmake.org/) or newer.
2929

Sources/EmbeddedSwift/Documentation.docc/SDKSupport/Baremetal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Swift MMIO provides strongly-typed access to memory-mapped hardware and can auto
6767
gpioa.odr.write { $0.odr5 = true } // Set pin 5 high
6868
```
6969

70-
See [Swift MMIO](https://github.com/swiftlang/swift-mmio/) for details and <doc:STM32BaremetalGuide> for a guided example of using it.
70+
See [Swift MMIO](https://github.com/apple/swift-mmio/) for details and <doc:STM32BaremetalGuide> for a guided example of using it.
7171

7272
## Creating a linker script and data segment relocation
7373

0 commit comments

Comments
 (0)