Skip to content

Commit

Permalink
Merge pull request #65 from jreesun/sd-firmware
Browse files Browse the repository at this point in the history
Bake software into firmware; allow airgapped OTA upgrades via microSD
  • Loading branch information
Jeff authored Nov 29, 2021
2 parents 20694b2 + b0427df commit 9c09e1c
Show file tree
Hide file tree
Showing 9,303 changed files with 37,116 additions and 3,642,988 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
11 changes: 5 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
###################
*.o
*.a
!libmaix_asr.a
*.elf
*.bin
*.map
Expand Down Expand Up @@ -55,8 +54,8 @@ genrst/
in.txt
out.txt
sitemap.xml.gz

# Krux User Settings
src/settings/network.txt
src/settings/printer.baudrate.txt
src/settings/printer.paper_width.txt
*.bin
*.bin.sig
*.bin.sha256.txt
memzip-files.c
memzip-files.zip
7 changes: 5 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
[submodule "embit"]
path = vendor/embit
url = ../../diybitcoinhardware/embit
[submodule "MaixPy/components/micropython/port/src/secp256k1-embedded"]
path = MaixPy/components/micropython/port/src/secp256k1-embedded
[submodule "firmware/MaixPy/components/micropython/port/src/secp256k1-embedded"]
path = firmware/MaixPy/components/micropython/port/src/secp256k1-embedded
url = ../../diybitcoinhardware/secp256k1-embedded
[submodule "urtypes"]
path = vendor/urtypes
url = ../urtypes
[submodule "foundation-ur-py"]
path = vendor/foundation-ur-py
url = ../../Foundation-Devices/foundation-ur-py
[submodule "firmware/Kboot"]
path = firmware/Kboot
url = ../Kboot
18 changes: 12 additions & 6 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,11 @@ disable=print-statement,
consider-using-with,
no-self-use,
consider-using-enumerate,
unspecified-encoding
unspecified-encoding,
exec-used,
import-outside-toplevel,
wrong-import-position,
wrong-import-order

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down Expand Up @@ -252,6 +256,7 @@ contextmanager-decorators=contextlib.contextmanager
# system, and so shouldn't trigger E1101 when accessed. Python regular
# expressions are accepted.
generated-members=sleep_ms,
ticks_ms,
print_exception

# Tells whether missing members accessed in mixin class should be ignored. A
Expand Down Expand Up @@ -449,6 +454,7 @@ good-names=i,
sc,
tx,
Run,
firmware_hash,
_

# Good variable names regexes, separated by a comma. If names match any regex,
Expand Down Expand Up @@ -577,10 +583,10 @@ valid-metaclass-classmethod-first-arg=cls
[DESIGN]

# Maximum number of arguments for function / method.
max-args=6
max-args=7

# Maximum number of attributes for a class (see R0902).
max-attributes=10
max-attributes=11

# Maximum number of boolean expressions in an if statement (see R0916).
max-bool-expr=5
Expand All @@ -589,7 +595,7 @@ max-bool-expr=5
max-branches=16

# Maximum number of locals for function / method body.
max-locals=18
max-locals=20

# Maximum number of parents for a class (see R0901).
max-parents=7
Expand All @@ -598,10 +604,10 @@ max-parents=7
max-public-methods=20

# Maximum number of return / yield for function / method body.
max-returns=6
max-returns=10

# Maximum number of statements in function / method body.
max-statements=50
max-statements=56

# Minimum number of public methods for a class (see R0903).
min-public-methods=1
Expand Down
56 changes: 42 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,65 @@
# THE SOFTWARE.

# syntax=docker/dockerfile:1
FROM gcc:9.4.0-buster AS builder
FROM gcc:9.4.0-buster AS build-base

RUN apt-get update -y && \
apt-get install --no-install-recommends -y -q \
wget \
tar \
zip \
unzip \
build-essential \
libtool \
autoconf \
libisl-dev \
python3 \
python3-pip
python3-pip \
python3-setuptools

