Skip to content
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
45 changes: 44 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,49 @@ jobs:
path: dist


build-riscv:
runs-on: ubuntu-24.04
env:
MPY_DIR: ./micropython
MICROPYTHON_BIN: ./micropython/ports/unix/build-nomodules/micropython
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install OS dependencies
run: sudo add-apt-repository universe
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- uses: actions/checkout@v4
with:
repository: jonnor/micropython
path: micropython
ref: v1.25.0-armv6m-abs-relocations
- name: Install Python dependencies
run: pip install -r requirements.txt

- name: Setup MicroPython ESP32
working-directory: micropython
run: |
source tools/ci.sh && ci_esp32_idf_setup && ci_gcc_riscv_setup
make -C mpy-cross
- name: Setup submodules esp32
working-directory: micropython/ports/esp32
run: source ../../esp-idf/export.sh && make submodules
- name: Build custom firmware with extmod, ESP32
run: |
source micropython/esp-idf/export.sh && pip install -r requirements.txt
echo make extmod PORT=esp32 BOARD=ESP32_GENERIC_C6
- name: Build nadmod xtensawin
run: source micropython/esp-idf/export.sh && pip install -r requirements.txt && make dist ARCH=rv32imc V=1
- name: Archive dist artifacts
uses: actions/upload-artifact@v4
with:
name: emlearn-micropython-build-riscv
path: dist


build-macos:
runs-on: macos-latest
env:
Expand Down Expand Up @@ -178,7 +221,7 @@ jobs:
deploy-pages:
permissions:
contents: write
needs: [build-linux, build-arm, build-esp32, build-macos]
needs: [build-linux, build-arm, build-esp32, build-macos, build-riscv]
runs-on: ubuntu-latest

steps:
Expand Down
28 changes: 23 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,34 @@ git clone https://github.com/emlearn/emlearn-micropython
```

#### Prerequisites
These come in addition to the prequisites described above.

Make sure you have the dependencies needed to build for your platform.
See [MicroPython: Building native modules](https://docs.micropython.org/en/latest/develop/natmod.html).
You will need to have **Python 3.10+ or later** already installed.

We assume that micropython is installed in the same place as this repository.
We assume that **micropython** git repository available.
It is assumed to be at the same level as this repository in the file system.
If using another location, adjust `MPY_DIR` accordingly.

You should be using MicroPython 1.25 (or newer).

Make sure you have the **build toolchain** needed for your platform.
See [MicroPython: Building native modules](https://docs.micropython.org/en/latest/develop/natmod.html),
and the documentation for the MicroPython port/architecture of interest.

#### Download dependencies

Fetch git submodules

```
git submodule update --init
```

Recommend using a Python virtual environment.

Install Python packages
```
pip install -r requirements.txt
```


#### Build

Build the .mpy native module
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ emlearn>=0.21.2
scikit-learn>=1.0.0
ar>=1.0.0
pyelftools>=0.31
setuptools>=71.0.0
5 changes: 3 additions & 2 deletions src/emlearn_iir_q15/iir_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

#include <string.h>

// memset is used by some standard C constructs
#if !defined(__linux__)
// memset is used by some standard C constructs. Missing on some platforms, but not all...
// Unfortunately cannot use weak symbols with mpy_ld
#if !(defined(__linux__) || defined(__riscv__) || defined(__riscv))
void *memcpy(void *dst, const void *src, size_t n) {
return mp_fun_table.memmove_(dst, src, n);
}
Expand Down
Loading