Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.2.8 #184

Closed
wants to merge 20 commits into from
Closed

1.2.8 #184

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
31 changes: 24 additions & 7 deletions .github/workflows/ArduinoBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ jobs:
#- 2.0.4
#- 2.0.5
#- 2.0.6
- 2.0.7
- 2.0.8
- 2.0.9
# - 2.0.7
# - 2.0.8
# - 2.0.9
- 2.0.11
- 2.0.12
- 2.0.13

matrix-context:
- M5Core2-test
Expand Down Expand Up @@ -67,9 +70,12 @@ jobs:
#- sdk-version: 2.0.1
#- sdk-version: 2.0.5
#- sdk-version: 2.0.6
- sdk-version: 2.0.7
- sdk-version: 2.0.8
- sdk-version: 2.0.9
# - sdk-version: 2.0.7
# - sdk-version: 2.0.8
# - sdk-version: 2.0.9
- sdk-version: 2.0.11
- sdk-version: 2.0.12
- sdk-version: 2.0.13

# library health test sketches
- { matrix-context: M5Core2-test, arduino-board: m5stack-core2, sketch-names: M5Core2-SDLoader-Snippet.ino, required-libraries: "M5Core2", ... }
Expand Down Expand Up @@ -111,12 +117,21 @@ jobs:
#sketch-names: TTGO-test.ino
#required-libraries: "ESP32-Chimera-Core,LovyanGFX,ArduinoJson"
- matrix-context: M5Atom
sdk-version: 2.0.8
sdk-version: 2.0.13
arduino-board: m5stack-atom
sketch-names: M5Stack-SD-Menu.ino
launcher-name: M5Atom-Launcher
required-libraries: "ESP32-Chimera-Core,LovyanGFX,ArduinoJson,Button2"

- matrix-context: M5CoreS3
sdk-version: 2.0.13
arduino-board: m5stack-cores3
sketch-names: M5Stack-SD-Menu.ino,M5Stack-FW-Menu.ino
launcher-name: M5CoreS3-Launcher
factory-name: M5CoreS3-FW-Launcher
required-libraries: "ESP32-Chimera-Core,LovyanGFX,ArduinoJson,Button2"


fail-fast: false

steps:
Expand Down Expand Up @@ -144,6 +159,7 @@ jobs:
run: |
cp examples/M5Stack-SD-Menu/build/M5Stack-SD-Menu.ino.bin examples/M5Stack-SD-Menu/build/${{ matrix.launcher-name }}-${{ matrix.sdk-version }}.bin
FILE=examples/AppStore/build/AppStore.ino.bin && [ -f "$FILE" ] && cp $FILE examples/M5Stack-SD-Menu/build/${{ matrix.appstore-name }}-${{ matrix.sdk-version }}.bin || true
FILE=examples/M5Stack-FW-Menu/build/M5Stack-FW-Menu.ino.bin && [ -f "$FILE" ] && cp $FILE examples/M5Stack-SD-Menu/build/${{ matrix.factory-name }}-${{ matrix.sdk-version }}.bin || true
- name: Upload artifact ${{ matrix.matrix-context }}
uses: actions/upload-artifact@v3
if: startsWith(matrix.sketch-names, 'M5Stack-SD-Menu')
Expand All @@ -152,6 +168,7 @@ jobs:
path: |
examples/M5Stack-SD-Menu/build/${{ matrix.launcher-name }}-${{ matrix.sdk-version }}.bin
examples/M5Stack-SD-Menu/build/${{ matrix.appstore-name }}-${{ matrix.sdk-version }}.bin
examples/M5Stack-SD-Menu/build/${{ matrix.factory-name }}-${{ matrix.sdk-version }}.bin

post_build:
name: Gather Artefacts
Expand Down
94 changes: 79 additions & 15 deletions .github/workflows/PlatformioBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,61 @@ on:

jobs:

plan_version:
name: Version planner
runs-on: ubuntu-latest
outputs:
env: ${{steps.set-env.outputs.env}}
steps:
- name: "Fetch arduino cores versions list"
run: |
export VERSIONS_REL=(`curl -s https://espressif.github.io/arduino-esp32/package_esp32_index.json | jq -r '.packages.[0].platforms[].version' | awk 'NR <= 5'`)
export VERSIONS_DEV=(`curl -s https://espressif.github.io/arduino-esp32/package_esp32_dev_index.json | jq -r '.packages.[0].platforms[].version' | awk 'NR <= 5'`)

