├── .github └── workflows │ └── build.yml ├── .gitignore ├── ESP32 ├── before-script.sh ├── install.sh └── script.sh ├── ESP8266 ├── before-script.sh ├── install.sh ├── script.sh ├── set-config.sh ├── set-displays.sh ├── set-fonts.sh ├── set-modules.sh └── set-version.sh ├── LICENSE ├── README.md ├── build.config └── export-env-vars.sh /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: NodeMCU Custom Build 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | - builds 8 | pull_request: 9 | branches: 10 | - master 11 | - builds 12 | 13 | defaults: 14 | run: 15 | shell: bash 16 | 17 | jobs: 18 | build: 19 | runs-on: ubuntu-22.04 20 | steps: 21 | - name: Checkout 22 | uses: actions/checkout@v4 23 | - name: Log the build config 24 | run: cat build.config 25 | # When you run a script it gets its own shell and its own environment, which disappear again as soon as the 26 | # script is finished. Besides, each step uses its own environment with no shared global space for dynamic env 27 | # variables. Work-around: write "export FOO=bar" entries to a file and source it in every step that needs those. 28 | # Idea: https://github.com/actions/starter-workflows/issues/68#issuecomment-642514933 29 | - name: Prepare environment variables 30 | run: ./export-env-vars.sh 31 | - name: Upload artifact '.env-vars' 32 | uses: actions/upload-artifact@v4 33 | with: 34 | name: env-vars 35 | path: ./.env-vars 36 | retention-days: 5 37 | include-hidden-files: true 38 | - name: Trigger sending the start-build email 39 | run: | 40 | source ./.env-vars 41 | wget -d -v -O/dev/null --tries=10 --timeout=15 --waitretry=30 --read-timeout=20 --retry-connrefused 'https://nodemcu-build.com/hook.php?event=start&recipient='${X_EMAIL//+/%2B} 42 | - name: Determine Python version 43 | run: | 44 | source ./.env-vars 45 | echo "python_version=3.8" >> $GITHUB_ENV 46 | if [ "$X_BRANCH" = "1.5.4.1-final" ]; then echo "python_version=2.7" >> $GITHUB_ENV; fi 47 | - name: Setup Python 48 | uses: actions/setup-python@v5 49 | with: 50 | python-version: ${{ env.python_version }} 51 | - name: Install Python dependencies 52 | run: python -m pip install --upgrade pip 53 | - name: Install APT dependencies 54 | run: sudo apt install python3-serial srecord gperf 55 | - name: Clone NodeMCU repo 56 | run: | 57 | source ./.env-vars 58 | git clone --depth=1 --branch=$X_BRANCH --recursive https://github.com/nodemcu/nodemcu-firmware nodemcu-firmware 59 | ls -alrt 60 | cd nodemcu-firmware 61 | ls -altr 62 | - name: Cache the 'cache' dir 63 | uses: actions/cache@v4 64 | env: 65 | cache-name: cache-artifacts 66 | with: 67 | path: ./nodemcu-firmware/cache 68 | key: ${{ runner.os }} 69 | - name: Run install.sh 70 | run: | 71 | source ./.env-vars 72 | cd nodemcu-firmware 73 | if [ "$X_BRANCH" = "dev-esp32-idf3-final" ]; then bash "$GITHUB_WORKSPACE"/ESP32/install.sh; else bash "$GITHUB_WORKSPACE"/ESP8266/install.sh; fi 74 | - name: Run before-script.sh 75 | run: | 76 | source ./.env-vars 77 | cd nodemcu-firmware 78 | if [ "$X_BRANCH" = "dev-esp32-idf3-final" ]; then bash "$GITHUB_WORKSPACE"/ESP32/before-script.sh; else bash "$GITHUB_WORKSPACE"/ESP8266/before-script.sh; fi 79 | - name: Run script.sh 80 | run: | 81 | source ./.env-vars 82 | cd nodemcu-firmware 83 | if [ "$X_BRANCH" = "dev-esp32-idf3-final" ]; then bash "$GITHUB_WORKSPACE"/ESP32/script.sh; else bash "$GITHUB_WORKSPACE"/ESP8266/script.sh; fi 84 | - name: Upload artifacts in 'nodemcu-firmware/bin' 85 | uses: actions/upload-artifact@v4 86 | with: 87 | name: bin-folder 88 | path: nodemcu-firmware/bin 89 | retention-days: 5 90 | 91 | upload: 92 | needs: build 93 | runs-on: ubuntu-22.04 94 | steps: 95 | - name: Download artifacts 'nodemcu-firmware/bin' from build job 96 | uses: actions/download-artifact@v4 97 | with: 98 | name: bin-folder 99 | - name: Download artifact '.env-vars' from build job 100 | uses: actions/download-artifact@v4 101 | with: 102 | name: env-vars 103 | - name: Archive binaries on nodemcu-build.com 104 | env: 105 | TOKEN: ${{ secrets.ARCHIVER_TOKEN }} 106 | run: | 107 | ls -alrt 108 | file_name_float=$(find . -name "nodemcu-*float*.bin" -type f -exec basename {} \;) 109 | file_name_integer=$(find . -name "nodemcu-*integer*.bin" -type f -exec basename {} \;) 110 | echo "export file_name_float=""$file_name_float""" >> ./.env-vars 111 | echo "export file_name_integer=""$file_name_integer""" >> ./.env-vars 112 | curl --connect-timeout 10 --max-time 120 --retry 5 --retry-delay 10 -F token=$TOKEN -F file=@$file_name_float https://nodemcu-build.com/archiver.php 113 | curl --connect-timeout 10 --max-time 120 --retry 5 --retry-delay 10 -F token=$TOKEN -F file=@$file_name_integer https://nodemcu-build.com/archiver.php 114 | - name: Upload artifact '.env-vars' 115 | uses: actions/upload-artifact@v4 116 | with: 117 | name: env-vars 118 | path: ./.env-vars 119 | retention-days: 5 120 | overwrite: true 121 | include-hidden-files: true 122 | 123 | notify: 124 | needs: upload 125 | runs-on: ubuntu-22.04 126 | if: always() 127 | steps: 128 | # You can get conclusion via ${{ env.WORKFLOW_CONCLUSION }} # neutral, success, skipped, cancelled, timed_out, action_required, failure 129 | - uses: technote-space/workflow-conclusion-action@v2 130 | - name: Download artifact '.env-vars' from build and upload jobs 131 | uses: actions/download-artifact@v4 132 | with: 133 | name: env-vars 134 | - name: Trigger sending success email to author 135 | if: env.WORKFLOW_CONCLUSION == 'success' 136 | run: | 137 | source ./.env-vars 138 | wget -d -v -O/dev/null --tries=10 --timeout=15 --waitretry=30 --read-timeout=20 --retry-connrefused 'https://nodemcu-build.com/hook.php?event=success&recipient='${X_EMAIL//+/%2B}'&branch='$X_BRANCH'&modules='$X_MODULES'&artifacts='${file_name_float},${file_name_integer} 139 | - name: Trigger sending failure email to author 140 | if: env.WORKFLOW_CONCLUSION == 'failure' 141 | run: | 142 | source ./.env-vars 143 | wget -d -v -O/dev/null --tries=10 --timeout=15 --waitretry=30 --read-timeout=20 --retry-connrefused 'https://nodemcu-build.com/hook.php?event=failure&recipient='${X_EMAIL//+/%2B} 144 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # IDEA files 2 | .idea/** 3 | *.iml 4 | 5 | # Object files 6 | *.o 7 | *.ko 8 | *.obj 9 | *.elf 10 | 11 | # Precompiled Headers 12 | *.gch 13 | *.pch 14 | 15 | # Libraries 16 | *.lib 17 | *.a 18 | *.la 19 | *.lo 20 | 21 | # Shared objects (inc. Windows DLLs) 22 | *.dll 23 | *.so 24 | *.so.* 25 | *.dylib 26 | 27 | # Executables 28 | *.exe 29 | *.out 30 | *.app 31 | *.i*86 32 | *.x86_64 33 | *.hex 34 | 35 | # Debug files 36 | *.dSYM/ 37 | -------------------------------------------------------------------------------- /ESP32/before-script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/env bash 2 | 3 | set -e 4 | 5 | echo "Running 'before_script' for ESP32" 6 | ( 7 | make defconfig # -> will also download and uncompress the toolchain 8 | 9 | # --------------------------------------------------------------------------- 10 | # select modules 11 | # --------------------------------------------------------------------------- 12 | # disable all modules 13 | sed -ri 's/(CONFIG_NODEMCU_CMODULE_.*=).{0,1}/\1/' sdkconfig 14 | # enable the selected ones 15 | echo "Enabling modules $X_MODULES" 16 | mapfile -t modules < <(echo "$X_MODULES" | tr , '\n' | tr '[:lower:]' '[:upper:]') 17 | for m in "${modules[@]}"; do 18 | sed -ri "s/(CONFIG_NODEMCU_CMODULE_$m=)/\1y/" sdkconfig 19 | done 20 | 21 | # --------------------------------------------------------------------------- 22 | # set SSL/TLS 23 | # --------------------------------------------------------------------------- 24 | if [ "${X_SSL_ENABLED}" == "true" ]; then 25 | echo "Enabling SSL/TLS for mbed TLS and MQTT" 26 | sed -ri 's/(CONFIG_MBEDTLS_TLS_ENABLED=).{0,1}/\1y/' sdkconfig 27 | sed -ri 's/(CONFIG_MQTT_TRANSPORT_SSL=).{0,1}/\1y/' sdkconfig 28 | else 29 | echo "Disabling SSL/TLS for mbed TLS and MQTT" 30 | sed -ri 's/(CONFIG_MBEDTLS_TLS_ENABLED=).{0,1}/\1/' sdkconfig 31 | sed -ri 's/(CONFIG_MQTT_TRANSPORT_SSL=).{0,1}/\1/' sdkconfig 32 | fi 33 | 34 | # --------------------------------------------------------------------------- 35 | # set FatFS and also enable the SDMMC module in case the user forgot 36 | # --------------------------------------------------------------------------- 37 | if [ "${X_FATFS_ENABLED}" == "true" ]; then 38 | echo "Enabling FatFS/SDMMC" 39 | sed -ri "s/(CONFIG_BUILD_FATFS=).{0,1}/\1y/" sdkconfig 40 | sed -ri "s/(CONFIG_NODEMCU_CMODULE_SDMMC=).{0,1}/\1y/" sdkconfig 41 | fi 42 | 43 | # --------------------------------------------------------------------------- 44 | # set debug mode/level 45 | # --------------------------------------------------------------------------- 46 | if [ "${X_DEBUG_ENABLED}" == "true" ]; then 47 | echo "Enabling debug mode" 48 | sed -ri "s/(CONFIG_LOG_DEFAULT_LEVEL_INFO=).{0,1}/\1/" sdkconfig 49 | sed -ri "s/(CONFIG_LOG_DEFAULT_LEVEL_DEBUG=).{0,1}/\1y/" sdkconfig 50 | sed -ri "s/(CONFIG_LOG_DEFAULT_LEVEL=).{0,1}/\14/" sdkconfig 51 | fi 52 | 53 | cat sdkconfig 54 | 55 | # below inspired by https://github.com/marcelstoer/docker-nodemcu-build/blob/master/build-esp32 56 | 57 | # --------------------------------------------------------------------------- 58 | # set version(s) 59 | # --------------------------------------------------------------------------- 60 | version_file=components/platform/include/user_version.h 61 | lua_header_file=components/lua/lua.h 62 | 63 | export BUILD_DATE COMMIT_ID BRANCH SSL MODULES SDK_VERSION 64 | BUILD_DATE="$(date "+%Y-%m-%d %H:%M")" 65 | COMMIT_ID="$(git rev-parse HEAD)" 66 | BRANCH="$(git rev-parse --abbrev-ref HEAD | sed -r 's/[\/\\]+/_/g')" 67 | # 'git submodule status' -> 7313e39fde0eb0a47a60f31adccd602c82a8d5ad sdk/esp32-esp-idf (v3.2-dev-1239-g7313e39) 68 | # -> get text between () 69 | SDK_VERSION="$(git submodule status|grep esp32|sed -r 's/.*\((.+)\)/\1/')" 70 | # If the submodule isn't linked to a released/tagged version the above commands would set SDK_VERSION to 71 | # "7313e39fde0eb0a47a60f31adccd602c82a8d5ad sdk/esp32-esp-idf" (w/o the quotes). 72 | # -> check and get the short Git revion hash instead 73 | if [ ${#SDK_VERSION} -ge 40 ]; then SDK_VERSION=${SDK_VERSION:0:7}; fi 74 | # If it's still empty then set it to a dummy to ensure further operations don't fail. 75 | if [ -z "$SDK_VERSION" ]; then SDK_VERSION="n/a"; fi 76 | 77 | sed -i '/#define NODE_VERSION[[:space:]]/ s/$/ " '"$USER_PROLOG"'\\n\\tbranch: '"$BRANCH"'\\n\\tcommit: '"$COMMIT_ID"'\\n\\tSSL: '"$X_SSL_ENABLED"'\\n\\tmodules: '"$X_MODULES"'\\n"/g' "$version_file" 78 | sed -i 's/"unspecified"/"created on '"$BUILD_DATE"'\\n"/g' "$version_file" 79 | sed -i '/#define LUA_RELEASE[[:space:]]/ s/$/ " on ESP-IDF '"$SDK_VERSION"'"/g' "$lua_header_file" 80 | 81 | cat "$version_file" 82 | grep LUA_RELEASE "$lua_header_file" 83 | ) 84 | -------------------------------------------------------------------------------- /ESP32/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/env bash 2 | 3 | set -e 4 | 5 | echo "Running 'install' for ESP32" 6 | ( 7 | python -m pip install setuptools 8 | python -m pip install --user -r "$PWD"/sdk/esp32-esp-idf/requirements.txt 9 | ) 10 | -------------------------------------------------------------------------------- /ESP32/script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/env bash 2 | 3 | set -e 4 | 5 | echo "Running 'script' for ESP32" 6 | ( 7 | timestamp=$(date "+%Y-%m-%d-%H-%M-%S") 8 | image_name="$X_BRANCH-$X_NUMBER_OF_MODULES-modules-$timestamp" 9 | 10 | mkdir bin 11 | 12 | # --------------------------------------------------------------------------- 13 | # run float build in ./build/float 14 | # --------------------------------------------------------------------------- 15 | make MORE_CFLAGS="-DBUILD_DATE='\"'$timestamp'\"'" all 16 | # package the 3 binaries into a single .bin for 0x0000 17 | # 0x1000 bootloader.bin 18 | # 0x8000 partitions.bin 19 | # 0x10000 NodeMCU.bin 20 | # current command is a simplification of the one proposed at https://github.com/marcelstoer/docker-nodemcu-build/issues/55#issuecomment-440830227 21 | srec_cat -output bin/nodemcu-"${image_name}"-float.bin -binary build/bootloader/bootloader.bin -binary -offset 0x1000 -fill 0xff 0x0000 0x8000 build/partitions.bin -binary -offset 0x8000 -fill 0xff 0x8000 0x10000 build/NodeMCU.bin -binary -offset 0x10000 22 | 23 | make clean 24 | 25 | # --------------------------------------------------------------------------- 26 | # run integer build in ./build/integer 27 | # --------------------------------------------------------------------------- 28 | make MORE_CFLAGS="-DLUA_NUMBER_INTEGRAL -DBUILD_DATE='\"'$timestamp'\"'" all 29 | srec_cat -output bin/nodemcu-"${image_name}"-integer.bin -binary build/bootloader/bootloader.bin -binary -offset 0x1000 -fill 0xff 0x0000 0x8000 build/partitions.bin -binary -offset 0x8000 -fill 0xff 0x8000 0x10000 build/NodeMCU.bin -binary -offset 0x10000 30 | 31 | ls -al bin 32 | ) 33 | -------------------------------------------------------------------------------- /ESP8266/before-script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/env bash 2 | 3 | set -e 4 | 5 | echo "Running 'before_script' for ESP8266" 6 | ( 7 | SCRIPT_DIR=$GITHUB_WORKSPACE/ESP8266 8 | 9 | # dig in and modify those config files 10 | cd app/include || exit 11 | 12 | # replace modules in user_modules.h by the selected ones 13 | "$SCRIPT_DIR"/set-modules.sh 14 | # set defines in user_config.h according to X_* variables 15 | "$SCRIPT_DIR"/set-config.sh 16 | # replace fonts in u8g_config.h by the selected ones 17 | "$SCRIPT_DIR"/set-fonts.sh 18 | # set I2C/SPI displays in u8g_config.h and ucg_config.h 19 | "$SCRIPT_DIR"/set-displays.sh 20 | # replace version strings in user_version.h 21 | "$SCRIPT_DIR"/set-version.sh 22 | 23 | cat user_modules.h 24 | cat user_config.h 25 | cat u8g*.h 26 | cat ucg_config.h 27 | cat user_version.h 28 | 29 | # back to where we came from 30 | cd "$GITHUB_WORKSPACE" || exit 31 | ) 32 | -------------------------------------------------------------------------------- /ESP8266/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/env bash 2 | 3 | set -e 4 | 5 | echo "Running 'install' for ESP8266" 6 | ( 7 | python -m pip install pyserial 8 | ) 9 | -------------------------------------------------------------------------------- /ESP8266/script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/env bash 2 | 3 | set -e 4 | 5 | echo "Running 'script' for ESP8266" 6 | ( 7 | # https://github.com/nodemcu/nodemcu-firmware/pull/2545 removed the toolchain from the repository but the 1.5.4.1 branch 8 | # will always depend on it 9 | if [ -f tools/esp-open-sdk.tar.xz ]; then tar -Jxf tools/esp-open-sdk.tar.xz; elif [ -f tools/esp-open-sdk.tar.gz ]; then tar -zxf tools/esp-open-sdk.tar.gz; fi 10 | export PATH=$PATH:$PWD/esp-open-sdk/sdk:$PWD/esp-open-sdk/xtensa-lx106-elf/bin 11 | make all 12 | cd bin/ 13 | timestamp=$(date "+%Y-%m-%d-%H-%M-%S") 14 | base_file_name="nodemcu-$X_BRANCH-$X_NUMBER_OF_MODULES-modules-"$timestamp 15 | file_name_float=$base_file_name"-float.bin" 16 | srec_cat -output "${file_name_float}" -binary 0x00000.bin -binary -fill 0xff 0x00000 0x10000 0x10000.bin -binary -offset 0x10000 17 | cd ../ 18 | make clean 19 | make EXTRA_CCFLAGS="-DLUA_NUMBER_INTEGRAL" 20 | cd bin/ 21 | file_name_integer=$base_file_name"-integer.bin" 22 | srec_cat -output "${file_name_integer}" -binary 0x00000.bin -binary -fill 0xff 0x00000 0x10000 0x10000.bin -binary -offset 0x10000 23 | ) 24 | -------------------------------------------------------------------------------- /ESP8266/set-config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # user_config.h has a number of defines the are replaced according to their 4 | # corresponding env X_???? variable. 5 | # 6 | # Define Uncomment if param Set to param SDK3.0 7 | # LUA_FLASH_STORE >0 Y Y 8 | # SPIFFS_FIXED_LOCATION >0 Y Y 9 | # SPIFFS_MAX_FILESYSTEM_SIZE >0 Y Y 10 | # BUILD_FATFS "true" Y 11 | # DEVELOP_VERSION "true" Y 12 | # SSL_ENABLED "true" Y 13 | # 14 | set -e 15 | 16 | #if env var exists and is not "0" then overwrite default 17 | if [ -n "${X_LUA_FLASH_STORE}" ] && [ "${X_LUA_FLASH_STORE}" != "0" ]; then 18 | printf "Enabling LFS, size = %s\\n" "${X_LUA_FLASH_STORE}" 19 | sed -e "s!^//\\(#define LUA_FLASH_STORE\\).*!\\1 ${X_LUA_FLASH_STORE}!" user_config.h > user_config.h.new; 20 | mv user_config.h.new user_config.h; 21 | fi 22 | 23 | if [ -n "${X_SPIFFS_FIXED_LOCATION}" ] && [ "${X_SPIFFS_FIXED_LOCATION}" != "0" ]; then 24 | printf "SPIFFS location offset = %s\\n" "${X_SPIFFS_FIXED_LOCATION}" 25 | sed "s!^\\(#define SPIFFS_FIXED_LOCATION\\).*!\\1 ${X_SPIFFS_FIXED_LOCATION}!" user_config.h > user_config.h.new; 26 | mv user_config.h.new user_config.h; 27 | fi 28 | 29 | if [ -n "${X_SPIFFS_MAX_FILESYSTEM_SIZE}" ] && [ "${X_SPIFFS_MAX_FILESYSTEM_SIZE}" != "0" ]; then 30 | printf "SPIFFS size = %s\\n" "${X_SPIFFS_MAX_FILESYSTEM_SIZE}" 31 | sed "s!^//\\(#define SPIFFS_MAX_FILESYSTEM_SIZE\\).*!\\1 ${X_SPIFFS_MAX_FILESYSTEM_SIZE}!" user_config.h > user_config.h.new; 32 | mv user_config.h.new user_config.h; 33 | fi 34 | 35 | # What is carried in the following variables is the sed replacement expression. 36 | # It makes all #defines commented by default. 37 | declare fatfs="//#\\1" 38 | declare debug="//#\\1" 39 | declare ssl="//#\\1" 40 | 41 | if [ "${X_DEBUG_ENABLED}" == "true" ]; then 42 | echo "Enabling debug mode" 43 | debug="#\\1" 44 | fi 45 | 46 | if [ "${X_FATFS_ENABLED}" == "true" ]; then 47 | echo "Enabling FatFS" 48 | fatfs="#\\1" 49 | fi 50 | 51 | if [ "${X_SSL_ENABLED}" == "true" ]; then 52 | echo "Enabling SSL" 53 | ssl="#\\1" 54 | fi 55 | 56 | # Do sed via temp file for macOS compatability 57 | sed -e "s!^.*\\(define *BUILD_FATFS\\).*!$fatfs!" \ 58 | -e "s!^.*\\(define *CLIENT_SSL_ENABLE\\).*!$ssl!" \ 59 | -e "s!^.*\\(define *DEVELOP_VERSION\\).*!$debug!" \ 60 | user_config.h > user_config.h.new; 61 | mv user_config.h.new user_config.h; 62 | 63 | # Set the flash to autosize from which ever value the firmware developers chose 64 | # as a default. 65 | echo "Setting flash size to 'auto'" 66 | sed "s/#define FLASH_.*/#define FLASH_AUTOSIZE/" user_config.h > user_config.h.new; 67 | mv user_config.h.new user_config.h; 68 | -------------------------------------------------------------------------------- /ESP8266/set-displays.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | # replace default U8G and U8G2 I2C/SPI displays with the selected ones 6 | # sed inline in-place editing (-i) isn't used because OS X would require different syntax http://stackoverflow.com/q/22521207/131929 7 | 8 | if [ "${X_U8G_DISPLAY_I2C}" = "" ]; then 9 | # one *could* delete the default entry if no display is selected... 10 | # sed "/^ *U8G_DISPLAY_TABLE_ENTRY.*i2c)/d" u8g_config.h 11 | : 12 | else 13 | if test -e "u8g_config.h"; then 14 | sed "s/^ *U8G_DISPLAY_TABLE_ENTRY.*i2c)/ U8G_DISPLAY_TABLE_ENTRY($X_U8G_DISPLAY_I2C)/" u8g_config.h > u8g_config.h.tmp && mv u8g_config.h.tmp u8g_config.h 15 | fi 16 | 17 | if test -e "u8g2_displays.h"; then 18 | cat < u8g2_displays.h.tmp 19 | #define U8G2_DISPLAY_TABLE_I2C_EXTRA \\ 20 | U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_${X_U8G_DISPLAY_I2C}_f, ${X_U8G_DISPLAY_I2C}) 21 | EOF 22 | cat u8g2_displays.h >> u8g2_displays.h.tmp && mv u8g2_displays.h.tmp u8g2_displays.h 23 | fi 24 | fi 25 | 26 | if [ "${X_U8G_DISPLAY_SPI}" = "" ]; then 27 | # one *could* delete the default entry if no display is selected... 28 | # sed "/^ *U8G_DISPLAY_TABLE_ENTRY.*spi)/d" u8g_config.h 29 | : 30 | else 31 | if test -e "u8g_config.h"; then 32 | sed "s/^ *U8G_DISPLAY_TABLE_ENTRY.*spi)/ U8G_DISPLAY_TABLE_ENTRY($X_U8G_DISPLAY_SPI)/" u8g_config.h > u8g_config.h.tmp && mv u8g_config.h.tmp u8g_config.h 33 | fi 34 | 35 | if test -e "u8g2_displays.h"; then 36 | cat < u8g2_displays.h.tmp 37 | #define U8G2_DISPLAY_TABLE_SPI_EXTRA \\ 38 | U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_${X_U8G_DISPLAY_SPI}_f, ${X_U8G_DISPLAY_SPI}) 39 | EOF 40 | cat u8g2_displays.h >> u8g2_displays.h.tmp && mv u8g2_displays.h.tmp u8g2_displays.h 41 | fi 42 | fi 43 | 44 | 45 | # replace default UCG SPI displays with the selected one 46 | 47 | if [ "${X_UCG_DISPLAY_SPI}" = "" ]; then 48 | # one *could* delete the default entry if no display is selected... 49 | # sed "/^ *UCG_DISPLAY_TABLE_ENTRY.*)/d" ucg_config.h 50 | : 51 | else 52 | # delete the first of two default entries and replace the second 53 | sed "/^ *UCG_DISPLAY_TABLE_ENTRY(ili.*)/d" ucg_config.h > ucg_config.h.tmp && mv ucg_config.h.tmp ucg_config.h 54 | sed "s/^ *UCG_DISPLAY_TABLE_ENTRY.*)/ UCG_DISPLAY_TABLE_ENTRY($X_UCG_DISPLAY_SPI)/" ucg_config.h > ucg_config.h.tmp && mv ucg_config.h.tmp ucg_config.h 55 | fi 56 | -------------------------------------------------------------------------------- /ESP8266/set-fonts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | if [ "${X_U8G_FONTS}" = "" ]; then 6 | X_U8G_FONTS_STRING=' ' 7 | export X_U8G_FONTS_STRING 8 | else 9 | if test -e "u8g_config.h"; then 10 | # replace ',' by newline and turn every item into ' U8G_FONT_TABLE_ENTRY() \' (except 11 | # the one on the last line which mustn't have the '\' 12 | X_U8G_FONTS_STRING=$(echo "$X_U8G_FONTS" | tr , '\n' | perl -pe 'my $break = (eof) ? "" : "\\"; s/(.*)\n/ U8G_FONT_TABLE_ENTRY($1) $break\n/g') 13 | export X_U8G_FONTS_STRING 14 | 15 | # inject the fonts string into u8g_config.h between '#define U8G_FONT_TABLE \\n' and '\n#undef U8G_FONT_TABLE_ENTRY' 16 | # the 's' flag in '/sg' makes . match newlines 17 | # Perl creates a temp file which is removed right after the manipulation 18 | perl -e 'local $/; $_ = <>; s/(#define U8G_FONT_TABLE *\\\n)(.*)(\n#undef U8G_FONT_TABLE_ENTRY)/$1$ENV{"X_U8G_FONTS_STRING"}$3/sg; print' u8g_config.h > u8g_config.h.tmp && mv u8g_config.h.tmp u8g_config.h 19 | fi 20 | 21 | if test -e "u8g2_fonts.h"; then 22 | echo "#define U8G2_FONT_TABLE_EXTRA \\" > u8g2_fonts.h.tmp 23 | echo $X_U8G_FONTS | tr , '\n' | sed "s/\(.*\)/ U8G2_FONT_TABLE_ENTRY(\1) \\\\/" >> u8g2_fonts.h.tmp 24 | cat u8g2_fonts.h >> u8g2_fonts.h.tmp && mv u8g2_fonts.h.tmp u8g2_fonts.h 25 | fi 26 | fi 27 | -------------------------------------------------------------------------------- /ESP8266/set-modules.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | # replace ',' by newline, make it uppercase and prepend every item with '#define LUA_USE_MODULES_' 6 | X_MODULES_STRING=$(echo "$X_MODULES" | tr , '\n' | tr '[:lower:]' '[:upper:]' | perl -pe 's/(.*)\n/#define LUA_USE_MODULES_$1\n/g') 7 | export X_MODULES_STRING 8 | # inject the modules string into user_modules.h between '#ifndef LUA_CROSS_COMPILER\n' and '\n#endif /* LUA_CROSS_COMPILER' 9 | # the 's' flag in '/sg' makes . match newlines 10 | # Perl creates a temp file which is removed right after the manipulation 11 | perl -e 'local $/; $_ = <>; s/(#ifndef LUA_CROSS_COMPILER\n)(.*)(\n#endif.*LUA_CROSS_COMPILER.*)/$1$ENV{"X_MODULES_STRING"}$3/sg; print' user_modules.h > user_modules.h.tmp && mv user_modules.h.tmp user_modules.h 12 | -------------------------------------------------------------------------------- /ESP8266/set-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | X_COMMIT_ID=$(git rev-parse HEAD) 6 | BUILD_DATE="$(date "+%Y-%m-%d %H:%M")" 7 | sed -i 's/#define NODE_VERSION[^_].*/#define NODE_VERSION "NodeMCU custom build by frightanic.com\\n\\tbranch: '$X_BRANCH'\\n\\tcommit: '$X_COMMIT_ID'\\n\\tSSL: '$X_SSL_ENABLED'\\n\\tmodules: '$X_MODULES'\\n"/g' user_version.h 8 | sed -i 's/"unspecified"/"created on '"$BUILD_DATE"'\\n"/g' user_version.h 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Marcel Stör 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # nodemcu-custom-build 2 | -------------------------------------------------------------------------------- /build.config: -------------------------------------------------------------------------------- 1 | email=suvft@cebgbaznvy.pbz 2 | branch=dev-esp32-idf3-final 3 | modules=file,gpio,net,node,tmr,uart,wifi 4 | ssl-enabled=true 5 | debug-enabled=true 6 | fatfs-enabled=true 7 | u8g-fonts=font_6x10,font_chikita 8 | u8g-display-i2c=uc1611_dogm240_i2c 9 | u8g-display-spi=pcf8812_96x65_hw_spi 10 | ucg-display-spi=seps225_16x128x128_uvis_hw_spi, ucg_dev_seps225_16x128x128_univision, ucg_ext_seps225_16 11 | lfs-size=0x20000 12 | spiffs-base=0 13 | spiffs-size=0x200000 14 | -------------------------------------------------------------------------------- /export-env-vars.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | X_MODULES=$(grep -E '^modules=' build.config | cut -f 2- -d '=') 4 | 5 | { 6 | echo "export USER_PROLOG='built on nodemcu-build.com provided by frightanic.com'" 7 | echo "export X_EMAIL=$(grep -E '^email=' build.config | cut -f 2- -d '=')" 8 | echo "export X_BRANCH=$(grep -E '^branch=' build.config | cut -f 2- -d '=')" 9 | echo "export X_MODULES='""$X_MODULES""'" 10 | echo "export X_U8G_FONTS='$(grep -E '^u8g-fonts=' build.config | cut -f 2- -d '=')'" 11 | echo "export X_U8G_DISPLAY_I2C='$(grep -E '^u8g-display-i2c=' build.config | cut -f 2- -d '=')'" 12 | echo "export X_U8G_DISPLAY_SPI='$(grep -E '^u8g-display-spi=' build.config | cut -f 2- -d '=')'" 13 | echo "export X_UCG_DISPLAY_SPI='$(grep -E '^ucg-display-spi=' build.config | cut -f 2- -d '=')'" 14 | echo "export X_LUA_FLASH_STORE=$(grep -E '^lfs-size=' build.config | cut -f 2- -d '=')" 15 | echo "export X_SPIFFS_FIXED_LOCATION=$(grep -E '^spiffs-base=' build.config | cut -f 2- -d '=')" 16 | echo "export X_SPIFFS_MAX_FILESYSTEM_SIZE=$(grep -E '^spiffs-size=' build.config | cut -f 2- -d '=')" 17 | echo "export X_SSL_ENABLED=$(grep -E '^ssl-enabled=' build.config | cut -f 2- -d '=')" 18 | echo "export X_DEBUG_ENABLED=$(grep -E '^debug-enabled=' build.config | cut -f 2- -d '=')" 19 | echo "export X_FATFS_ENABLED=$(grep -E '^fatfs-enabled=' build.config | cut -f 2- -d '=')" 20 | echo "export X_NUMBER_OF_MODULES=$(echo "$X_MODULES" | awk -F\, '{print NF}')" 21 | } >> ./.env-vars 22 | 23 | cat ./.env-vars 24 | --------------------------------------------------------------------------------