]> hydra-www.ietfng.org Git - acmetensortoys-esp-lua_lamp/commitdiff
Update build scripts and notes
authorNathaniel Wesley Filardo <nwfilardo@gmail.com>
Thu, 26 Dec 2019 00:46:09 +0000 (00:46 +0000)
committerNathaniel Wesley Filardo <nwfilardo@gmail.com>
Thu, 26 Dec 2019 00:46:09 +0000 (00:46 +0000)
README.rst
mklfs.sh
mkspiffs.sh [new file with mode: 0755]

index a16aac3aec8b14a670f463551ce9885125c8073d..52c8c8583f3b14dce4ba063d34519da60a833a21 100644 (file)
@@ -236,3 +236,33 @@ Be sure to build the following modules into the firmware:
 * ``timer`` -- yes
 * ``wifi`` -- yes
 * ``ws2812`` -- the display itself
+
+Rebuilding the Firmware
+=======================
+
+NodeMCU offers many ways to program the firmware, but the simplest way, the
+most "with the grain", if you will, is to generate three files:
+
+* The base NodeMCU firmware, which contains the above modules.
+
+* The LFS image, which will contain most of nwf's "core" Lua modules.  See
+  ``mklfs.sh``
+
+* The SPIFFS image, containing the lamp's lua, drawings, and
+  configuration data.  See ``mkspiffs.sh``
+
+The lamp lua is kept in SPIFFS nominally so that it's easy to tinker without
+requiring a full reprogram.  In practice this only sort of works.
+
+Run the various build scripts and then program the board, for example::
+
+    ./core/firm/tools/toolchains/esptool.py write_flash \
+     --flash_size 4MB --flash_mode dio --verify \
+     0x0      ./core/firm/bin/nodemcu_integer_lamp.bin \
+     0x3fc000 ./core/firm/sdk/esp_iot_sdk_v3.0-e4434aa/bin/esp_init_data_default_v05.bin
+
+    ./core/firm/tools/nodemcu-partition.py \
+     --flash_size 4MB \
+     --lfs_size 131072 --lfs_file _lfs_build/luac.out \
+     --spiffs_file spiffs.img
+
index 40f43f32eda5e530b00f97498bc67d5b7c77cc33..c122c9540d028c0919a658b187e4d68c6f39e9fe 100755 (executable)
--- a/mklfs.sh
+++ b/mklfs.sh
@@ -6,13 +6,21 @@ SOURCES=(
   lamp-lfs-strings.lua
   core/cap1188/cap1188.lua
   core/cap1188/cap1188-init.lua
-  core/fifo/fifo.lua
-  core/net/{fifosock,nwfmqtt,nwfnet*}.lua
+  core/firm/lua_modules/fifo/fifo{,sock}.lua
+  core/net/{nwfmqtt,nwfnet*}.lua
   core/telnetd/telnetd{,-{diag,file}}.lua
   core/tq/tq.lua
   core/util/compileall.lua
   core/util/diag.lua
   core/util/lfs-strings.lua
+
+  init2.lua
+  init-early.lua
+  lamp-remote.lua
+  lamp-touch.lua
+  telnetd-cap.lua
+
+  draw-*.lua
 )
 
 rm -rf _lfs_build
diff --git a/mkspiffs.sh b/mkspiffs.sh
new file mode 100755 (executable)
index 0000000..b4108de
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+set -e -u -x
+
+FWSZ=$(stat --printf="%s" ./core/firm/bin/nodemcu_integer_lamp.bin)
+FWSZ=$((FWSZ + 131072)) # Pad for LFS
+
+(
+       # Init is the only core Lua that does not live in LFS.
+       echo import core/init.lua init.lua
+
+       # Configuration
+       echo import conf/test/nwfnet.conf nwfnet.conf
+       echo import conf/test/nwfmqtt.conf nwfmqtt.conf
+       echo import conf/test/nwfmqtt.subs nwfmqtt.subs
+
+       # And the LFS image with the rest of everything
+       #  We could, and used to, but we now go via the nodemcu partition tool
+       # echo import _lfs_build/luac.out luac.out
+) | ./core/firm/tools/spiffsimg/spiffsimg \
+     -f spiffs.img \
+     -S 4MB -U ${FWSZ} \
+     -r /dev/fd/0
+     
+       # -c 262144 \