Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
771b49f
WIP
burgrp Nov 18, 2025
94707e6
WIP
burgrp Nov 18, 2025
a455c6b
WIP
burgrp Nov 21, 2025
960680a
WIP
burgrp Nov 21, 2025
6a194f4
WIP
burgrp Nov 28, 2025
316dcc2
WIP
burgrp Nov 29, 2025
49824dc
WIP
burgrp Nov 29, 2025
b8d95df
WIP
burgrp Nov 29, 2025
62d35e4
WIP
burgrp Nov 29, 2025
353da4f
WIP
burgrp Nov 29, 2025
9e7f5e8
WIP
burgrp Nov 30, 2025
f435f9d
WIP
burgrp Nov 30, 2025
72560af
WIP
burgrp Nov 30, 2025
77d60b0
WIP
burgrp Nov 30, 2025
ecf2f88
WIP
burgrp Nov 30, 2025
420bef5
WIP
burgrp Dec 2, 2025
871297c
PR comments fixed
burgrp Dec 15, 2025
452925c
pinout yamls removed
burgrp Dec 16, 2025
f88db40
machine: implement default UART pin configuration for Embedfire boards
burgrp Jan 6, 2026
996f747
flash command moved to chip level so VS Code plugin can select bare chip
burgrp Jan 27, 2026
18afd7d
machine: add support for alternate pin mode configuration
burgrp Jan 27, 2026
61f12c5
WIP
burgrp Jan 27, 2026
f57ef0d
WIP
burgrp Feb 13, 2026
65b696a
WIP
burgrp Feb 13, 2026
d23c1be
add build targets for embedfire on py32
burgrp Feb 20, 2026
8cabb44
add support for embedfire target in GNUmakefile for py32
burgrp Feb 20, 2026
bc6203e
lib/py32-svd: remove duplicate DBGMCU.IDCODE CODE field
burgrp Feb 21, 2026
590794c
update subproject commit reference in py32-svd
burgrp Feb 21, 2026
4e4fa59
PR fixes
burgrp Mar 3, 2026
0932f82
refactor: update CPU frequency handling in machine and runtime packages
burgrp Mar 4, 2026
e807081
refactor: replace ConfigureUARTPin function with direct pin configura…
burgrp May 3, 2026
8f7d050
SetAltFunc documentation for GPIO pin alternate functions
burgrp May 3, 2026
f1df998
refactor: improve UART write and flush error handling with timeout
burgrp May 3, 2026
7ba0767
machine/py32: generalize UART driver to any USART
burgrp Jul 14, 2026
666c566
Add canonical PY32F002, F003, and F030 density targets
burgrp Aug 4, 2026
6e4d941
Add targets for all PY32 CMSIS devices
burgrp Aug 5, 2026
b52650c
Support all PY32 register layout variants
burgrp Aug 5, 2026
116db61
machine/py32: use generated register definitions
burgrp Aug 6, 2026
f622bcc
machine/py32: fix alternate-function documentation
burgrp Aug 19, 2026
ed97c2b
machine/py32: report the configured CPU frequency
burgrp Aug 19, 2026
882e08c
machine/py32: use unsafe.Add for GPIO ports
burgrp Aug 19, 2026
78166de
machine/py32: bound and yield UART polling
burgrp Aug 19, 2026
c635bdd
machine/py32: configure UART pins from UARTConfig
burgrp Aug 19, 2026
ad9002d
build: use the current PY32 SVD repository URL
burgrp Aug 19, 2026
98a2d1b
test: cover PY32 UART register layouts
burgrp Aug 19, 2026
fe40cc7
machine/py32: restore dynamic CPU frequency tracking
burgrp Aug 20, 2026
3d0ec81
machine/py32: share the USART TX-ready bit
burgrp Aug 20, 2026
1792004
targets/py32: scale system stacks with RAM
burgrp Aug 20, 2026
d7a1bda
machine/py32: keep clock state internal
burgrp Aug 26, 2026
dbab89b
targets/py32: normalize generated metadata
burgrp Aug 27, 2026
5fb9fce
machine/py32: normalize GPIO configuration
burgrp Aug 27, 2026
fdfcbe9
machine/py32: fix T020 UART setup
burgrp Aug 27, 2026
aa5d05d
machine/py32: reduce clock variant files
burgrp Aug 27, 2026
189ed92
machine/py32: clean up UART variants
burgrp Aug 27, 2026
06a523e
machine/py32: decouple UART clock capability
burgrp Aug 27, 2026
f6212fc
lib/py32-svd: use organization repository
burgrp Aug 27, 2026
2432011
runtime/py32: name 24MHz HSI encodings
burgrp Aug 27, 2026
10228f6
machine/py32: derive startup clock from capability
burgrp Aug 27, 2026
381d45f
machine/py32: use generated USART clock mask
burgrp Aug 27, 2026
a3c9946
machine/py32: name T020 8-bit UART mode
burgrp Aug 27, 2026
733cd22
ci: include PY32 in sharded smoke tests
burgrp Aug 28, 2026
dcbcdfa
runtime: remove PY32 HSI frequency workaround
burgrp Aug 28, 2026
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
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ jobs:
# Balanced with the measured build time of each group, so that the
# shards finish at about the same time.
group:
- smoketest-rp2xxx smoketest-selftest smoketest-wasm-sim
- smoketest-rp2xxx smoketest-selftest smoketest-wasm-sim smoketest-py32
- smoketest-esp smoketest-riscv smoketest-flags
- smoketest-examples smoketest-nxp smoketest-pwm-usb smoketest-avr
- smoketest-samd smoketest-stm32 smoketest-nrf smoketest-wasm
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ src/device/renesas/*.go
src/device/renesas/*.s
src/device/rp/*.go
src/device/rp/*.s
src/device/py32/*.go
src/device/py32/*.s
./vendor
llvm-build
llvm-project
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@
[submodule "lib/bdwgc"]
path = lib/bdwgc
url = https://github.com/ivmai/bdwgc.git
[submodule "lib/py32-svd"]
path = lib/py32-svd
url = https://github.com/tinygo-org/py32-svd.git
34 changes: 34 additions & 0 deletions compileopts/target_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package compileopts

import (
"encoding/csv"
"errors"
"io/fs"
"os"
"reflect"
"testing"
)
Expand Down Expand Up @@ -54,6 +56,38 @@ func TestLoadTarget_InheritableOnlyTargetStillLoadable(t *testing.T) {
}
}

func TestLoadPY32ConcreteTargets(t *testing.T) {
file, err := os.Open("../tools/gen-py32-targets/devices.csv")
if err != nil {
t.Fatal(err)
}
defer file.Close()

records, err := csv.NewReader(file).ReadAll()
if err != nil {
t.Fatal(err)
}
for _, record := range records[1:] {
part, core := record[0], record[2]
t.Run(part, func(t *testing.T) {
spec, err := LoadTarget(&Options{Target: part})
if err != nil {
t.Fatal(err)
}
if spec.LinkerScript == "" {
t.Error("concrete target has no linker script")
}
wantCPU := "cortex-m0plus"
if core == "m4" {
wantCPU = "cortex-m4"
}
if spec.CPU != wantCPU {
t.Errorf("CPU is %q, want %q", spec.CPU, wantCPU)
}
})
}
}

func TestOverrideProperties(t *testing.T) {
baseAutoStackSize := true
base := &TargetSpec{
Expand Down
1 change: 1 addition & 0 deletions lib/py32-svd
Submodule py32-svd added at 6aa739
11 changes: 9 additions & 2 deletions make/gen-device.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

.PHONY: gen-device gen-device-avr gen-device-esp gen-device-nrf gen-device-sam \
gen-device-sifive gen-device-kendryte gen-device-nxp gen-device-rp \
gen-device-stm32 gen-device-renesas
gen-device-stm32 gen-device-renesas gen-device-py32 gen-target-py32

gen-device: gen-device-avr gen-device-esp gen-device-nrf gen-device-sam gen-device-sifive gen-device-kendryte gen-device-nxp gen-device-rp ## Generate microcontroller-specific sources
gen-device: gen-device-avr gen-device-esp gen-device-nrf gen-device-sam gen-device-sifive gen-device-kendryte gen-device-nxp gen-device-rp gen-device-py32 ## Generate microcontroller-specific sources
ifneq ($(RENESAS), 0)
gen-device: gen-device-renesas
endif
Expand Down Expand Up @@ -58,3 +58,10 @@ gen-device-rp: build/gen-device-svd
gen-device-renesas: build/gen-device-svd
./build/gen-device-svd -source=https://github.com/cmsis-svd/cmsis-svd-data/tree/master/data/Renesas lib/cmsis-svd/data/Renesas/ src/device/renesas/
GO111MODULE=off $(GO) fmt ./src/device/renesas

gen-device-py32: build/gen-device-svd
./build/gen-device-svd -source=https://github.com/tinygo-org/py32-svd lib/py32-svd/svd src/device/py32/
GO111MODULE=off $(GO) fmt ./src/device/py32

gen-target-py32: ## Generate PY32 target and linker definitions
$(GO) run ./tools/gen-py32-targets
32 changes: 32 additions & 0 deletions make/smoketest.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ SMOKETEST_SUBTARGETS = \
smoketest-rp2xxx \
smoketest-pwm-usb \
smoketest-stm32 \
smoketest-py32 \
smoketest-avr \
smoketest-esp \
smoketest-riscv \
Expand Down Expand Up @@ -403,6 +404,37 @@ ifneq ($(STM32), 0)
@$(MD5SUM) $(SMOKE_OUT).hex
endif

smoketest-py32: SMOKE_OUT = build/smoke/py32
smoketest-py32: | build/smoke
ifneq ($(PY32), 0)
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=embedfire-py32f030 examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=embedfire-py32f030 examples/echo
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=embedfire-py32f002b examples/blinky1
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=embedfire-py32f002b examples/echo
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=py32f002bx5 ./testdata/py32-uart
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=py32f003x6 ./testdata/py32-uart
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=py32f030x8 ./testdata/py32-uart
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=py32f403xb examples/echo
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=py32f030x8 ./testdata/py32-clock
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=py32f403xb ./testdata/py32-clock
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=py32e407xc examples/echo
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=py32f410xb examples/echo
@$(MD5SUM) $(SMOKE_OUT).hex
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=py32t020x5 examples/echo
@$(MD5SUM) $(SMOKE_OUT).hex
endif

smoketest-avr: SMOKE_OUT = build/smoke/avr
smoketest-avr: | build/smoke
$(TINYGO) build -size short -o $(SMOKE_OUT).hex -target=atmega328pb examples/blinkm
Expand Down
28 changes: 28 additions & 0 deletions src/machine/board_embedfire_py32f002b.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//go:build embedfire_py32f002b

// Pin mappings for the Embedfire PY32F002B board.

package machine

// LEDs
const (
LED1 = PA1
LED2 = PA5
LED3 = PA4
LED = LED2
)

// Buttons
const (
KEY1 = PA3
KEY2 = PA0
)

const (
UART_TX_PIN = PA6
UART_RX_PIN = PA7
)

func defaultUARTPins() (Pin, Pin) {
return UART_TX_PIN, UART_RX_PIN
}
28 changes: 28 additions & 0 deletions src/machine/board_embedfire_py32f030.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//go:build embedfire_py32f030

// Pin mappings for the Embedfire PY32F030 board.

package machine

// LEDs
const (
LED1 = PA2
LED2 = PA3
LED3 = PA4
LED = LED2
)

// Buttons
const (
KEY1 = PA5
KEY2 = PA6
)

const (
UART_TX_PIN = PA7
UART_RX_PIN = PA8
)

func defaultUARTPins() (Pin, Pin) {
return UART_TX_PIN, UART_RX_PIN
}
13 changes: 13 additions & 0 deletions src/machine/machine_py32_clock.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//go:build py32

package machine

var cpuFrequencyHz uint32 = defaultCPUFrequencyHz

func CPUFrequency() uint32 {
return cpuFrequencyHz
}

func setCPUFrequency(frequency uint32) {
cpuFrequencyHz = frequency
}
5 changes: 5 additions & 0 deletions src/machine/machine_py32_clock_24mhz.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//go:build py32 && !py32_no_hsi_fs

package machine

const defaultCPUFrequencyHz = 24_000_000
5 changes: 5 additions & 0 deletions src/machine/machine_py32_clock_8mhz.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//go:build py32 && py32_no_hsi_fs

package machine

const defaultCPUFrequencyHz = 8_000_000
Loading
Loading