From: Nathaniel Wesley Filardo Date: Thu, 26 Dec 2019 00:46:09 +0000 (+0000) Subject: Update build scripts and notes X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=65fc8de392a402d394712d485b19ee6b2f21dfe3;p=acmetensortoys-esp-lua_lamp Update build scripts and notes --- diff --git a/README.rst b/README.rst index a16aac3..52c8c85 100644 --- a/README.rst +++ b/README.rst @@ -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 + diff --git a/mklfs.sh b/mklfs.sh index 40f43f3..c122c95 100755 --- 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 index 0000000..b4108de --- /dev/null +++ b/mkspiffs.sh @@ -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 \