Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Commit

Permalink
Merge branch 'n0xa:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Niximkk authored Apr 17, 2024
2 parents db90b3f + 53c1771 commit 5d438ff
Show file tree
Hide file tree
Showing 24 changed files with 1,905 additions and 141 deletions.
46 changes: 41 additions & 5 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
name: "M5Cardputer",
fqbn: "m5stack:esp32:m5stack_cardputer",
extra_flags: "-DCARDPUTER",
libraries: "M5Cardputer IRRemoteESP8266",
libraries: "M5Cardputer IRRemoteESP8266 M5Stack-SD-Updater M5Unified",
partitions: {
bootloader_addr: "0x0000",
},
Expand All @@ -44,7 +44,7 @@ jobs:
name: "M5StickCPlus2",
fqbn: "m5stack:esp32:m5stack_stickc_plus2",
extra_flags: "-DSTICK_C_PLUS2",
libraries: "M5StickCPlus2 IRRemoteESP8266",
libraries: "M5StickCPlus2 IRRemoteESP8266 M5Stack-SD-Updater M5Unified",
partitions: {
bootloader_addr: "0x1000",
},
Expand All @@ -53,7 +53,7 @@ jobs:
name: "M5StickCPlus",
fqbn: "m5stack:esp32:m5stack_stickc_plus",
extra_flags: "-DSTICK_C_PLUS",
libraries: "M5StickCPlus IRRemoteESP8266",
libraries: "M5StickCPlus IRRemoteESP8266 M5Stack-SD-Updater M5Unified",
partitions: {
bootloader_addr: "0x1000",
},
Expand All @@ -63,7 +63,7 @@ jobs:
fqbn: "m5stack:esp32:m5stack_stickc",
extra_flags: "-DSTICK_C",
# TODO: M5StickC's latest version has some dependency issues with M5Hat-JoyC library
libraries: "[email protected] IRRemoteESP8266",
libraries: "[email protected] IRRemoteESP8266 M5Stack-SD-Updater M5Unified",
partitions: {
bootloader_addr: "0x1000",
},
Expand Down Expand Up @@ -104,6 +104,43 @@ jobs:
run: |
pip install -U esptool
- name: Setup platform.txt
run: |
baseFolder="$HOME/.arduino15/packages/m5stack/hardware/esp32"
# Find the latest version of the folder
latestVersion=$(find "$baseFolder" -maxdepth 1 -type d -exec basename {} \; | sort -V | head -n 1)
if [ -z "$latestVersion" ]; then
echo "No version found."
read -p "Press Enter to exit."
exit 1
fi
# Full path to the file to be edited
file="$baseFolder/$latestVersion/platform.txt"
backupFile="$baseFolder/$latestVersion/platform.txt.bkp"
prefix="build.extra_flags.esp32"
option=" -w "
prefix2="compiler.c.elf.libs.esp32"
option2=" -zmuldefs "
# Use awk to insert options after the first equals sign on lines with specified prefixes
awk -v prefix="$prefix" -v option="$option" -v prefix2="$prefix2" -v option2="$option2" '{
if ($0 ~ "^" prefix) {
sub(/=/, "=" option);
print;
} else if ($0 ~ "^" prefix2) {
sub(/=/, "=" option2);
print;
} else {
print;
}
}' "$file" > "$file.tmp" && mv "$file.tmp" "$file"

echo "Done."

- name: Compile ${{ matrix.board.name }} Sketch
run: |
set -x
Expand Down Expand Up @@ -200,4 +237,3 @@ jobs:
files: |
M5Nemo-*.bin
233 changes: 233 additions & 0 deletions .github/workflows/dev_compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
---
name: Compile Develop Brench

on:
push:
branches:
- main
tags:
- "*"
pull_request:
branches:
- main
workflow_dispatch:
inputs:
board:
description: 'Board to Compile'
type: choice
required: true
default: 'M5Cardputer'
options: ['M5Cardputer', 'M5StickCPlus2', 'M5StickCPlus', 'M5StickC']