echo "latest=${VERSIONS_REL[0]}" >> $GITHUB_ENV
echo "prev_0=${VERSIONS_REL[1]}" >> $GITHUB_ENV
echo "prev_1=${VERSIONS_REL[2]}" >> $GITHUB_ENV
echo "prev_2=${VERSIONS_REL[3]}" >> $GITHUB_ENV
echo "prev_3=${VERSIONS_REL[4]}" >> $GITHUB_ENV
- id: set-env
run: |
content='${{ toJson(env) }}' # convert env vars to json
content="${content//'%'/'%25'}" # escape percent entities
content="${content//$'\n'/''}" # remove lf
content="${content//$'\r'/''}" # remove cr
echo "env=${content}" >> $GITHUB_OUTPUT



# set_env:
# name: "Set matrix env vars"
# runs-on: ubuntu-latest
# env:
# esp32_board_url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json
# esp8266_board_url: https://arduino.esp8266.com/stable/package_esp8266com_index.json
# Seeeduino_board_url: https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json
# rp2040_board_url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
# rp2040_cli_args: "--build-property compiler.cpp.extra_flags=-DSKIP_I2C_TEST"
# d1_mini_fbqn_extra: ":eesz=4M3M,xtal=80"
#
# outputs:
# env: ${{steps.set-env.outputs.env}}
# steps:
# # export at output variables, flatten as JSON
# - id: set-env
# run: |
# content='${{ toJson(env) }}' # convert env vars to json
# content="${content//'%'/'%25'}" # escape percent entities
# content="${content//$'\n'/''}" # remove lf
# content="${content//$'\r'/''}" # remove cr
# echo "env=${content}" >> $GITHUB_OUTPUT


build:
name: ${{ matrix.piocontext }}@${{ matrix.platform-version }}

build:
name: ${{ matrix.piocontext }}@${{ matrix.versioncontext }}
needs: plan_version
env: ${{fromJSON(needs.plan_version.outputs.env)}}
runs-on: ubuntu-latest

strategy:
Expand All @@ -39,18 +90,30 @@ jobs:
- m5stack-cores3
- sdfat-test

platform-version:
#- 1.0.6
#- 2.0.0
#- 2.0.1
#- 2.0.2 # has broken SD Support
#- 2.0.3
#- 2.0.4
#- 2.0.5
#- 2.0.6
- 2.0.7
- 2.0.8
- 2.0.9
versioncontext:
- latest
- prev_0
- prev_1
- prev_2
- prev_3


# platform-version:
# #- 1.0.6
# #- 2.0.0
# #- 2.0.1
# #- 2.0.2 # has broken SD Support
# #- 2.0.3
# #- 2.0.4
# #- 2.0.5
# #- 2.0.6
# #- 2.0.7
# #- 2.0.8
# #- 2.0.9
# #- 2.0.11
# - 2.0.12
# - 2.0.13
# - 2.0.14