RUN wget https://github.com/Kitware/CMake/releases/download/v3.21.0/cmake-3.21.0.tar.gz
RUN echo "4a42d56449a51f4d3809ab4d3b61fd4a96a469e56266e896ce1009b5768bd2ab cmake-3.21.0.tar.gz" | sha256sum -c
RUN tar -xzvf cmake-3.21.0.tar.gz
RUN cd cmake-3.21.0 && ./bootstrap && make && make install
RUN wget https://github.com/Kitware/CMake/releases/download/v3.21.0/cmake-3.21.0.tar.gz && \
echo "4a42d56449a51f4d3809ab4d3b61fd4a96a469e56266e896ce1009b5768bd2ab cmake-3.21.0.tar.gz" | sha256sum -c && \
tar -xzvf cmake-3.21.0.tar.gz && \
cd cmake-3.21.0 && ./bootstrap && make && make install

RUN mkdir -p /opt
RUN wget https://github.com/kendryte/kendryte-gnu-toolchain/releases/download/v8.2.0-20190213/kendryte-toolchain-ubuntu-amd64-8.2.0-20190213.tar.gz
RUN echo "aa2fcc76ff61261b3667a422d4f67dec19c4547474bff4ebadaa1258b87985da kendryte-toolchain-ubuntu-amd64-8.2.0-20190213.tar.gz" | sha256sum -c
RUN tar -xzvf kendryte-toolchain-ubuntu-amd64-8.2.0-20190213.tar.gz -C /opt
RUN mkdir -p /opt && \
wget https://github.com/kendryte/kendryte-gnu-toolchain/releases/download/v8.2.0-20190213/kendryte-toolchain-ubuntu-amd64-8.2.0-20190213.tar.gz && \
echo "aa2fcc76ff61261b3667a422d4f67dec19c4547474bff4ebadaa1258b87985da kendryte-toolchain-ubuntu-amd64-8.2.0-20190213.tar.gz" | sha256sum -c && \
tar -xzvf kendryte-toolchain-ubuntu-amd64-8.2.0-20190213.tar.gz -C /opt

FROM builder AS build
RUN pip3 install astor

FROM build-base AS build-software
COPY . /src
WORKDIR /src/MaixPy
WORKDIR /src
ARG LOCALE="en-US"
RUN cd vendor/embit && pip3 install -e .
RUN mkdir build && \
cp -r src/. build && \
cp -r vendor/embit/src/embit build && \
rm -rf build/embit/util/prebuilt && \
rm -f build/embit/util/ctypes_secp256k1.py && \
cp -r vendor/urtypes/src/urtypes build && \
cp -r vendor/foundation-ur-py/ur build && \
cp -r firmware/MaixPy/projects/maixpy_m5stickv/builtin_py/. build && \
rm -f build/_boot.py && \
cp LICENSE.md build/LICENSE.md && \
find build -regex '^.*\(__pycache__\|\.py[co]\|\.DS_Store\)$' -delete
RUN cd i18n && \
python3 i18n.py translate "${LOCALE}" /src/build
RUN find /src/build -type f -name \*.py -exec sh -c "python3 ./firmware/scripts/minify.py {}" \;

FROM build-software AS build-firmware
WORKDIR /src/firmware/MaixPy
RUN pip3 install -r requirements.txt

RUN python3 ./components/micropython/core/lib/memzip/make-memzip.py --zip-file ./components/micropython/port/memzip-files.zip --c-file ./components/micropython/port/memzip-files.c /src/build
RUN cd projects/maixpy_m5stickv && \
python3 project.py clean && \
python3 project.py distclean && \
python3 project.py build
python3 project.py build && \
mv build/maixpy.bin build/firmware.bin

FROM build-firmware AS build
WORKDIR /src/firmware/Kboot/build
RUN cp /src/firmware/MaixPy/projects/maixpy_m5stickv/build/firmware.bin .
RUN ./CLEAN.sh && ./BUILD.sh
39 changes: 0 additions & 39 deletions MaixPy/components/drivers/CMakeLists.txt

This file was deleted.

33 changes: 0 additions & 33 deletions MaixPy/components/drivers/Kconfig

This file was deleted.

109 changes: 0 additions & 109 deletions MaixPy/components/drivers/amg88xx/include/amg88xx.h

This file was deleted.

Loading

0 comments on commit 9c09e1c

Please sign in to comment.