jobs:
compile_sketch:
name: Build ${{ matrix.board.name }} (${{ matrix.locale }})
runs-on: ubuntu-latest
strategy:
# max-parallel: 4
fail-fast: false
matrix:
locale:
- en-us
- pt-br
board:
- {
name: "M5Cardputer",
fqbn: "m5stack:esp32:m5stack_cardputer",
extra_flags: "-DCARDPUTER",
libraries: "M5Cardputer IRRemoteESP8266 M5Stack-SD-Updater M5Unified",
partitions: {
bootloader_addr: "0x0000",
},
}
- {
name: "M5StickCPlus2",
fqbn: "m5stack:esp32:m5stack_stickc_plus2",
extra_flags: "-DSTICK_C_PLUS2",
libraries: "M5StickCPlus2 IRRemoteESP8266 M5Stack-SD-Updater M5Unified",
partitions: {
bootloader_addr: "0x1000",
},
}
- {
name: "M5StickCPlus",
fqbn: "m5stack:esp32:m5stack_stickc_plus",
extra_flags: "-DSTICK_C_PLUS",
libraries: "M5StickCPlus IRRemoteESP8266 M5Stack-SD-Updater M5Unified",
partitions: {
bootloader_addr: "0x1000",
},
}
- {
name: "M5StickC",
fqbn: "m5stack:esp32:m5stack_stickc",
extra_flags: "-DSTICK_C",
# TODO: M5StickC's latest version has some dependency issues with M5Hat-JoyC library
libraries: "[email protected] IRRemoteESP8266 M5Stack-SD-Updater M5Unified",
partitions: {
bootloader_addr: "0x1000",
},
}

steps:
- uses: actions/checkout@v4

- id: nemo_version
name: Get NEMO Version
run: |
set -x
if [[ "${{ github.ref_type }}" == "tag" ]]; then
version=${{ github.ref_name }}
else
version="${GITHUB_SHA::7}"
fi
echo "version=${version}" > $GITHUB_OUTPUT
- name: Setup Arduino CLI
uses: arduino/setup-arduino-cli@v1

- name: Install platform
run: |
set -x
# arduino-cli core install esp32:esp32
arduino-cli core install m5stack:esp32 --additional-urls "file:///${PWD}/package_m5stack_index.json"
arduino-cli core search m5stack
arduino-cli board listall
arduino-cli lib install ${{ matrix.board.libraries }} --log-level warn --verbose
- name: Install esptool
run: |
pip install -U esptool
- name: Setup platform.txt
run: |
baseFolder="$HOME/.arduino15/packages/m5stack/hardware/esp32"
# Find the latest version of the folder
latestVersion=$(find "$baseFolder" -maxdepth 1 -type d -exec basename {} \; | sort -V | head -n 1)
# Full path to the file to be edited
file="$baseFolder/$latestVersion/platform.txt"
backupFile="$baseFolder/$latestVersion/platform.txt.bkp"
prefix="build.extra_flags.esp32"
option=" -w "
prefix2="compiler.c.elf.libs.esp32"
option2=" -zmuldefs "
# Use awk to insert options after the first equals sign on lines with specified prefixes
awk -v prefix="$prefix" -v option="$option" -v prefix2="$prefix2" -v option2="$option2" '{
if ($0 ~ "^" prefix) {
sub(/=/, "=" option);
print;
} else if ($0 ~ "^" prefix2) {
sub(/=/, "=" option2);
print;
} else {
print;
}
}' "$file" > "$file.tmp" && mv "$file.tmp" "$file"

echo "Done."