#exclude:
#- { piocontext: s3box, platform-version: 1.0.6 }
Expand Down Expand Up @@ -104,7 +167,8 @@ jobs:
- name: Run PlatformIO
run: |
cd ${{ env.PROJECT_DIR }}
export pio_ver=${{ matrix.platform-version }}
export pio_ver=${${{ matrix.versioncontext }}}
# export pio_ver=${{ matrix.platform-version }}
export pio_env="${pio_ver//./_}"
[[ "${{ env.BRANCH_NAME }}" == "master" ]] && rm dev_lib_deps.ini || echo "Develop!" && pio system prune -f
pio pkg install -e ${{ matrix.piocontext }}-$pio_env --no-save --library file://$(realpath ../../../)
Expand Down
100 changes: 0 additions & 100 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,106 +1,6 @@
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Stack_CrackScreen"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Stack_CrackScreen
url = https://github.com/nomolk/M5Stack_CrackScreen
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Stack_FlappyBird_game"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Stack_FlappyBird_game
url = https://github.com/pcelli85/M5Stack_FlappyBird_game
[submodule "examples/M5Stack-SD-Menu/SD-Apps/Pixel-Fun-M5Stack"]
path = examples/M5Stack-SD-Menu/SD-Apps/Pixel-Fun-M5Stack
url = https://github.com/neoxharsh/Pixel-Fun-M5Stack
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Stack-Pacman-JoyPSP"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Stack-Pacman-JoyPSP
url = https://github.com/tobozo/M5Stack-Pacman-JoyPSP
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Stack-Rickroll"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Stack-Rickroll
url = https://github.com/tobozo/M5Stack-Rickroll
[submodule "examples/M5Stack-SD-Menu/SD-Apps/SpaceDefense-m5stack"]
path = examples/M5Stack-SD-Menu/SD-Apps/SpaceDefense-m5stack
url = https://github.com/dsiberia9s/SpaceDefense-m5stack
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Stack-SpaceShooter"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Stack-SpaceShooter
url = https://github.com/PartsandCircuits/M5Stack-SpaceShooter
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Stack_Sokoban"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Stack_Sokoban
url = https://github.com/robo8080/M5Stack_Sokoban
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Stack-NyanCat"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Stack-NyanCat
url = https://github.com/tobozo/M5Stack-NyanCat
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Stack-ESP32-Oscilloscope"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Stack-ESP32-Oscilloscope
url = https://github.com/botofancalin/M5Stack-ESP32-Oscilloscope
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Stack-PacketMonitor"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Stack-PacketMonitor
url = https://github.com/tobozo/M5Stack-PacketMonitor
[submodule "examples/M5Stack-SD-Menu/SD-Apps/mp3-player-m5stack"]
path = examples/M5Stack-SD-Menu/SD-Apps/mp3-player-m5stack
url = https://github.com/dsiberia9s/mp3-player-m5stack
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Stack-Tetris"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Stack-Tetris
url = https://github.com/PartsandCircuits/M5Stack-Tetris
ignore = dirty
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Stack-DrawNumber"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Stack-DrawNumber
url = https://gist.github.com/ksasao/c67d6fff5641e6fd40c7705352f6759e
[submodule "examples/M5Stack-SD-Menu/SD-Apps/d_invader"]
path = examples/M5Stack-SD-Menu/SD-Apps/d_invader
url = https://github.com/NibblesLab/d_invader
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Stack_lifegame"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Stack_lifegame
url = https://gist.github.com/shioken/fa2c3f5923170d86dd358b313d6ab244
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5_reversi"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5_reversi
url = https://gist.github.com/shioken/e90b9fa3b43d8b067adde77a75768efd
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Stack_NyanCat_Ext"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Stack_NyanCat_Ext
url = https://github.com/xisai/M5Stack_NyanCat
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Stack-Thermal-Camera"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Stack-Thermal-Camera
url = https://github.com/hkoffer/M5Stack-Thermal-Camera-
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Tube"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Tube
url = https://github.com/tobozo/M5Tube
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Stack-MegaChess"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Stack-MegaChess
url = https://github.com/m4k3r-net/M5Stack-MegaChess
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Stack-Raytracer"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Stack-Raytracer
url = https://github.com/tobozo/M5Stack-Raytracer
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Stack_ESP32_radio"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Stack_ESP32_radio
url = https://github.com/anton-b/M5Stack_ESP32_radio
[submodule "examples/M5Stack-SD-Menu/SD-Apps/nixietubeM5"]
path = examples/M5Stack-SD-Menu/SD-Apps/nixietubeM5
url = https://github.com/drayde/nixietubeM5
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Stack_WebRadio_Avator"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Stack_WebRadio_Avator
url = https://github.com/robo8080/M5Stack_WebRadio_Avator
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Stack-WiFiScanner"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Stack-WiFiScanner
url = https://github.com/PartsandCircuits/M5Stack-WiFiScanner
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5StackMiniOthello"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5StackMiniOthello
url = https://github.com/TTtensan/M5StackMiniOthello
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Stack-CrazyAsteroids"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Stack-CrazyAsteroids
url = https://github.com/RJPlog/M5Stack-CrazyAsteroids
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Stack_DigitalClock_NTP"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Stack_DigitalClock_NTP
url = https://github.com/FromF/M5Stack_DigitalClock_NTP
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Stack_Particle_demo"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Stack_Particle_demo
url = https://github.com/vcraftjp/M5Stack_Particle_demo
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Stack-SetWiFi_Mic"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Stack-SetWiFi_Mic
url = https://github.com/micutil/SetWiFi_Mic
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5StackSandbox"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5StackSandbox
url = https://github.com/kumaashi/M5StackSandbox
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Stack_LovyanToyBox"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Stack_LovyanToyBox
url = https://github.com/lovyan03/M5Stack_LovyanToyBox
[submodule "examples/M5Stack-SD-Menu/SD-Apps/Frogger_M5Stack"]
path = examples/M5Stack-SD-Menu/SD-Apps/Frogger_M5Stack
url = https://github.com/pappani/Frogger_M5Stack
[submodule "examples/M5Stack-SD-Menu/SD-Apps/M5Stack_Test_tools"]
path = examples/M5Stack-SD-Menu/SD-Apps/M5Stack_Test_tools
url = https://github.com/mongonta0716/M5Stack_Test_tools
80 changes: 79 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,85 @@ void setup()
- Serial message `[ERROR] No filesystem selected` or `[ERROR] No valid filesystem selected`: try `SDUCfg.setFS( &SD )` prior to calling the SDUpdater.


