Skip to content

Commit efbd7f2

Browse files
committed
Merge remote-tracking branch 'origin/master' into HEAD
2 parents 2aea1c5 + 4ee3e2d commit efbd7f2

File tree

13 files changed

+104
-44
lines changed

13 files changed

+104
-44
lines changed

.github/workflows/build.yaml

Lines changed: 61 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ jobs:
2121
python-version: '3.10'
2222
- uses: actions/checkout@v4
2323
with:
24-
repository: jonnor/micropython
24+
repository: micropython/micropython
2525
path: micropython
26-
ref: v1.26.1-emlearn
26+
ref: v1.27.0
2727
- name: Install Python dependencies
2828
run: pip install -r requirements.txt
2929
- name: Setup MicroPython X86
@@ -60,9 +60,9 @@ jobs:
6060
python-version: '3.10'
6161
- uses: actions/checkout@v4
6262
with:
63-
repository: jonnor/micropython
63+
repository: micropython/micropython
6464
path: micropython
65-
ref: v1.26.1-emlearn
65+
ref: v1.27.0
6666
- name: Install Python dependencies
6767
run: pip install -r requirements.txt
6868
- name: Setup MicroPython ARM
@@ -105,9 +105,9 @@ jobs:
105105
python-version: '3.10'
106106
- uses: actions/checkout@v4
107107
with:
108-
repository: jonnor/micropython
108+
repository: micropython/micropython
109109
path: micropython
110-
ref: v1.26.1-emlearn
110+
ref: v1.27.0
111111
- name: Install Python dependencies
112112
run: pip install -r requirements.txt
113113

@@ -149,9 +149,9 @@ jobs:
149149
python-version: '3.10'
150150
- uses: actions/checkout@v4
151151
with:
152-
repository: jonnor/micropython
152+
repository: micropython/micropython
153153
path: micropython
154-
ref: v1.26.1-emlearn
154+
ref: v1.27.0
155155
- name: Install Python dependencies
156156
run: pip install -r requirements.txt
157157

@@ -197,9 +197,9 @@ jobs:
197197
python-version: '3.10'
198198
- uses: actions/checkout@v4
199199
with:
200-
repository: jonnor/micropython
200+
repository: micropython/micropython
201201
path: micropython
202-
ref: v1.26.1-emlearn
202+
ref: v1.27.0
203203
- name: Install Python dependencies
204204
run: pip install -r requirements.txt
205205
- name: Setup MicroPython X86
@@ -223,10 +223,49 @@ jobs:
223223
name: emlearn-micropython-build-macos
224224
path: dist
225225

226+
build-webassembly:
227+
runs-on: ubuntu-latest
228+
env:
229+
MPY_DIR: ./micropython
230+
MICROPYTHON_BIN: ./micropython/ports/unix/build-nomodules/micropython
231+
steps:
232+
- uses: actions/checkout@v4
233+
with:
234+
submodules: true
235+
- name: Install OS dependencies
236+
run: sudo add-apt-repository universe
237+
- uses: actions/setup-python@v5
238+
with:
239+
python-version: '3.10'
240+
- uses: actions/checkout@v4
241+
with:
242+
repository: jonnor/micropython
243+
path: micropython
244+
ref: webassembly-extra-cflags
245+
- name: Install Python dependencies
246+
run: pip install -r requirements.txt
247+
- name: Setup MicroPython
248+
working-directory: micropython
249+
run: |
250+
npm install terser
251+
git clone https://github.com/emscripten-core/emsdk.git
252+
(cd emsdk && ./emsdk install 4.0.21 && ./emsdk activate 4.0.21)
253+
make -C mpy-cross CFLAGS_EXTRA=-Wno-error
254+
- name: Build Webassembly
255+
run: |
256+
source ${MPY_DIR}/emsdk/emsdk_env.sh
257+
make -C ${MPY_DIR}/ports/webassembly submodules
258+
make webassembly V=1
259+
- name: Archive dist artifacts
260+
uses: actions/upload-artifact@v4
261+
with:
262+
name: emlearn-micropython-build-webassembly
263+
path: dist
264+
226265
deploy-pages:
227266
permissions:
228267
contents: write
229-
needs: [build-linux, build-arm, build-esp32, build-macos, build-riscv]
268+
needs: [build-linux, build-arm, build-esp32, build-macos, build-riscv, build-webassembly]
230269
runs-on: ubuntu-latest
231270

