microgoose 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- microgoose-0.1.1/.github/CODEOWNERS +2 -0
- microgoose-0.1.1/.github/actions/setup-goose/action.yml +25 -0
- microgoose-0.1.1/.github/dependabot.yml +11 -0
- microgoose-0.1.1/.github/pull_request_template.md +11 -0
- microgoose-0.1.1/.github/workflows/ci.yml +129 -0
- microgoose-0.1.1/.github/workflows/docs.yml +45 -0
- microgoose-0.1.1/.github/workflows/release.yml +80 -0
- microgoose-0.1.1/.gitignore +15 -0
- microgoose-0.1.1/CHANGELOG.md +24 -0
- microgoose-0.1.1/LICENSE +201 -0
- microgoose-0.1.1/PKG-INFO +130 -0
- microgoose-0.1.1/README.md +98 -0
- microgoose-0.1.1/components/microgoose/CMakeLists.txt +26 -0
- microgoose-0.1.1/components/microgoose/Kconfig +12 -0
- microgoose-0.1.1/components/microgoose/compat/dlfcn.h +11 -0
- microgoose-0.1.1/components/microgoose/compat/mg_prefix.h +45 -0
- microgoose-0.1.1/components/microgoose/compat/sys/mman.h +25 -0
- microgoose-0.1.1/components/microgoose/include/microgoose.h +39 -0
- microgoose-0.1.1/components/microgoose/mg_compat.c +228 -0
- microgoose-0.1.1/components/microgoose/mg_hal.c +131 -0
- microgoose-0.1.1/components/microgoose/mg_main.c +92 -0
- microgoose-0.1.1/docs/CNAME +1 -0
- microgoose-0.1.1/docs/assets/extra.css +2 -0
- microgoose-0.1.1/docs/assets/favicon.svg +1 -0
- microgoose-0.1.1/docs/boards.md +65 -0
- microgoose-0.1.1/docs/contributing.md +73 -0
- microgoose-0.1.1/docs/findings.md +250 -0
- microgoose-0.1.1/docs/getting-started.md +87 -0
- microgoose-0.1.1/docs/hardware-api.md +66 -0
- microgoose-0.1.1/docs/how-it-works.md +81 -0
- microgoose-0.1.1/docs/index.md +67 -0
- microgoose-0.1.1/examples/blink.goose +20 -0
- microgoose-0.1.1/examples/hello.goose +17 -0
- microgoose-0.1.1/examples/overflow.goose +11 -0
- microgoose-0.1.1/examples/sieve.goose +19 -0
- microgoose-0.1.1/examples/threads.goose +33 -0
- microgoose-0.1.1/firmware/CMakeLists.txt +4 -0
- microgoose-0.1.1/firmware/platformio.ini +19 -0
- microgoose-0.1.1/firmware/sdkconfig.defaults +17 -0
- microgoose-0.1.1/firmware/sdkconfig.defaults.esp32 +4 -0
- microgoose-0.1.1/firmware/sdkconfig.defaults.esp32s3 +3 -0
- microgoose-0.1.1/firmware/src/CMakeLists.txt +5 -0
- microgoose-0.1.1/lib/esp.goose +29 -0
- microgoose-0.1.1/mg.py +9 -0
- microgoose-0.1.1/microgoose/__init__.py +2 -0
- microgoose-0.1.1/microgoose/__main__.py +3 -0
- microgoose-0.1.1/microgoose/cli.py +108 -0
- microgoose-0.1.1/microgoose/core.py +374 -0
- microgoose-0.1.1/microgoose/goose.py +122 -0
- microgoose-0.1.1/mkdocs.yml +70 -0
- microgoose-0.1.1/ports/stm32h7/include/dirent.h +11 -0
- microgoose-0.1.1/ports/stm32h7/include/mg_baremetal.h +11 -0
- microgoose-0.1.1/ports/stm32h7/include/pthread.h +36 -0
- microgoose-0.1.1/ports/stm32h7/platformio.ini +19 -0
- microgoose-0.1.1/ports/stm32h7/src/mg_h7.c +538 -0
- microgoose-0.1.1/pyproject.toml +73 -0
- microgoose-0.1.1/requirements-dev.txt +9 -0
- microgoose-0.1.1/tests/conformance.py +97 -0
- microgoose-0.1.1/tests/host32.py +78 -0
- microgoose-0.1.1/tests/test_fixes.py +110 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: Set up the Goose compiler
|
|
2
|
+
description: Downloads the pinned Goose release and verifies its checksum.
|
|
3
|
+
inputs:
|
|
4
|
+
version:
|
|
5
|
+
description: Goose release tag
|
|
6
|
+
default: v2026.4
|
|
7
|
+
sha256:
|
|
8
|
+
description: SHA-256 of goose-<version>-linux-x64.tar.gz
|
|
9
|
+
default: 559ad7572df89fcd1273512d8679528bcdf876c252ec1f31608d3808b24125b3
|
|
10
|
+
runs:
|
|
11
|
+
using: composite
|
|
12
|
+
steps:
|
|
13
|
+
- shell: bash
|
|
14
|
+
env:
|
|
15
|
+
VERSION: ${{ inputs.version }}
|
|
16
|
+
SHA256: ${{ inputs.sha256 }}
|
|
17
|
+
run: |
|
|
18
|
+
set -euo pipefail
|
|
19
|
+
name="goose-${VERSION}-linux-x64.tar.gz"
|
|
20
|
+
curl -fsSL -o "$RUNNER_TEMP/$name" \
|
|
21
|
+
"https://github.com/aardappel/goose/releases/download/${VERSION}/${name}"
|
|
22
|
+
echo "${SHA256} $RUNNER_TEMP/$name" | sha256sum -c -
|
|
23
|
+
mkdir -p tools/goose
|
|
24
|
+
tar -xzf "$RUNNER_TEMP/$name" -C tools/goose
|
|
25
|
+
tools/goose/goose-${VERSION}-linux-x64/goose --version || true
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Weekly PRs for outdated actions and Python tools; CI must pass before merge.
|
|
2
|
+
version: 2
|
|
3
|
+
updates:
|
|
4
|
+
- package-ecosystem: github-actions
|
|
5
|
+
directory: /
|
|
6
|
+
schedule:
|
|
7
|
+
interval: weekly
|
|
8
|
+
- package-ecosystem: pip
|
|
9
|
+
directory: /
|
|
10
|
+
schedule:
|
|
11
|
+
interval: weekly
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
## What and why
|
|
2
|
+
|
|
3
|
+
## How it was tested
|
|
4
|
+
|
|
5
|
+
- [ ] `python -m pytest` and `ruff check .`
|
|
6
|
+
- [ ] Ran on hardware (which boards, which programs):
|
|
7
|
+
- [ ] `tests/conformance.py --target ...` still 12/12 where relevant
|
|
8
|
+
|
|
9
|
+
CI builds every example for every target and runs the 32-bit host
|
|
10
|
+
conformance check. It cannot run anything on a real board, so say what you
|
|
11
|
+
ran by hand.
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Every push and pull request: lint, unit tests, 32-bit conformance on the
|
|
2
|
+
# host, firmware builds for every target, and a strict docs build. main only
|
|
3
|
+
# accepts changes that pass all of these (branch rules on GitHub).
|
|
4
|
+
name: CI
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [main]
|
|
9
|
+
pull_request:
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
concurrency:
|
|
16
|
+
group: ci-${{ github.ref }}
|
|
17
|
+
cancel-in-progress: true
|
|
18
|
+
|
|
19
|
+
env:
|
|
20
|
+
PYTHONUNBUFFERED: "1"
|
|
21
|
+
PYTHONIOENCODING: utf-8
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
lint:
|
|
25
|
+
name: lint
|
|
26
|
+
runs-on: ubuntu-24.04
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v4
|
|
29
|
+
- uses: actions/setup-python@v5
|
|
30
|
+
with:
|
|
31
|
+
python-version: "3.12"
|
|
32
|
+
- run: pip install ruff==0.17.4
|
|
33
|
+
- run: ruff check --output-format github .
|
|
34
|
+
|
|
35
|
+
unit:
|
|
36
|
+
name: unit tests
|
|
37
|
+
runs-on: ubuntu-24.04
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@v4
|
|
40
|
+
- uses: actions/setup-python@v5
|
|
41
|
+
with:
|
|
42
|
+
python-version: "3.12"
|
|
43
|
+
- uses: ./.github/actions/setup-goose
|
|
44
|
+
- run: pip install pytest==9.1.1
|
|
45
|
+
- run: python -m pytest -v
|
|
46
|
+
|
|
47
|
+
host32:
|
|
48
|
+
# 4-byte pointers, like every MCU target: catches layout and pipeline
|
|
49
|
+
# regressions without hardware (tests/host32.py).
|
|
50
|
+
name: host 32-bit conformance
|
|
51
|
+
runs-on: ubuntu-24.04
|
|
52
|
+
steps:
|
|
53
|
+
- uses: actions/checkout@v4
|
|
54
|
+
- uses: actions/setup-python@v5
|
|
55
|
+
with:
|
|
56
|
+
python-version: "3.12"
|
|
57
|
+
- uses: ./.github/actions/setup-goose
|
|
58
|
+
- run: sudo apt-get update -qq && sudo apt-get install -y -qq gcc-multilib
|
|
59
|
+
- run: python tests/host32.py
|
|
60
|
+
- if: failure()
|
|
61
|
+
uses: actions/upload-artifact@v4
|
|
62
|
+
with:
|
|
63
|
+
name: host32-output
|
|
64
|
+
path: build/host32/*.txt
|
|
65
|
+
|
|
66
|
+
firmware:
|
|
67
|
+
name: firmware (${{ matrix.target }})
|
|
68
|
+
runs-on: ubuntu-24.04
|
|
69
|
+
strategy:
|
|
70
|
+
fail-fast: false
|
|
71
|
+
matrix:
|
|
72
|
+
target: [s3, esp32, h7]
|
|
73
|
+
steps:
|
|
74
|
+
- uses: actions/checkout@v4
|
|
75
|
+
- uses: actions/setup-python@v5
|
|
76
|
+
with:
|
|
77
|
+
python-version: "3.12"
|
|
78
|
+
- uses: ./.github/actions/setup-goose
|
|
79
|
+
- uses: actions/cache@v4
|
|
80
|
+
with:
|
|
81
|
+
path: ~/.platformio
|
|
82
|
+
key: pio-${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('firmware/platformio.ini', 'ports/*/platformio.ini', 'requirements-dev.txt') }}
|
|
83
|
+
- run: pip install platformio==6.2.0 pyserial==3.5
|
|
84
|
+
- name: Build every example
|
|
85
|
+
run: |
|
|
86
|
+
set -euo pipefail
|
|
87
|
+
for ex in examples/*.goose; do
|
|
88
|
+
echo "::group::$ex"
|
|
89
|
+
python mg.py build "$ex" --target ${{ matrix.target }}
|
|
90
|
+
echo "::endgroup::"
|
|
91
|
+
done
|
|
92
|
+
|
|
93
|
+
package:
|
|
94
|
+
# Build the sdist and wheel, install the wheel into a clean environment,
|
|
95
|
+
# and build firmware with it: what `pip install microgoose` users get.
|
|
96
|
+
name: package
|
|
97
|
+
runs-on: ubuntu-24.04
|
|
98
|
+
steps:
|
|
99
|
+
- uses: actions/checkout@v4
|
|
100
|
+
- uses: actions/setup-python@v5
|
|
101
|
+
with:
|
|
102
|
+
python-version: "3.12"
|
|
103
|
+
- uses: actions/cache@v4
|
|
104
|
+
with:
|
|
105
|
+
path: ~/.platformio
|
|
106
|
+
key: pio-${{ runner.os }}-package-${{ hashFiles('ports/stm32h7/platformio.ini', 'requirements-dev.txt') }}
|
|
107
|
+
- run: pip install build==1.6.1 twine==7.0.0
|
|
108
|
+
- run: python -m build && twine check --strict dist/*
|
|
109
|
+
- name: Install the wheel in a fresh venv and use it
|
|
110
|
+
run: |
|
|
111
|
+
set -euo pipefail
|
|
112
|
+
python -m venv /tmp/venv
|
|
113
|
+
/tmp/venv/bin/pip install dist/*.whl
|
|
114
|
+
cd "$RUNNER_TEMP"
|
|
115
|
+
/tmp/venv/bin/microgoose --version
|
|
116
|
+
/tmp/venv/bin/microgoose setup
|
|
117
|
+
/tmp/venv/bin/microgoose new demo --example sieve
|
|
118
|
+
/tmp/venv/bin/microgoose build demo/main.goose --target h7
|
|
119
|
+
|
|
120
|
+
docs:
|
|
121
|
+
name: docs
|
|
122
|
+
runs-on: ubuntu-24.04
|
|
123
|
+
steps:
|
|
124
|
+
- uses: actions/checkout@v4
|
|
125
|
+
- uses: actions/setup-python@v5
|
|
126
|
+
with:
|
|
127
|
+
python-version: "3.12"
|
|
128
|
+
- run: pip install mkdocs==1.6.1 mkdocs-material==9.8.1
|
|
129
|
+
- run: mkdocs build --strict
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Publishes docs/ to https://microgoose.dev via GitHub Pages.
|
|
2
|
+
# Off until the repository variable DEPLOY_DOCS is "true": a Pages site is
|
|
3
|
+
# public even while the repository is private.
|
|
4
|
+
name: Docs
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [main]
|
|
9
|
+
paths: [docs/**, mkdocs.yml, .github/workflows/docs.yml]
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
concurrency:
|
|
16
|
+
group: pages
|
|
17
|
+
cancel-in-progress: false
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
build:
|
|
21
|
+
if: vars.DEPLOY_DOCS == 'true'
|
|
22
|
+
runs-on: ubuntu-24.04
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v4
|
|
25
|
+
- uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: "3.12"
|
|
28
|
+
- run: pip install mkdocs==1.6.1 mkdocs-material==9.8.1
|
|
29
|
+
- run: mkdocs build --strict
|
|
30
|
+
- uses: actions/upload-pages-artifact@v3
|
|
31
|
+
with:
|
|
32
|
+
path: site
|
|
33
|
+
|
|
34
|
+
deploy:
|
|
35
|
+
needs: build
|
|
36
|
+
runs-on: ubuntu-24.04
|
|
37
|
+
permissions:
|
|
38
|
+
pages: write
|
|
39
|
+
id-token: write
|
|
40
|
+
environment:
|
|
41
|
+
name: github-pages
|
|
42
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
43
|
+
steps:
|
|
44
|
+
- id: deployment
|
|
45
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Publishes a release to PyPI when a version tag (v0.1.0, ...) is
|
|
2
|
+
# pushed. Uses PyPI Trusted Publishing (OIDC): no API tokens are stored.
|
|
3
|
+
# The `pypi` environment requires the owner's approval before publishing.
|
|
4
|
+
name: Release
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
tags: ["v*"]
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
build:
|
|
15
|
+
runs-on: ubuntu-24.04
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: "3.12"
|
|
21
|
+
- name: Tag must match the package version
|
|
22
|
+
run: |
|
|
23
|
+
v=$(python -c "import re;print(re.search(r'__version__ = \"(.+)\"', open('microgoose/__init__.py').read())[1])")
|
|
24
|
+
test "v$v" = "$GITHUB_REF_NAME" || { echo "::error::tag $GITHUB_REF_NAME but package version $v"; exit 1; }
|
|
25
|
+
- run: pip install build==1.6.1 twine==7.0.0
|
|
26
|
+
- run: python -m build
|
|
27
|
+
- run: twine check --strict dist/*
|
|
28
|
+
- uses: actions/upload-artifact@v4
|
|
29
|
+
with:
|
|
30
|
+
name: dist
|
|
31
|
+
path: dist/
|
|
32
|
+
|
|
33
|
+
smoke:
|
|
34
|
+
# The exact files that will be published: install, fetch Goose, build firmware.
|
|
35
|
+
needs: build
|
|
36
|
+
runs-on: ubuntu-24.04
|
|
37
|
+
steps:
|
|
38
|
+
- uses: actions/setup-python@v5
|
|
39
|
+
with:
|
|
40
|
+
python-version: "3.12"
|
|
41
|
+
- uses: actions/download-artifact@v4
|
|
42
|
+
with:
|
|
43
|
+
name: dist
|
|
44
|
+
path: dist/
|
|
45
|
+
- run: pip install dist/*.whl
|
|
46
|
+
- run: microgoose --version && microgoose setup
|
|
47
|
+
- run: microgoose new demo --example hello && microgoose build demo/main.goose --target h7
|
|
48
|
+
|
|
49
|
+
publish:
|
|
50
|
+
needs: [build, smoke]
|
|
51
|
+
runs-on: ubuntu-24.04
|
|
52
|
+
environment:
|
|
53
|
+
name: pypi
|
|
54
|
+
url: https://pypi.org/p/microgoose
|
|
55
|
+
permissions:
|
|
56
|
+
id-token: write
|
|
57
|
+
steps:
|
|
58
|
+
- uses: actions/download-artifact@v4
|
|
59
|
+
with:
|
|
60
|
+
name: dist
|
|
61
|
+
path: dist/
|
|
62
|
+
- name: PyPI
|
|
63
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
64
|
+
|
|
65
|
+
github-release:
|
|
66
|
+
needs: publish
|
|
67
|
+
runs-on: ubuntu-24.04
|
|
68
|
+
permissions:
|
|
69
|
+
contents: write
|
|
70
|
+
steps:
|
|
71
|
+
- uses: actions/checkout@v4
|
|
72
|
+
- uses: actions/download-artifact@v4
|
|
73
|
+
with:
|
|
74
|
+
name: dist
|
|
75
|
+
path: dist/
|
|
76
|
+
- env:
|
|
77
|
+
GH_TOKEN: ${{ github.token }}
|
|
78
|
+
run: |
|
|
79
|
+
gh release create "$GITHUB_REF_NAME" dist/* --verify-tag --title "MicroGoose ${GITHUB_REF_NAME#v}" \
|
|
80
|
+
--notes "Install: \`pip install microgoose==${GITHUB_REF_NAME#v}\` · Changes: [CHANGELOG.md](https://github.com/${GITHUB_REPOSITORY}/blob/main/CHANGELOG.md)"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
build/
|
|
2
|
+
firmware/.pio/
|
|
3
|
+
firmware/sdkconfig.*
|
|
4
|
+
!firmware/sdkconfig.defaults*
|
|
5
|
+
firmware/src/app.c
|
|
6
|
+
tools/
|
|
7
|
+
ports/*/.pio/
|
|
8
|
+
ports/*/src/app.c
|
|
9
|
+
ports/*/src/goose_runtime.c
|
|
10
|
+
ports/*/include/shared/
|
|
11
|
+
components/microgoose/goose_runtime.c
|
|
12
|
+
probe/
|
|
13
|
+
site/
|
|
14
|
+
.claude/launch.json
|
|
15
|
+
dist/
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.1 (2026-11-28)
|
|
4
|
+
|
|
5
|
+
- The first release on PyPI. 0.1.0 was tagged but never published,
|
|
6
|
+
because its release workflow also targeted TestPyPI, which isn't used.
|
|
7
|
+
- The release workflow publishes to PyPI only.
|
|
8
|
+
|
|
9
|
+
## 0.1.0 (2026-11-28)
|
|
10
|
+
|
|
11
|
+
The first release.
|
|
12
|
+
|
|
13
|
+
- The `microgoose` command: `new`, `build`, `run`, `flash`, `monitor` and `setup`.
|
|
14
|
+
- Targets:
|
|
15
|
+
- `s3`: ESP32-S3
|
|
16
|
+
- `esp32`: ESP32 WROOM-32 and WROVER-E
|
|
17
|
+
- `h7`: STM32H743
|
|
18
|
+
- Goose v2026.4, downloaded on first use and verified by SHA-256.
|
|
19
|
+
- Data-stack overflow guards: hardware watchpoints on the ESP32s, MPU regions
|
|
20
|
+
on the STM32H7, and canaries for any stacks beyond those.
|
|
21
|
+
- `import esp;`: time, GPIO, WS2812 LED, ADC, chip temperature, RNG and
|
|
22
|
+
system info.
|
|
23
|
+
- Tested: all 12 stock Goose samples match the PC output on the ESP32-S3,
|
|
24
|
+
WROOM-32, WROVER-E and STM32H743.
|
microgoose-0.1.1/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: microgoose
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Run Goose language programs on microcontrollers: ESP32, ESP32-S3 and STM32H7.
|
|
5
|
+
Project-URL: Homepage, https://github.com/voodoomods/microgoose
|
|
6
|
+
Project-URL: Documentation, https://github.com/voodoomods/microgoose/tree/main/docs
|
|
7
|
+
Project-URL: Source, https://github.com/voodoomods/microgoose
|
|
8
|
+
Project-URL: Issues, https://github.com/voodoomods/microgoose/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/voodoomods/microgoose/blob/main/CHANGELOG.md
|
|
10
|
+
Author: voodoomods
|
|
11
|
+
License-Expression: Apache-2.0
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: compiler,embedded,esp32,esp32-s3,firmware,goose,microcontroller,stm32
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Environment :: Console
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Operating System :: MacOS
|
|
18
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
19
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
20
|
+
Classifier: Programming Language :: C
|
|
21
|
+
Classifier: Programming Language :: Python :: 3
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
26
|
+
Classifier: Topic :: Software Development :: Compilers
|
|
27
|
+
Classifier: Topic :: Software Development :: Embedded Systems
|
|
28
|
+
Requires-Python: >=3.10
|
|
29
|
+
Requires-Dist: platformio<7,>=6.1.16
|
|
30
|
+
Requires-Dist: pyserial>=3.5
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
# MicroGoose
|
|
34
|
+
|
|
35
|
+
Run [Goose](https://github.com/aardappel/goose) language programs on
|
|
36
|
+
microcontrollers. You write ordinary Goose, the unmodified Goose compiler
|
|
37
|
+
turns it into C, and MicroGoose builds that C into firmware for your board.
|
|
38
|
+
|
|
39
|
+
Tested on the ESP32-S3, the ESP32 WROOM-32 and WROVER-E (ESP-IDF), and the
|
|
40
|
+
STM32H743 (bare metal). All twelve of Goose's stock samples tested print
|
|
41
|
+
exactly what they print on a PC, on every one of those boards.
|
|
42
|
+
|
|
43
|
+
## Install
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install microgoose
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
On first use, MicroGoose downloads the Goose compiler v2026.4 from its
|
|
50
|
+
official release and checks its SHA-256. The first build for each board
|
|
51
|
+
fetches that board's toolchain through PlatformIO, which takes a few minutes.
|
|
52
|
+
|
|
53
|
+
## Quick start
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
microgoose new blinky --example blink
|
|
57
|
+
microgoose run blinky/main.goose # ESP32-S3 (the default target)
|
|
58
|
+
microgoose run blinky/main.goose --target esp32 # WROOM-32 / WROVER-E
|
|
59
|
+
microgoose run blinky/main.goose --target h7 # STM32H743 over ST-Link
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`run` compiles, builds the firmware, flashes it, then shows the board's
|
|
63
|
+
output until the program exits. `build` stops after the firmware.
|
|
64
|
+
`--reserve 32K` changes the size of each data stack (the default is 16K).
|
|
65
|
+
`MG_PORT=COM5` picks the serial port when there is more than one.
|
|
66
|
+
|
|
67
|
+
## Writing hardware code
|
|
68
|
+
|
|
69
|
+
```rust
|
|
70
|
+
import esp;
|
|
71
|
+
|
|
72
|
+
fn main() {
|
|
73
|
+
rgb_init(48);
|
|
74
|
+
for i: i32 in 10 {
|
|
75
|
+
rgb(if i % 2 == 0 { 32 } else { 0 }, 0, 0);
|
|
76
|
+
print("t=", millis(), " temp=", chip_temp_c());
|
|
77
|
+
delay_ms(250);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`import esp;` provides time, GPIO, the RGB LED, the ADC, the chip temperature
|
|
83
|
+
and system information. Each function is a one-line `extern fn` bound
|
|
84
|
+
directly to C, so adding a peripheral means one C function plus one line of
|
|
85
|
+
Goose.
|
|
86
|
+
|
|
87
|
+
## How it works
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
app.goose ──goose -o──▶ app.c ──┐
|
|
91
|
+
lib/esp.goose (extern fns) ├─ fixes ─▶ PlatformIO ─▶ firmware
|
|
92
|
+
goose --emit-runtime ─▶ runtime ┘ │
|
|
93
|
+
port: POSIX shim, HAL, main
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Goose has no heap: dynamic data lives on bump-pointer *data stacks*.
|
|
97
|
+
MicroGoose sizes those stacks to fit SRAM. It guards the end of each one with
|
|
98
|
+
whatever the chip has: hardware watchpoints on the ESP32s, MPU regions on the
|
|
99
|
+
STM32. It also applies two source fixes, one for Goose's 64-bit struct
|
|
100
|
+
layout and one for an Xtensa GCC calling-convention bug this project found.
|
|
101
|
+
|
|
102
|
+
## Documentation
|
|
103
|
+
|
|
104
|
+
- [Getting started](https://github.com/voodoomods/microgoose/blob/main/docs/getting-started.md)
|
|
105
|
+
- [Boards](https://github.com/voodoomods/microgoose/blob/main/docs/boards.md)
|
|
106
|
+
- [Hardware API](https://github.com/voodoomods/microgoose/blob/main/docs/hardware-api.md)
|
|
107
|
+
- [How it works](https://github.com/voodoomods/microgoose/blob/main/docs/how-it-works.md)
|
|
108
|
+
- [Findings](https://github.com/voodoomods/microgoose/blob/main/docs/findings.md): what works,
|
|
109
|
+
what doesn't (the Arduino Nano), and the compiler bug
|
|
110
|
+
|
|
111
|
+
The same pages will be published at [microgoose.dev](https://microgoose.dev).
|
|
112
|
+
|
|
113
|
+
## Developing MicroGoose
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
git clone https://github.com/voodoomods/microgoose && cd microgoose
|
|
117
|
+
pip install -e . -r requirements-dev.txt
|
|
118
|
+
python mg.py run examples/hello.goose # same as `microgoose`, building in the checkout
|
|
119
|
+
python -m pytest && ruff check .
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`main` only takes changes through pull requests that pass CI. CI runs lint,
|
|
123
|
+
unit tests, a 32-bit host conformance run, firmware builds for every target,
|
|
124
|
+
an install test of the built package, and a strict docs build. See
|
|
125
|
+
[Contributing](https://github.com/voodoomods/microgoose/blob/main/docs/contributing.md).
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
Apache-2.0. Goose is a separate project by its own authors, and MicroGoose is
|
|
130
|
+
not affiliated with it. MicroGoose downloads Goose; it does not redistribute it.
|