<br />
<br /><br />



🏭 Factory Partition
--------------------

Abuse the OTA partition scheme and store up to 5 applications on the flash, plus the firmware loader.

⚠️ This scenario uses a special [firmware loader](https://github.com/tobozo/M5Stack-SD-Updater/tree/1.2.8/examples/M5Stack-FW-Menu) `M5Stack-FW-Menu`, a custom partition scheme, and a different integration of M5Stack-SD-Updater in the loadable applications.

Although it can work without the SD Card, `M5Stack-FW-Menu` can still act as a low profile replacement for the classic SD Card `/menu.bin`, and load binaries from the SD Card or other supported filesystems.


#### Requirements:

- Flash size must be 8MB or 16MB
- custom partitions.csv must have more than 2 OTA partitions followed by one factory partition (see annotated example below)
- loadable applications and firmware loader must share the same custom partitions scheme at compilation
- `SDUCfg.rollBackToFactory = true;` must be set in all loadable applications (see `Detect factory support`)

#### Custom partition scheme annotated example:

```csv
# 6 Apps + Factory
# Name, Type, SubType, Offset, Size
nvs, data, nvs, 0x9000, 0x5000
otadata, data, ota, 0xe000, 0x2000
ota_0, 0, ota_0, 0x10000, 0x200000 ,<< Default partition for flashing (UART, 2MB)
ota_1, 0, ota_1, 0x210000, 0x200000 ,<< Default partition for flashing (OTA, 2MB)
ota_2, 0, ota_2, 0x410000, 0x200000 ,<< Application (2MB)
ota_3, 0, ota_3, 0x610000, 0x200000 ,<< Application (2MB)
ota_4, 0, ota_4, 0x810000, 0x200000 ,<< Application (2MB)
ota_5, 0, ota_5, 0xA10000, 0x200000 ,<< Application (2MB)
firmware, app, factory, 0xC10000, 0x0F0000 ,<< Factory partition holding the firmware menu (960KB)
spiffs, data, spiffs, 0xD00000, 0x2F0000 ,<< SPIFFS (2MB)
coredump, data, coredump, 0xFF0000, 0x10000
```

#### Quick Start:

- Set a custom partition scheme according to the requirements (see annotated example above)
- Compile and flash the [M5Stack-FW-Menu]https://github.com/tobozo/M5Stack-SD-Updater/tree/master/examples/M5Stack-FW-Menu)
- On first run the `M5Stack-FW-Menu` firmware loader will automatically populate the factory partition and restart from there

Then for every other app you want to store on the flash:

- Set the same custom partition scheme as `M5Stack-FW-Menu`
- Add `SDUCfg.rollBackToFactory = true;` and second argument must be empty e.g. `checkSDUpdater( SD, "", 5000, TFCARD_CS_PIN )`
- Compile your app
- Copy the binary to the SD Card (e.g. copy the bin manually or use the `Save SD` option from the app's SD-Updater lobby)
- Use `FW Menu` option from the app's SD-Updater lobby (note: **it should load the firmware loader, not the /menu.bin from the SD Card**)
- Use the firmware loader menu `Manage Partitions/Add Firmware` to copy the recently added app to one of the available slots

Note: the firmware loader can copy applications from any filesystem (SD, SD_MMC, SPIFFS, LittleFS, FFat).


#### Detect factory support

```cpp
#if M5_SD_UPDATER_VERSION_INT >= VERSION_VAL(1, 2, 8)
// New SD Updater support, requires version >=1.2.8 of https://github.com/tobozo/M5Stack-SD-Updater/
if( Flash::hasFactoryApp() ) {
SDUCfg.rollBackToFactory = true;
SDUCfg.setLabelMenu("FW Menu");
SDUCfg.setLabelRollback("Save FW");
checkFWUpdater( 5000 );
} else
#endif
{
checkSDUpdater( SD, MENU_BIN, 5000, TFCARD_CS_PIN );
}
```







🛣 ROADMAP:
----------
Expand Down
Loading