- name: Compile ${{ matrix.board.name }} Sketch
run: |
set -x
version=${{ steps.nemo_version.outputs.version }}
locale=${{ matrix.locale }}
language=$(echo "LANGUAGE_${locale//-/_}" | tr '[:lower:]' '[:upper:]')
extra_flags="${{ matrix.board.extra_flags }} -DNEMO_VERSION=\"${version}\" -D${language}"
arduino-cli compile --fqbn ${{ matrix.board.fqbn }} -e \
--build-property build.partitions=huge_app \
--build-property upload.maximum_size=3145728 \
--build-property compiler.cpp.extra_flags="${extra_flags}" \
./m5stick-nemo.ino
- name: Create ${{ matrix.board.name }} Firmware Binary
run: |
set -x
version=${{ steps.nemo_version.outputs.version }}
locale=${{ matrix.locale }}
if [[ "${locale}" == "en-us" ]]; then
output_file="M5Nemo-${version}-${{ matrix.board.name }}.bin"
else
output_file="M5Nemo-${version}-${{ matrix.board.name }}.${locale}.bin"
fi
fqbn=${{ matrix.board.fqbn }}
directory="${fqbn//:/.}"
esptool.py --chip esp32s3 merge_bin --output ${output_file} \
${{ matrix.board.partitions.bootloader_addr }} build/${directory}/m5stick-nemo.ino.bootloader.bin \
0x8000 build/${directory}/m5stick-nemo.ino.partitions.bin \
0x10000 build/${directory}/m5stick-nemo.ino.bin
- name: List all files
if: always()
continue-on-error: true
run: |
set -x
pwd
ls -all
tree
# TODO: Validate the firmware

- name: Upload ${{ matrix.board.name }} Firmware Binary
uses: actions/upload-artifact@v4
with:
name: M5Nemo-${{ matrix.board.name }}.${{ matrix.locale }}
path: M5Nemo-*.bin
if-no-files-found: error

create_release:
runs-on: ubuntu-latest
environment: github_release
needs: [compile_sketch]
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'

steps:
- id: nemo_version
name: Get NEMO Version
run: |
set -x
if [[ "${{ github.ref_type }}" == "tag" ]]; then
version=${{ github.ref_name }}
else
version="${GITHUB_SHA::7}"
fi
echo "version=${version}" > $GITHUB_OUTPUT
- uses: actions/download-artifact@v4
with:
merge-multiple: true

- name: List all files
if: always()
run: |
set -x
pwd
ls -all
tree
- name: Create Release ${{ steps.nemo_version.outputs.version }}
uses: softprops/action-gh-release@v1
with:
name: NEMO Release ${{ steps.nemo_version.outputs.version }}
tag_name: ${{ steps.nemo_version.outputs.version }}
generate_release_notes: true
files: |
M5Nemo-*.bin
52 changes: 52 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
FROM python:3.6-slim

ENV PYTHONBUFFERED=1

# Install required packages and tools
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
bash \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=/usr/bin sh

# Ensure pip is installed and upgrade it
RUN python3 -m ensurepip
RUN pip3 install --no-cache --upgrade pip setuptools pyserial esptool

# Install 32-bit C++ standard library
RUN apt-get update && apt-get install -y --no-install-recommends \
lib32stdc++6 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Install m5stack boards
COPY ./package_m5stack_index.json /package_m5stack_index.json
RUN arduino-cli core install m5stack:esp32 --additional-urls "file:///package_m5stack_index.json" --log-level warn --verbose

RUN arduino-cli core search m5stack
RUN arduino-cli board listall
#
# Create a directory for the prerequisites script
RUN mkdir -p /deauth_prerequisites
COPY ./deauth_prerequisites/install_prerequisites_Linux.sh /deauth_prerequisites/install_prerequisites_linux.sh

# Make the script executable
RUN chmod +x /deauth_prerequisites/install_prerequisites_linux.sh

# Run the script
RUN /deauth_prerequisites/install_prerequisites_linux.sh

ARG LIBRARIES

# Install required libraries
RUN arduino-cli lib install $LIBRARIES --log-level warn --verbose

COPY ./scripts/compile.sh /compile.sh
RUN chmod +x /compile.sh

COPY ./scripts/entrypoint.sh ./entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
Loading

0 comments on commit 5d438ff

Please sign in to comment.