Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
cb4af94
Moddable上のm5stack_cores3のSPIRAMを無効化するスクリプトを追加
KuraZuzu Jan 7, 2025
d9a20d9
CIにSPIRAM無効化設定スクリプト呼び出し処理を追加
KuraZuzu Jan 7, 2025
105b3c4
設定スクリプトのxs-dev-export.sh追記処理を追加
KuraZuzu Jan 7, 2025
d702f24
日本語のmac/linux向け環境構築を修正
KuraZuzu Jan 7, 2025
e7733f5
mac/linux向けの書き込みドキュメント修正
KuraZuzu Jan 7, 2025
015d3cc
PSRAM無効化とxs-devの環境設定更新スクリプトを分割
KuraZuzu Jan 7, 2025
ba086da
設定スクリプトをディレクトリにまとめる
KuraZuzu Jan 7, 2025
bc7be21
CIの中で呼び出す設定スクリプトコマンドを修正
KuraZuzu Jan 7, 2025
2876cd8
xs-devを設定するスクリプトの権限を変更
KuraZuzu Jan 8, 2025
4c1206f
分割したスクリプトにしたがってドキュメントを修正
KuraZuzu Jan 8, 2025
1818fcf
PSRAMに関する補足事項を箇条書きに変更
KuraZuzu Jan 8, 2025
4876cbe
ドキュメントにPSRAMの環境設定確認の項目を追加
KuraZuzu Jan 8, 2025
21b0971
getting-startedの英語版を修正
KuraZuzu Jan 8, 2025
d5fe465
日本語のgetting-started._ja.mdの見栄えを修正
KuraZuzu Jan 8, 2025
184a968
getteing-started_ja.mdの箇条書きを修正
KuraZuzu Jan 8, 2025
aebe741
getting-started.mdの文章中に抜けていたハイライトや段落を一部修正
KuraZuzu Jan 8, 2025
9ebea2a
章の階層と章名を変更
KuraZuzu Jan 8, 2025
ff1401d
章階層の変更
KuraZuzu Jan 8, 2025
1558779
PSRAMの注釈内容を変更
KuraZuzu Jan 8, 2025
b6f6fc6
WSL2のドキュメントを修正
KuraZuzu Jan 8, 2025
8d88328
PSRAM無効化のsedコマンドのバリエーションにmac向けの条件を追加
KuraZuzu Jan 8, 2025
45a739e
設定スクリプトのファイル名変更
KuraZuzu Jan 8, 2025
8163417
設定スクリプト名の変更をCIとドキュメントに反映
KuraZuzu Jan 8, 2025
5ee083a
必要なソフトウェアツールにcmakeを追加
KuraZuzu Jan 8, 2025
b188507
Web書き込み機能のリンクと手順をトップREADMEに追記
KuraZuzu Jan 8, 2025
e48edf7
ドキュメント類の表現やコマンドを修正
KuraZuzu Jan 9, 2025
cd894a7
WSL2マニュアルのPSRAM確認コマンド用画像サイズを変更
KuraZuzu Jan 9, 2025
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
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
submodules: recursive
- uses: ./.github/actions/setup
- name: Build
run: source $HOME/.local/share/xs-dev-export.sh && npm run build
run: source $HOME/.local/share/xs-dev-export.sh && sh ./setting_scripts/unset_psram.sh && npm run build
working-directory: ./firmware
- name: Build CoreS3
run: source $HOME/.local/share/xs-dev-export.sh && npm run build --target=esp32/m5stack_cores3
run: source $HOME/.local/share/xs-dev-export.sh && sh ./setting_scripts/unset_psram.sh && npm run build --target=esp32/m5stack_cores3
working-directory: ./firmware
- name: Check Format
run: npm run format
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ This repository includes the following contents.