232271
steps:
@@ -240,15 +279,24 @@ jobs:
240279
mkdir -p dist/
241280
cp -r artifacts/*/* dist/
242281
243-
- name: Deploy to Github Pages
244-
if: "github.ref_name == 'master' || github.ref_type == 'tag'"
282+
- name: Deploy to Github Pages (tag/version)
283+
if: "github.ref_type == 'tag'"
245284
uses: peaceiris/actions-gh-pages@v3
246285
with:
247286
github_token: ${{ secrets.GITHUB_TOKEN }}
248287
publish_dir: ./dist
249288
keep_files: true
250289
destination_dir: builds/${{ github.ref_name }}
251290

291+
- name: Deploy to Github Pages (latest)
292+
if: "github.ref_type == 'tag'"
293+
uses: peaceiris/actions-gh-pages@v3
294+
with:
295+
github_token: ${{ secrets.GITHUB_TOKEN }}
296+
publish_dir: ./dist
297+
keep_files: true
298+
destination_dir: builds/latest
299+
252300
docs:
253301

254302
runs-on: ubuntu-latest

.github/workflows/draft-pdf.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ jobs:
3030
- name: Install MicroPython modules
3131
run: |
3232
micropython -m mip install github:jonnor/micropython-npyfile
33-
micropython -m mip install https://emlearn.github.io/emlearn-micropython/builds/master/x64_6.3/emlearn_trees.mpy
34-
micropython -m mip install https://emlearn.github.io/emlearn-micropython/builds/master/x64_6.3/emlearn_fft.mpy
33+
micropython -m mip install https://emlearn.github.io/emlearn-micropython/builds/latest/x64_6.3/emlearn_trees.mpy
34+
micropython -m mip install https://emlearn.github.io/emlearn-micropython/builds/latest/x64_6.3/emlearn_fft.mpy
3535
- name: Run example
3636
working-directory: paper
3737
run: python create_plot.py

Makefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ PORT_BUILD_DIR=$(MPY_DIR)/ports/$(PORT)/build-$(BOARD)
2727
PORT_DIST_DIR=./dist/ports/$(PORT)/$(BOARD)
2828

2929
UNIX_MICROPYTHON = ./dist/ports/unix/micropython
30-
30+
WEBASSEMBLY_MICROPYTHON = ./dist/ports/webassembly/micropython.mjs
3131

3232
# List of modules
3333
MODULES = emlearn_trees \
@@ -72,6 +72,17 @@ $(UNIX_MICROPYTHON): $(PORT_DIR)
7272

7373
unix: $(UNIX_MICROPYTHON)
7474

75+
$(WEBASSEMBLY_MICROPYTHON): $(PORT_DIR)
76+
emcc --version
77+
mkdir -p $(PORT_DIR)/../webassembly
78+
make -C $(MPY_DIR)/ports/webassembly VARIANT=standard V=1 USER_C_MODULES=$(C_MODULES_SRC_PATH) FROZEN_MANIFEST=$(MANIFEST_PATH) CFLAGS_EXTRA="-Wno-unused-function -Wno-unused-function ${CFLAGS_EXTRA}" -j4
79+
cp $(MPY_DIR)/ports/webassembly/build-standard/micropython.mjs $@
80+
cp $(MPY_DIR)/ports/webassembly/build-standard/micropython.wasm dist/ports/webassembly/
81+
82+
83+
webassembly: $(WEBASSEMBLY_MICROPYTHON)
84+
85+
7586
check_unix: $(UNIX_MICROPYTHON)
7687
$(UNIX_MICROPYTHON) tests/test_all.py test_iir,test_fft,test_arrayutils
7788
# TODO: enable more modules

docs/developing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ You will need to have **Python 3.10+ or later** already installed.
1818
We assume that **micropython** git repository available.
1919
It is assumed to be at the same level as this repository in the file system.
2020
If using another location, adjust `MPY_DIR` accordingly.
21-
You should be using MicroPython 1.26 (or newer).
21+
You should be using MicroPython 1.27 (or newer).
2222

2323
You should build and install the [MicroPython Unix port](https://github.com/micropython/micropython/blob/master/ports/unix/README.md) to run/test on PC (`micropython` executable).
2424

docs/getting_started_device.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ For ESP32 use the ``xtensawin`` architecture.
4343

4444
.. code-block:: console
4545
46-
mpremote mip install https://emlearn.github.io/emlearn-micropython/builds/master/xtensawin_6.3/emlearn_trees.mpy
46+
mpremote mip install https://emlearn.github.io/emlearn-micropython/builds/latest/xtensawin_6.3/emlearn_trees.mpy
4747
4848
For ARM Cortex M4F/M33/M7 etc use the ``armv7emsp`` architecture.
4949

5050
.. code-block:: console
5151
52-
mpremote mip install https://emlearn.github.io/emlearn-micropython/builds/master/armv7emsp_6.3/emlearn_trees.mpy
52+
mpremote mip install https://emlearn.github.io/emlearn-micropython/builds/latest/armv7emsp_6.3/emlearn_trees.mpy
5353
5454
For more details about architectures for native modules, see `MicroPython mpyfiles documentation <https://docs.micropython.org/en/latest/reference/mpyfiles.html#versioning-and-compatibility-of-mpy-files>`_
5555

docs/getting_started_host.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ This example uses the ``emlearn_trees`` module, so that is what we will install.
6262

6363
.. code-block:: console
6464
65-
micropython -m mip install https://emlearn.github.io/emlearn-micropython/builds/master/x64_6.3/emlearn_trees.mpy
65+
micropython -m mip install https://emlearn.github.io/emlearn-micropython/builds/latest/x64_6.3/emlearn_trees.mpy
6666
6767
Create model in Python
6868
===========================

docs/native_modules.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ The following is an overview of .mpy ABI version for MicroPython releases.
3636
+---------------------+---------------+
3737
| MicroPython version | .mpy version |
3838
+=====================+===============+
39+
| 1.27.x | 6.3 |
40+
+---------------------+---------------+
3941
| 1.26.x | 6.3 |
4042
+---------------------+---------------+
4143
| 1.25.x | 6.3 |
@@ -89,7 +91,7 @@ The directory structure is as follows:
8991
https://emlearn.github.io/emlearn-micropython/builds/$VERSION/$ARCH_$ABI/$MODULE.mpy
9092

9193
where:
92-
VERSION=master|0.9.0
94+
VERSION=latest|0.10.0
9395
MODULE=emlearn_trees
9496
ARCH=xtensawin
9597
ABI=6.3
@@ -105,5 +107,5 @@ For example, to install ``emlearn_trees`` for MicroPython 1.25 (ABI 6.3) on ESP3
105107

106108
::
107109

108-
mpremote mip install https://emlearn.github.io/emlearn-micropython/builds/master/xtensawin_6.3/emlearn_trees.mpy
110+
mpremote mip install https://emlearn.github.io/emlearn-micropython/builds/latest/xtensawin_6.3/emlearn_trees.mpy
109111

docs/support.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ There are no long-term-support or bugfix versions of emlearn-micropython, at thi
1919
================== ======================
2020
MicroPython emlearn-micropython
2121
================== ======================
22-
1.26.x master
22+
1.27.x master
23+
1.27.x 0.10.x
2324
1.26.x 0.9.x
2425
1.25.x 0.8.x
25-
1.24.x 0.7.0
26-
1.23.x 0.6.0
2726
================== ======================
2827

2928
If you build emlearn-micropython from source,

examples/har_trees/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ cd emlearn-micropython/examples/har_trees
7070

7171
Install the dependencies
7272
```console
73-
micropython -m mip install https://emlearn.github.io/emlearn-micropython/builds/master/x64_6.3/emlearn_trees.mpy
73+
micropython -m mip install https://emlearn.github.io/emlearn-micropython/builds/latest/x64_6.3/emlearn_trees.mpy
7474

7575
micropython har_run.py
7676
```
@@ -93,7 +93,7 @@ Make sure to have MicroPython installed on device.
9393

9494
Install the dependencies
9595
```console
96-
mpremote mip install https://emlearn.github.io/emlearn-micropython/builds/master/xtensawin_6.3/emlearn_trees.mpy
96+
mpremote mip install https://emlearn.github.io/emlearn-micropython/builds/latest/xtensawin_6.3/emlearn_trees.mpy
9797
mpremote mip install github:jonnor/micropython-npyfile
9898
mpremote mip install github:jonnor/micropython-zipfile
9999
```

examples/mnist_cnn/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ python mnist_train.py
3030
## Running on host
3131

3232
```console
33-
micropython -m mip install https://emlearn.github.io/emlearn-micropython/builds/master/x64_6.3/emlearn_cnn_int8.mpy
33+
micropython -m mip install https://emlearn.github.io/emlearn-micropython/builds/latest/x64_6.3/emlearn_cnn_int8.mpy
3434

3535
micropython mnist_cnn_run.py
3636
```
@@ -50,7 +50,7 @@ Flash your device with a standard MicroPython firmware,
5050
from the MicroPython.org downloads page.
5151

5252
```console
53-
mpremote mip install https://emlearn.github.io/emlearn-micropython/builds/master/xtensawin_6.3/emlearn_cnn_int8.mpy
53+
mpremote mip install https://emlearn.github.io/emlearn-micropython/builds/latest/xtensawin_6.3/emlearn_cnn_int8.mpy
5454
```
5555

5656
```console

0 commit comments

Comments
 (0)