Skip to content

Move generated registers into discrete modules #125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .swiftformatignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
./harmony/*
./stm32-lcd-logo/Sources/Application/Registers/*
./stm32-neopixel/Sources/Application/Registers/*
./stm32-uart-echo/Sources/Application/Registers/*
./stm32-lcd-logo/Sources/STM32F7X6/*
./stm32-neopixel/Sources/STM32F7X6/*
./stm32-uart-echo/Sources/STM32F7X6/*
4 changes: 2 additions & 2 deletions stm32-lcd-logo/Package.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "5728b1ec253c3300a921ee6ddc3c43ff685abaa7f6ca8d86433af91b7883bf79",
"originHash" : "0259de139c240d30a60426d7d7f2d119ccc92fffcb5377eccefe0c9a21e3ef9c",
"pins" : [
{
"identity" : "swift-argument-parser",
Expand All @@ -16,7 +16,7 @@
"location" : "https://github.com/apple/swift-mmio",
"state" : {
"branch" : "main",
"revision" : "daf25ecacc0d9b71036c6af32cb7786a01802799"
"revision" : "5232c5129a8c70beafc3d6acfbae2716c1b6822a"
}
},
{
Expand Down
27 changes: 18 additions & 9 deletions stm32-lcd-logo/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,28 @@ let package = Package(
.package(url: "https://github.com/apple/swift-mmio", branch: "main")
],
targets: [
// SVD2Swift \
// --input Tools/SVDs/stm32f7x6.patched.svd \
// --output stm32-lcd-logo/Sources/STM32F7x6 \
// --peripherals FLASH GPIOA GPIOB GPIOC GPIOD GPIOE GPIOF GPIOG GPIOH GPIOI GPIOJ GPIOK LTDC RCC
.executableTarget(
name: "Application",
dependencies: [
.product(name: "MMIO", package: "swift-mmio"),
"Support",
],
dependencies: ["STM32F7X6", "Support"],
swiftSettings: [
.enableExperimentalFeature("InlineArrayTypeSugar"),
.enableExperimentalFeature("SymbolLinkageMarkers"),
]),
// SVD2Swift \
// --input Sources/STM32F7X6/stm32f7x6.patched.svd \
// --output Sources/STM32F7X6 \
// --access-level public \
// --indentation-width 2 \
// --peripherals FLASH GPIOA GPIOB GPIOC GPIOD GPIOE GPIOF GPIOG GPIOH GPIOI GPIOJ GPIOK LTDC RCC
.target(
name: "STM32F7X6",
dependencies: [
.product(name: "MMIO", package: "swift-mmio")
],
plugins: [
// Plugin disabled because SwiftPM is slow.
// .plugin(name: "SVD2SwiftPlugin", package: "swift-mmio")
]),
.target(name: "Support"),
])
],
swiftLanguageModes: [.v5])
1 change: 1 addition & 0 deletions stm32-lcd-logo/Sources/Application/Application.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
//
//===----------------------------------------------------------------------===//

import STM32F7X6
import Support

@main
Expand Down
2 changes: 2 additions & 0 deletions stm32-lcd-logo/Sources/Application/HAL/GPIOA+Helpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
//
//===----------------------------------------------------------------------===//

import STM32F7X6

extension GPIOA {
public enum Port: Int {
case a, b, c, d, e, f, g, h, i, j, k
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
//
//===----------------------------------------------------------------------===//

import STM32F7X6
import Support

extension LTDC {
Expand Down
13 changes: 13 additions & 0 deletions stm32-lcd-logo/Sources/Application/HAL/RCC+Helpers.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift open source project
//
// Copyright (c) 2024 Apple Inc. and the Swift project authors.
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
//
//===----------------------------------------------------------------------===//

import STM32F7X6

extension RCC {
func enableGPIOPortClock(_ port: GPIOA.Port) {
switch port {
Expand Down
45 changes: 0 additions & 45 deletions stm32-lcd-logo/Sources/Application/Registers/Device.swift

This file was deleted.

45 changes: 45 additions & 0 deletions stm32-lcd-logo/Sources/STM32F7X6/Device.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Generated by svd2swift.

import MMIO

/// FLASH
public let flash = FLASH(unsafeAddress: 0x40023c00)

/// General-purpose I/Os
public let gpioa = GPIOA(unsafeAddress: 0x40020000)

/// General-purpose I/Os
public let gpiob = GPIOB(unsafeAddress: 0x40020400)

/// General-purpose I/Os
public let gpioc = GPIOC(unsafeAddress: 0x40020800)

/// General-purpose I/Os
public let gpiod = GPIOD(unsafeAddress: 0x40020c00)

/// General-purpose I/Os
public let gpioe = GPIOE(unsafeAddress: 0x40021000)

/// General-purpose I/Os
public let gpiof = GPIOF(unsafeAddress: 0x40021400)

/// General-purpose I/Os
public let gpiog = GPIOG(unsafeAddress: 0x40021800)

/// General-purpose I/Os
public let gpioh = GPIOH(unsafeAddress: 0x40021c00)

/// General-purpose I/Os
public let gpioi = GPIOI(unsafeAddress: 0x40022000)

/// General-purpose I/Os
public let gpioj = GPIOJ(unsafeAddress: 0x40022400)

/// General-purpose I/Os
public let gpiok = GPIOK(unsafeAddress: 0x40022800)

/// LCD-TFT Controller
public let ltdc = LTDC(unsafeAddress: 0x40016800)

/// Reset and clock control
public let rcc = RCC(unsafeAddress: 0x40023800)
13 changes: 13 additions & 0 deletions stm32-lcd-logo/Sources/STM32F7X6/Empty.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift open source project
//
// Copyright (c) 2024 Apple Inc. and the Swift project authors.
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
//
//===----------------------------------------------------------------------===//

// This file is intentionally left empty for SwiftPM to recognize the target as
// a Swift source module.
Loading
Loading