-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #137 from gyroflow/add-build-ci
Add build ci
- Loading branch information
Showing
10 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Build Firmware | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
workflow_dispatch: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10.4" | ||
|
||
- name: Build modules | ||
run: | | ||
python3 tools/build.py | ||
- name: Prepare esp-idf and micropython | ||
run: | | ||
git clone -b v4.2 --recursive https://github.com/espressif/esp-idf.git | ||
git clone https://github.com/micropython/micropython.git micropython | ||
- name: Install modules | ||
run: | | ||
cp -a build/. micropython/ports/esp32/modules/ | ||
- name: Build ESP32 GENERIC v1.19.1 | ||
run: | | ||
cd esp-idf | ||
./install.sh | ||
source export.sh | ||
cd .. | ||
cd micropython | ||
git checkout 9b486340da22931cde82872f79e1c34db959548b | ||
git submodule update --init --recursive | ||
make -C mpy-cross | ||
cd ports/esp32 | ||
make submodules | ||
make | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: flowshutter-${{ github.run_number }} | ||
path: micropython/ports/esp32/build-GENERIC/firmware.bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,6 @@ pymakr.conf | |
.DS_Store | ||
*~ | ||
check_sha.json | ||
build | ||
micropython | ||
esp-idf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"yaml.schemas": { | ||
"https://json.schemastore.org/github-workflow.json": "file:///f%3A/GitHub/flowshutter/.github/workflows/build.yml" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import gc | ||
import uos | ||
from flashbdev import bdev | ||
|
||
try: | ||
if bdev: | ||
uos.mount(bdev, "/") | ||
except OSError: | ||
import inisetup | ||
|
||
vfs = inisetup.setup() | ||
|
||
gc.collect() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# APA106driver for MicroPython on ESP32 | ||
# MIT license; Copyright (c) 2016 Damien P. George | ||
|
||
from neopixel import NeoPixel | ||
|
||
|
||
class APA106(NeoPixel): | ||
ORDER = (0, 1, 2, 3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from esp32 import Partition | ||
|
||
# MicroPython's partition table uses "vfs", TinyUF2 uses "ffat". | ||
bdev = Partition.find(Partition.TYPE_DATA, label="vfs") | ||
if not bdev: | ||
bdev = Partition.find(Partition.TYPE_DATA, label="ffat", block_size=512) | ||
bdev = bdev[0] if bdev else None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import uos | ||
from flashbdev import bdev | ||
|
||
|
||
def check_bootsec(): | ||
buf = bytearray(bdev.ioctl(5, 0)) # 5 is SEC_SIZE | ||
bdev.readblocks(0, buf) | ||
empty = True | ||
for b in buf: | ||
if b != 0xFF: | ||
empty = False | ||
break | ||
if empty: | ||
return True | ||
fs_corrupted() | ||
|
||
|
||
def fs_corrupted(): | ||
import time | ||
|
||
while 1: | ||
print( | ||
"""\ | ||
The filesystem appears to be corrupted. If you had important data there, you | ||
may want to make a flash snapshot to try to recover it. Otherwise, perform | ||
factory reprogramming of MicroPython firmware (completely erase flash, followed | ||
by firmware programming). | ||
""" | ||
) | ||
time.sleep(3) | ||
|
||
|
||
def setup(): | ||
check_bootsec() | ||
print("Performing initial setup") | ||
uos.VfsLfs2.mkfs(bdev) | ||
vfs = uos.VfsLfs2(bdev) | ||
uos.mount(vfs, "/") | ||
with open("boot.py", "w") as f0: | ||
f0.write("import startup") | ||
f0.close() | ||
|
||
with open("main.py", "w") as f1: | ||
f1.write("import entry") | ||
f1.close() | ||
|
||
return vfs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import os | ||
|
||
files = os.listdir("src/") | ||
|
||
try: | ||
files.remove("boot.py") | ||
files.remove("LICENSE") | ||
files.remove("main.py") | ||
files.remove("README.md") | ||
files.remove("sha.json") | ||
except ValueError: | ||
pass | ||
|
||
files = sorted(files) | ||
|
||
import shutil | ||
for f in files: | ||
shutil.copyfile('src/'+f, 'build/'+f) |
Binary file not shown.
Binary file not shown.