* For Windows: [(WSL2) Windows 11 Stack-chan Environment Setup Manual (Japanese)](firmware/docs/getting-started-wsl2_ja.md)
* For MacOS/Linux: [Getting Started (MacOS/Linux)](./firmware/docs/getting-started.md)
* For Web: Follow the steps below (Reference: [Tried Flashing a Program to Stack-chan via Web Browser (Japanese)](https://rt-net.jp/humanoid/archives/5907)):
1. Access the web-flash page from your PC.
2. Connect Stack-chan to the PC using a cable.
3. Select `M5Stack CoreS3`.
4. Press the `Flash Stack-chan firmware [・_・]` button.

## Contribution

Expand Down
5 changes: 5 additions & 0 deletions README_ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@

* Windowsの場合:[Windows 11 のスタックチャン環境構築マニュアル(WSL2)](firmware/docs/getting-started-wsl2_ja.md)
* MacOS/Linuxの場合:[環境構築(MacOS/Linux)マニュアル](./firmware/docs/getting-started_ja.md)
* Webの場合:以下の手順を実行(参考:[Webブラウザからスタックチャンにプログラムを書き込んでみた](https://rt-net.jp/humanoid/archives/5907))
1. PCから[web-flahページ](https://rt-net.github.io/stack-chan/web/flash/)にアクセス
2. スタックチャンとPCをケーブルで接続
3. `M5Stack CoreS3`を選択
4. `Flash Stack-chan firmware [・_・]`ボタンを押下

## コントリビューション

Expand Down
4 changes: 3 additions & 1 deletion firmware/docs/flashing-firmware.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ Additionally, you can specify the paths of other manifest files in a list format
## Writing the base program (hosts)

As stated above, Stack-chan's firmware comprises a base program (host) and a user application (MOD).
The handling of PSRAM connected to esp32 has changed from esp-idf version 5.x. The default settings do not work smoothly, so we will change some of them. ~/.local/share/moddable/build/devices/esp32/targets/m5stack_cores3/sdkconifg. CONFIG_SPIRAM=y to CONFIG_SPIRAM_n.

**The handling of PSRAM connected to esp32 has changed from esp-idf version 5.x. The default settings do not work smoothly, so we changed some of them.**
**When [setting the PSRAM environment variables](./getting-started.md#set-up-manual), `CONFIG_SPIRAM=y` in `~/.local/share/moddable/build/devices/esp32/targets/m5stack_cores3/sdkconfig/sdkconfig.defaults` is rewritten to `CONFIG_SPIRAM=n`.**

The following commands are used to build and write a host.

Expand Down
10 changes: 6 additions & 4 deletions firmware/docs/flashing-firmware_ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@

## 基本プログラム(ホスト)の書き込み

前述の通りスタックチャンのファームウェアは基本プログラム(ホスト)とユーザアプリケーション(MOD)から構成されます。
esp-idfのバージョンが5.xからesp32に接続しているPSRAMの扱いが変わっています。デフォルト設定ではスムーズに動かないため一部変更します。
~/.local/share/moddable/build/devices/esp32/targets/m5stack_cores3/sdkconifgのファイルにある
CONFIG_SPIRAM=yをCONFIG_SPIRAM_nに書き換えます。
前述の通りスタックチャンのファームウェアは基本プログラム(ホスト)とユーザアプリケーション(MOD)から構成されます。

**esp-idfのバージョンが`5.x`からesp32に接続しているPSRAMの扱いが変わっています。デフォルト設定ではスムーズに動かないため一部変更しています。**
**[環境構築の設定変更スクリプト実行時](./getting-started_ja.md#設定の変更)に、`~/.local/share/moddable/build/devices/esp32/targets/m5stack_cores3/sdkconfig/sdkconfig.defaults`に記述された`CONFIG_SPIRAM=y`を`CONFIG_SPIRAM=n`に書き換えています。**

<br>

次のコマンドで基本プログラム(ホスト)の書き込みを行います。

Expand All @@ -56,6 +57,7 @@ $ npm run deploy --target=esp32/m5stack_cores3
```

Ubuntuの場合、書き込みポートがReadOnlyになっています。sudo chmod 666 /dev/ttyACM0でモードを書き換えるが、永続的にUSBポートの使用権限を変更する場合は、次のコマンドを実行してPCを再起動します。

```console
$sudo usermod -aG dialout $USER
```
Expand Down
36 changes: 32 additions & 4 deletions firmware/docs/getting-started-wsl2_ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,17 +227,31 @@ $ npm run setup -- --device=esp32

<img src="images/getting-started-wsl2_ja/npm_run_setup_esp32.jpg" width="100%">

### PSRAMと環境変数のセットアップ

最後にmoddableの環境設定スクリプト xs-dev-export.sh がターミナル起動時に自動で読み込まれません。~/.bashrcに
source ~/.local/share/xs-dev-export.sh
を追加してください。
次のコマンドを実行して、PSRAM無効化の設定をします。

```sh
$ ./setting_scripts/unset_psram.sh
```

<img src="images/getting-started-wsl2_ja/unset_psram.jpg" width="100%">


次のコマンドを実行し、Shellの設定ファイルに`source ~/.local/share/xs-dev-export.sh`を追加します。これにより、Shellの起動時に自動で環境変数が設定されるようになります。

```sh
$ ./setting_scripts/set_xs-dev_env.sh
```

<img src="images/getting-started-wsl2_ja/set_xs-dev_env.jpg" width="100%">


### 構築した環境の確認

以下のコマンドで環境のテストをします。
#### Moddableの環境確認

以下のコマンドでModdableの環境のテストをします。

```bash
$ npm run doctor
Expand All @@ -247,6 +261,20 @@ $ npm run doctor

`Moddable`のバージョンが`v4.9.5`で、`ESP32 IDF Directory`のパスが正しく表示されており、`Supported target devices`が`lin, esp32`となっていれば成功です。

#### PSRAMの環境確認

以下のコマンドでM5Stack CoreS3のPARAMの設定を確認します。

```bash
$ grep CONFIG_SPIRAM= $MODDABLE/build/devices/esp32/targets/m5stack_cores3/sdkconfig/sdkconfig.defaults
```

<img src="images/getting-started-wsl2_ja/grep_config_spiram.jpg" width="100%">


`CONFIG_SPIRAM=n`と表示されれば成功です。


ここまで完了次第、Ubuntuのウインドウを閉じてください。


Expand Down
50 changes: 41 additions & 9 deletions firmware/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ Stack-chan can be developed on Windows 11, MacOS, and Linux. For Windows 11, ple
* Tested on MaxOS (Sonoma 14 Apple silicon)
* [Stack-chan RT ver.](https://rt-net.jp/products/rt-stackchan/) or its compatible product
* USB type-C cable
* [git](https://git-scm.com/)
* [Node.js](https://nodejs.org/en/)
* As for the mod for cherrup_ble_lite, you need to use V18.x.x as it does not support the new Node.js.
* I've confirmed that other mods work with v22.8.x.
* The operation has been confirmed with Python 3.12. (Please download and install macOS from https://www.python.org instead of installing it with brew.))
* xcode-select (macOS only)
* Tools
* [cmake](https://cmake.org/)
* [git](https://git-scm.com/)
* [Node.js](https://nodejs.org/en/)
* As for the mod for cherrup_ble_lite, you need to use V18.x.x as it does not support the new Node.js.
* I've confirmed that other mods work with v22.8.x.
* The operation has been confirmed with Python 3.12. (Please download and install macOS from https://www.python.org instead of installing it with brew.))
* xcode-select (macOS only)

## Clone the Stack-chan repository and install the module on node

Expand All @@ -38,9 +40,13 @@ There are two ways to do this.
- Set up manually

### Using xs-dev(CLI) (recommended)
Stack-chan has npm scripted setup instructions. In the stack-chan/firmware directory, run the following command:
Stack-chan has npm scripted setup instructions.

In the `stack-chan/firmware` directory, run the following command:

Immediately after executing the first command shown below, you will be asked to enter the password set in Ubuntu.
After entering the password, the password will not be requested even if the same command is executed for a certain period of time.

For the second command, run it before you are prompted for a password again. If, for some reason, it takes a long time to execute the first command, please start over from the execution of the first command.

```console
Expand All @@ -58,12 +64,29 @@ Add source ~/.local/share/xs-dev-export.sh to ~/.bashrc or ~/.zshrc.

The script internally uses [`xs-dev`](https://github.com/HipsterBrown/xs-dev) to automate the setup of ModdableSDK and ESP-IDF.

### Set up Manual
## Set up Manual

Follow the instructions on the [official website (English)](https://github.com/Moddable-OpenSource/moddable/blob/public/documentation/Moddable%20SDK%20-%20Getting%20Started.md) to install ModdableSDK and ESP-IDF.
If you cannot setup xs-dev(CLI) properly, please do this.

**Stack-chan RT version assumes that Moddable SDK 4.9.5 and ESP-IDF 5.3.0 will work. I have confirmed that intel mac works with Moddable SDK 4.7.0 + ESP-IDF 5.1.0 python 3.9.0. To use it on Intel Macs, you can install it by changing "setup": "xs-dev setup --target-branch 4.9.5" to "setup": "xs-dev setup --target-branch 4.7.0" in firmware/package.json, but it is not supported.**
- **Stack-chan RT version assumes that Moddable SDK 4.9.5 and ESP-IDF 5.3.0 will work.**
- **We have confirmed that intel mac works with Moddable SDK 4.7.0 + ESP-IDF 5.1.0 python 3.9.0. To use it on Intel Macs, you can install it by changing "setup": "xs-dev setup --target-branch 4.9.5" to "setup": "xs-dev setup --target-branch 4.7.0" in firmware/package.json, but it is not supported.**

## Set up PSRAM and Environment Variable

To configure the PSRAM settings, execute the following command.

```console
$ ./setting_scripts/unset_psram.sh
```

Next, run the following command to automatically add source `~/.local/share/xs-dev-export.sh` to your shell's configuration file. This ensures that the necessary environment variables are set each time the shell is started.

```console
$ ./setting_scripts/set_xs-dev_env.sh
```

By completing these steps, your shell environment will be configured correctly for the Moddable SDK and ESP-IDF.

## Test the environment

Expand Down Expand Up @@ -91,6 +114,15 @@ xs-dev environment info:
ESP32 IDF Directory /home/ubuntu/.local/share/esp32/esp-idf
```


You can check the PARAM settings for the M5Stack CoreS3 with the `grep CONFIG_SPIRAM= $MODDABLE/build/devices/esp32/targets/m5stack_cores3/sdkconfig/sdkconfig.defaults` command.
If the setting are correctly, `CONFIG_SPIRAM=n` will be displayed

```console
$ grep CONFIG_SPIRAM= $MODDABLE/build/devices/esp32/targets/m5stack_cores3/sdkconfig/sdkconfig.defaults
CONFIG_SPIRAM=n
```

## Next step

- [Build and Flash firmware](./flashing-firmware.md)
37 changes: 30 additions & 7 deletions firmware/docs/getting-started_ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* [スタックチャン アールティver.](https://rt-net.jp/products/rt-stackchan/) または その互換品
* USB type-Cケーブル
* 事前にインストールしておくアプリ
* [cmake](https://cmake.org/)
* [git](https://git-scm.com/)
* [Node.js](https://nodejs.org/en/)
* cherrup_ble_liteのmodに関しては、新しいNode.jsに対応していないためV18.x.xを使用する必要があります。
Expand Down Expand Up @@ -42,29 +43,43 @@ $ npm install

スタックチャンはセットアップ手順をnpmスクリプト化しています。
`stack-chan/firmware`ディレクトリで次のコマンドを実行します。
以下に示す1つ目のコマンドの実行直後、Ubuntuに設定したパスワードの入力が要求されますので入力してください。 パスワード入力後、一定時間は同様のコマンドを実行してもパスワードは要求されません。 2つ目のコマンドでは、再度パスワードが要求されない内に実行してください。 もし、何らかの理由で1つめのコマンド実行から時間がかかってしまった場合は1つ目のコマンドの実行からやり直してください。

以下に示す1つ目のコマンドの実行直後、Ubuntuに設定したパスワードの入力が要求されますので入力してください。 パスワード入力後、一定時間は同様のコマンドを実行してもパスワードは要求されません。

2つ目のコマンドでは、再度パスワードが要求されない内に実行してください。 もし、何らかの理由で1つめのコマンド実行から時間がかかってしまった場合は1つ目のコマンドの実行からやり直してください。

```console
$ sudo echo "emporary SuperUser Grant"
$ npm run setup
$ npm run setup -- --device=esp32
```
macOSの場合は、npm run setup -- --device=esp32のインストールの時、xcode-selectのバージョンが古いと"Error: Command failed with exit code 1: python3 -m pip install pyserial"で止まることがあります。その場合は、xcode-selectを手動で削除してから再度xcode-select(xcord-select –install)をインストールしてください。

macOSの場合は、npm run setup -- --device=esp32のインストールの時、xcode-selectのバージョンが古いと"Error: Command failed with exit code 1: python3 -m pip install pyserial"で止まることがあります。その場合は、xcode-selectを手動で削除してから再度xcode-select(xcord-select –install)をインストールしてください。
xcode-selectの削除は"sudo rm -rf /Library/Developer/CommandLineTools"でできます。
内部で[`xs-dev`](https://github.com/HipsterBrown/xs-dev)を使ってModdableSDKやESP-IDFのセットアップを自動化しています。

moddableの環境設定スクリプト xs-dev-export.sh がターミナル起動時に自動で読み込まれません。~/.bashrcや ~/.zshrcに
source ~/.local/share/xs-dev-export.sh
を追加してください。

### 手動でセットアップする

[公式サイトの手順(英語)](https://github.com/Moddable-OpenSource/moddable/blob/public/documentation/Moddable%20SDK%20-%20Getting%20Started.md)に従ってModdableSDKとESP-IDFをインストールします。
xs-dev(CLI)でうまくセットアップできない場合はこちらを行ってください。

**スタックチャン アールティver.では、Moddable SDK 4.9.5、ESP-IDF 5.3.0 での動作を想定しています。**
**intel macはModdable SDK 4.7.0 + ESP-IDF 5.1.0 python3.9.0で動作することは確認しています。intel macで使用するにはfirmware/package.jsonの"setup": "xs-dev setup --target-branch 4.9.5"を"setup": "xs-dev setup --target-branch 4.7.0"にすることでインストールできますがサポート対象外になります。**
- **スタックチャン アールティver.では、Moddable SDK 4.9.5、ESP-IDF 5.3.0 での動作を想定しています。**
- **intel macはModdable SDK 4.7.0 + ESP-IDF 5.1.0 python3.9.0で動作することは確認しています。intel macで使用するには`firmware/package.json`の`"setup": "xs-dev setup --target-branch 4.9.5"`を`"setup": "xs-dev setup --target-branch 4.7.0"`にすることでインストールできますがサポート対象外になります。**

### PSRAMと環境変数のセットアップ

次のコマンドを実行して、PSRAMの設定をします。

```console
$ ./setting_scripts/unset_psram.sh
```

次のコマンドを実行し、Shellの設定ファイルに`source ~/.local/share/xs-dev-export.sh`を追加します。これにより、Shellの起動時に環境変数を設定されます。

```console
$ ./setting_scripts/set_xs-dev_env.sh
```

## 環境のテスト

Expand Down Expand Up @@ -92,6 +107,14 @@ xs-dev environment info:
ESP32 IDF Directory /home/ubuntu/.local/share/esp32/esp-idf
```

`grep CONFIG_SPIRAM= $MODDABLE/build/devices/esp32/targets/m5stack_cores3/sdkconfig/sdkconfig.defaults`コマンドでM5Stack CoreS3のPARAMの設定を確認できます。
設定が完了していれば、`CONFIG_SPIRAM=n`と出力されます。

```console
$ grep CONFIG_SPIRAM= $MODDABLE/build/devices/esp32/targets/m5stack_cores3/sdkconfig/sdkconfig.defaults
CONFIG_SPIRAM=n
```

## 次のステップ

- [プログラムのビルドと書き込み](./flashing-firmware_ja.md)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions firmware/setting_scripts/set_xs-dev_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh

# 追記するコマンドを設定
XS_DEV_SH="source ~/.local/share/xs-dev-export.sh"

# 現在のシェルを取得
CURRENT_SHELL=$(basename "$SHELL")

# 設定ファイルを決定
if [ "$CURRENT_SHELL" = "bash" ]; then
CONFIG_FILE="$HOME/.bashrc"
elif [ "$CURRENT_SHELL" = "zsh" ]; then
CONFIG_FILE="$HOME/.zshrc"
else
echo "Unsupported shell: $CURRENT_SHELL"
exit 1
fi

# 設定ファイルが存在しない場合は作成
if [ ! -f "$CONFIG_FILE" ]; then
touch "$CONFIG_FILE"
echo "# Created $CONFIG_FILE for $CURRENT_SHELL settings" >> "$CONFIG_FILE"
echo "$CONFIG_FILE was created."
fi

# ファイルに追記
if grep -Fxq "$XS_DEV_SH" "$CONFIG_FILE"; then
echo "The string '$XS_DEV_SH' already exists in $CONFIG_FILE. No changes made."
else
echo "$XS_DEV_SH" >> "$CONFIG_FILE"
echo "The string '$XS_DEV_SH' has been added to $CONFIG_FILE."
fi
16 changes: 16 additions & 0 deletions firmware/setting_scripts/unset_psram.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

# 設定ファイルパスを取得
SDKCONFIG="$HOME/.local/share/moddable/build/devices/esp32/targets/m5stack_cores3/sdkconfig/sdkconfig.defaults"

# macOS と Linux の sed コマンドの互換性を考慮
if [ "$(uname)" = "Darwin" ]; then
# macOS 用
sed -i '' 's/CONFIG_SPIRAM=y/CONFIG_SPIRAM=n/' "$SDKCONFIG"
else
# Linux 用
sed -i 's/CONFIG_SPIRAM=y/CONFIG_SPIRAM=n/' "$SDKCONFIG"
fi

# 結果を表示
cat "$SDKCONFIG"
Loading