From 16ef39e255ad80a845497259b7e6069efc7d370a Mon Sep 17 00:00:00 2001 From: Johny Mattsson Date: Thu, 15 Jul 2021 16:25:25 +1000 Subject: [PATCH] idf4: overhaul to new build system, part 1 of 3 Yet to come: - part 2: dealing with deprecated and removed APIs - part 3: making it actually work again --- .travis.yml | 10 +- CMakeLists.txt | 3 + Makefile | 75 +-- components/base_nodemcu/CMakeLists.txt | 7 + components/base_nodemcu/Kconfig | 23 - components/base_nodemcu/Makefile.projbuild | 14 - components/base_nodemcu/add_rodata_ld.sh | 27 - components/base_nodemcu/component.mk | 0 .../base_nodemcu/include/nodemcu_esp_event.h | 3 +- components/base_nodemcu/linit.c | 18 +- components/base_nodemcu/nodemcu.lf | 29 + components/base_nodemcu/user_main.c | 13 +- components/driver_can/CMakeLists.txt | 4 + components/driver_can/component.mk | 9 - components/driver_console/CMakeLists.txt | 5 + components/driver_console/component.mk | 1 - components/driver_console/console.c | 3 +- .../driver_console/include/driver/console.h | 4 +- components/driver_i2c/CMakeLists.txt | 5 + components/driver_i2c/component.mk | 1 - .../driver_i2c/include/driver/i2c_sw_master.h | 2 +- components/embedded_lfs/CMakeLists.txt | 34 + components/embedded_lfs/component.mk | 19 - components/embedded_lfs/embedded_lfs.lf | 13 + components/fatfs/CMakeLists.txt | 8 + components/fatfs/component.mk | 6 - components/fatfs/ffconf.h | 2 +- components/fatfs/myfatfs.c | 4 +- components/lua/CMakeLists.txt | 13 + components/lua/Kconfig | 81 +++ components/lua/Makefile.projbuild | 7 - components/lua/compiler.h | 2 +- components/lua/component.mk | 1 - components/lua/lflash.c | 14 +- components/lua/lua.c | 2 +- components/lua/project_include.cmake | 11 + components/luac_cross/CMakeLists.txt | 22 + components/luac_cross/Makefile | 17 +- components/luac_cross/component.mk | 6 - components/modules/CMakeLists.txt | 85 +++ components/modules/Kconfig | 495 +++++++------- components/modules/component.mk | 38 -- components/modules/file.c | 20 +- components/modules/i2s.c | 8 +- components/modules/net.c | 54 +- components/modules/node.c | 2 +- components/modules/time.c | 2 +- components/modules/touch.c | 2 +- components/platform/CMakeLists.txt | 8 + components/platform/Kconfig | 285 ++++---- components/platform/component.mk | 5 - components/platform/flash_api.c | 2 +- components/platform/include/platform.h | 4 +- components/platform/include/vfs.h | 22 +- components/platform/include/vfs_int.h | 2 +- components/platform/platform.c | 8 +- components/platform/platform_partition.c | 1 - components/platform/project_include.cmake | 3 + components/platform/u8x8_nodemcu_hal.c | 2 +- components/platform/vfs.c | 56 +- components/qrcodegen/CMakeLists.txt | 4 + components/qrcodegen/component.mk | 3 - components/rtos_dbg/CMakeLists.txt | 4 + components/rtos_dbg/component.mk | 1 - components/sjson/CMakeLists.txt | 9 + components/sjson/component.mk | 2 - components/spiffs/CMakeLists.txt | 8 + components/spiffs/component.mk | 4 - components/spiffs/project_include.cmake | 16 + components/spiffs/spiffs.c | 10 +- components/spiffs/spiffs_config.h | 2 +- components/task/CMakeLists.txt | 4 + components/task/Kconfig | 32 +- components/task/component.mk | 1 - components/u8g2/CMakeLists.txt | 8 + components/u8g2/Kconfig.u8g2 | 637 ++++++++++++++++++ components/u8g2/component.mk | 3 - components/u8g2/project_include.cmake | 6 + components/u8g2/u8g2.kconfig | 637 ------------------ components/ucg/CMakeLists.txt | 7 + components/ucg/Kconfig.ucg | 66 ++ components/ucg/component.mk | 3 - components/ucg/project_include.cmake | 1 + components/ucg/ucg.kconfig | 66 -- components/uzlib/CMakeLists.txt | 4 + components/uzlib/Makefile.projbuild | 2 - components/uzlib/component.mk | 1 - docs/modules/net.md | 32 +- install.sh | 20 + requirements.txt | 1 + sdk/esp32-esp-idf | 2 +- sdkconfig.defaults | 46 +- tools/embed_lfs.sh | 11 +- 93 files changed, 1692 insertions(+), 1583 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 components/base_nodemcu/CMakeLists.txt delete mode 100644 components/base_nodemcu/Kconfig delete mode 100644 components/base_nodemcu/Makefile.projbuild delete mode 100755 components/base_nodemcu/add_rodata_ld.sh delete mode 100644 components/base_nodemcu/component.mk create mode 100644 components/base_nodemcu/nodemcu.lf create mode 100644 components/driver_can/CMakeLists.txt delete mode 100644 components/driver_can/component.mk create mode 100644 components/driver_console/CMakeLists.txt delete mode 100644 components/driver_console/component.mk create mode 100644 components/driver_i2c/CMakeLists.txt delete mode 100644 components/driver_i2c/component.mk create mode 100644 components/embedded_lfs/CMakeLists.txt delete mode 100644 components/embedded_lfs/component.mk create mode 100644 components/embedded_lfs/embedded_lfs.lf create mode 100644 components/fatfs/CMakeLists.txt delete mode 100644 components/fatfs/component.mk create mode 100644 components/lua/CMakeLists.txt create mode 100644 components/lua/Kconfig delete mode 100644 components/lua/Makefile.projbuild delete mode 100644 components/lua/component.mk create mode 100644 components/lua/project_include.cmake create mode 100644 components/luac_cross/CMakeLists.txt delete mode 100644 components/luac_cross/component.mk create mode 100644 components/modules/CMakeLists.txt delete mode 100644 components/modules/component.mk create mode 100644 components/platform/CMakeLists.txt delete mode 100644 components/platform/component.mk create mode 100644 components/platform/project_include.cmake create mode 100644 components/qrcodegen/CMakeLists.txt delete mode 100644 components/qrcodegen/component.mk create mode 100644 components/rtos_dbg/CMakeLists.txt delete mode 100644 components/rtos_dbg/component.mk create mode 100644 components/sjson/CMakeLists.txt delete mode 100644 components/sjson/component.mk create mode 100644 components/spiffs/CMakeLists.txt delete mode 100644 components/spiffs/component.mk create mode 100644 components/spiffs/project_include.cmake create mode 100644 components/task/CMakeLists.txt delete mode 100644 components/task/component.mk create mode 100644 components/u8g2/CMakeLists.txt create mode 100644 components/u8g2/Kconfig.u8g2 delete mode 100644 components/u8g2/component.mk create mode 100644 components/u8g2/project_include.cmake delete mode 100644 components/u8g2/u8g2.kconfig create mode 100644 components/ucg/CMakeLists.txt create mode 100644 components/ucg/Kconfig.ucg delete mode 100644 components/ucg/component.mk create mode 100644 components/ucg/project_include.cmake delete mode 100644 components/ucg/ucg.kconfig create mode 100644 components/uzlib/CMakeLists.txt delete mode 100644 components/uzlib/Makefile.projbuild delete mode 100644 components/uzlib/component.mk create mode 100755 install.sh create mode 100644 requirements.txt diff --git a/.travis.yml b/.travis.yml index ec9f70110e..55bb5c3a45 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,11 +9,13 @@ addons: # we can use the system python and python-serial, rather than messing around # with pip all over the place install: - - export PATH=$PWD/tools/toolchains/esp8266/bin:$PWD/tools/toolchains/esp32/bin:/bin:/usr/bin:/sbin:/usr/sbin - - /usr/bin/python -m pip install --user -r $PWD/sdk/esp32-esp-idf/requirements.txt + - export PATH=/bin:/usr/bin:/sbin:/usr/sbin + - ./install.sh script: - export BUILD_DATE=$(date +%Y%m%d) -- env BUILD_DIR_BASE=`pwd`/build/float make MORE_CFLAGS="-DBUILD_DATE='\"'$BUILD_DATE'\"'" defconfig all -- env BUILD_DIR_BASE=`pwd`/build/integer make MORE_CFLAGS="-DLUA_NUMBER_INTEGRAL -DBUILD_DATE='\"'$BUILD_DATE'\"'" defconfig all +- cp sdkconfig.defaults sdkconfig +- make IDFPY_ARGS="-B build/float" +- echo CONFIG_LUA_NUMBER_INTEGRAL=y >> sdkconfig +- make IDFPY_ARGS="-B build/integer" # http://docs.travis-ci.com/user/environment-variables/#Convenience-Variables #- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bash "$TRAVIS_BUILD_DIR"/tools/pr-build.sh; fi diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000..1f33fd6d5b --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.5) +include($ENV{IDF_PATH}/tools/cmake/project.cmake) +project(nodemcu) diff --git a/Makefile b/Makefile index dadbd69244..2bcf7d11ac 100644 --- a/Makefile +++ b/Makefile @@ -1,72 +1,29 @@ -# -*- coding: utf-8, tab-width: 2 -*- - -# If we haven't got IDF_PATH set already, reinvoke with IDF_PATH in the environ -.NOTPARALLEL: - ifeq ($(IDF_PATH),) + THIS_MK_FILE:=$(notdir $(lastword $(MAKEFILE_LIST))) THIS_DIR:=$(abspath $(dir $(lastword $(MAKEFILE_LIST)))) IDF_PATH=$(THIS_DIR)/sdk/esp32-esp-idf -TOOLCHAIN_RELEASES_BASEURL:=https://github.com/jmattsson/esp-toolchains/releases/ -TOOLCHAIN_VERSION:=20181106.1 -PLATFORM:=linux-$(shell uname --machine) - -## Directory to place external modules: -export EXTRA_COMPONENT_DIRS:=$(THIS_DIR)/components/modules/external - -ESP32_BIN:=$(THIS_DIR)/tools/toolchains/esp32-$(PLATFORM)-$(TOOLCHAIN_VERSION)/bin -ESP32_GCC:=$(ESP32_BIN)/xtensa-esp32-elf-gcc -ESP32_TOOLCHAIN_DL:=$(THIS_DIR)/cache/toolchain-esp32-$(PLATFORM)-$(TOOLCHAIN_VERSION).tar.xz - -all: | $(ESP32_GCC) -%: | $(ESP32_GCC) - @echo Setting IDF_PATH and re-invoking... - @env IDF_PATH=$(IDF_PATH) PATH="$(PATH):$(ESP32_BIN)" $(MAKE) -f $(THIS_MK_FILE) $@ - @if test "$@" = "clean"; then rm -rf $(THIS_DIR)/tools/toolchains/esp32-*; fi - -install_toolchain: $(ESP32_GCC) +all: + . $(IDF_PATH)/export.sh && $(MAKE) "$@" -$(ESP32_GCC): $(ESP32_TOOLCHAIN_DL) - @echo Uncompressing toolchain - @mkdir -p $(THIS_DIR)/tools/toolchains/ - @tar -xJf $< -C $(THIS_DIR)/tools/toolchains/ - # the archive contains ro files - @chmod -R u+w $(THIS_DIR)/tools/toolchains/esp32-* - @touch $@ - -download_toolchain: $(ESP32_TOOLCHAIN_DL) - -$(ESP32_TOOLCHAIN_DL): - @mkdir -p $(THIS_DIR)/cache - wget --tries=10 --timeout=15 --waitretry=30 --read-timeout=20 --retry-connrefused ${TOOLCHAIN_RELEASES_BASEURL}download/$(PLATFORM)-$(TOOLCHAIN_VERSION)/toolchain-esp32-$(PLATFORM)-$(TOOLCHAIN_VERSION).tar.xz -O $@ || { rm -f -- "$@"; echo "W: Download failed. Please check ${TOOLCHAIN_RELEASES_BASEURL} for an appropriate version. If there is none for $(PLATFORM), you might need to compile it yourself."; exit 1; } +%: + . $(IDF_PATH)/export.sh && $(MAKE) "$@" else -PROJECT_NAME:=NodeMCU - -# This is, sadly, the cleanest way to resolve the different non-standard -# conventions for sized integers across the various components. -BASIC_TYPES=-Du32_t=uint32_t -Du16_t=uint16_t -Du8_t=uint8_t -Ds32_t=int32_t -Ds16_t=int16_t -Duint32=uint32_t -Duint16=uint16_t -Duint8=uint8_t -Dsint32=int32_t -Dsint16=int16_t -Dsint8=int8_t +all: + $(IDF_PATH)/tools/idf.py $(IDFPY_ARGS) "$@" -$(IDF_PATH)/make/project.mk: - @echo "ESP-IDF isn't properly installed, will try to re-install and then re-run make:" - git submodule init - git submodule update --recursive - python -m pip install --user --requirement $(IDF_PATH)/requirements.txt || echo "W: pip failed, but this might be harmless. Let's just try whether it works anyway." >&2 - # If we'd just continue, make would fake-succeed albeit with a warning - # "make[1]: *** No rule to make target `menuconfig'. Stop." -# $(MAKE) -f $(THIS_MK_FILE) $@ || exit $? - -include $(IDF_PATH)/make/project.mk - -# Ensure these overrides are always used -CC:=$(CC) $(BASIC_TYPES) -D__ESP32__ $(MORE_CFLAGS) +%: + $(IDF_PATH)/tools/idf.py $(IDFPY_ARGS) "$@" endif -extmod-update: - @tools/extmod/extmod.sh update - -extmod-clean: - @tools/extmod/extmod.sh clean +# FIXME - needs updating to work in IDF4 +# +#extmod-update: +# @tools/extmod/extmod.sh update +# +#extmod-clean: +## @tools/extmod/extmod.sh clean diff --git a/components/base_nodemcu/CMakeLists.txt b/components/base_nodemcu/CMakeLists.txt new file mode 100644 index 0000000000..ffb07017ed --- /dev/null +++ b/components/base_nodemcu/CMakeLists.txt @@ -0,0 +1,7 @@ +idf_component_register( + SRCS "ip_fmt.c" "lextra.c" "linit.c" "lnodeaux.c" "uart.c" "user_main.c" + INCLUDE_DIRS "include" + REQUIRES "lua" + PRIV_REQUIRES "nvs_flash" + LDFRAGMENTS "nodemcu.lf" +) diff --git a/components/base_nodemcu/Kconfig b/components/base_nodemcu/Kconfig deleted file mode 100644 index b648fd8090..0000000000 --- a/components/base_nodemcu/Kconfig +++ /dev/null @@ -1,23 +0,0 @@ -menu "NodeMCU miscellaneous" - -choice LUA_OPTIMIZE_DEBUG_LEVEL - prompt "Discard debug info in compiled Lua" - default LUA_OPTIMIZE_DEBUG_NONE - help - Discard debug information in compiled Lua code to save memory. - -config LUA_OPTIMIZE_DEBUG_NONE - bool "No (keep full debug info)" -config LUA_OPTIMIZE_DEBUG_LOCAL_UPVAL - bool "Some (discard local & upvalue debug info)" -config LUA_OPTIMIZE_DEBUG_LOCAL_UPVAL_LINENO - bool "All (discard local, upvalue & line number info)" -endchoice - -config LUA_OPTIMIZE_DEBUG - int - default 1 if LUA_OPTIMIZE_DEBUG_NONE - default 2 if LUA_OPTIMIZE_DEBUG_LOCAL_UPVAL - default 3 if LUA_OPTIMIZE_DEBUG_LOCAL_UPVAL_LINENO - -endmenu diff --git a/components/base_nodemcu/Makefile.projbuild b/components/base_nodemcu/Makefile.projbuild deleted file mode 100644 index 1a205a9bfd..0000000000 --- a/components/base_nodemcu/Makefile.projbuild +++ /dev/null @@ -1,14 +0,0 @@ -BASE_NODEMCU_DIR:=$(dir $(lastword $(MAKEFILE_LIST))) -BASE_NODEMCU_BUILD_DIR:=$(BUILD_DIR_BASE)/base_nodemcu - -ifeq ($(CONFIG_LUA_EMBED_LFS),y) - NODEMCU_LD_SCRIPT:= nodemcu_rodata_lfs.ld -else - NODEMCU_LD_SCRIPT:= nodemcu_rodata.ld -endif - -$(BUILD_DIR_BASE)/$(PROJECT_NAME).elf: $(BASE_NODEMCU_BUILD_DIR)/ld_patched - -$(BASE_NODEMCU_BUILD_DIR)/ld_patched: $(BUILD_DIR_BASE)/esp32/esp32.project.ld - "$(BASE_NODEMCU_DIR)/add_rodata_ld.sh" "$<" "$(BASE_NODEMCU_DIR)/ld/$(NODEMCU_LD_SCRIPT)" - touch $@ diff --git a/components/base_nodemcu/add_rodata_ld.sh b/components/base_nodemcu/add_rodata_ld.sh deleted file mode 100755 index 599d01e17a..0000000000 --- a/components/base_nodemcu/add_rodata_ld.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# syntax: add_rodata_ld.sh /path/to/esp32.project.ld /path/to/snippet_file -set -eu -ldfile="$1" -partial="$2" -out="${ldfile}.new" -IFS=' -' -msg="/* NodeMCU patched */" -if [[ $(head -n 1 "$ldfile") =~ "$msg" ]] -then - echo "NodeMCU rodata already patched into $(basename $ldfile)" - exit 0 -else - echo "Patching in NodeMCU rodata into $(basename $ldfile)" - echo "$msg" > "$out" -fi - -cat "$ldfile" | while read line -do - if [[ $line =~ "drom0_0_seg" ]] - then - cat "$partial" >> "$out" - fi - echo $line >> "$out" -done -mv "$out" "$ldfile" diff --git a/components/base_nodemcu/component.mk b/components/base_nodemcu/component.mk deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/components/base_nodemcu/include/nodemcu_esp_event.h b/components/base_nodemcu/include/nodemcu_esp_event.h index b83a85dc87..8ea9703d34 100644 --- a/components/base_nodemcu/include/nodemcu_esp_event.h +++ b/components/base_nodemcu/include/nodemcu_esp_event.h @@ -65,7 +65,8 @@ typedef struct { nodemcu_esp_event_cb callback; } nodemcu_esp_event_reg_t; -extern nodemcu_esp_event_reg_t esp_event_cb_table; +extern nodemcu_esp_event_reg_t _esp_event_cb_table_start; +extern nodemcu_esp_event_reg_t _esp_event_cb_table_end; #define NODEMCU_ESP_EVENT(evcode, func) \ static const LOCK_IN_SECTION(esp_event_cb_table) \ diff --git a/components/base_nodemcu/linit.c b/components/base_nodemcu/linit.c index 17c03459a7..c3bd6e3dac 100644 --- a/components/base_nodemcu/linit.c +++ b/components/base_nodemcu/linit.c @@ -63,11 +63,21 @@ const LOCK_IN_SECTION(zzzzzzzz) char _ro_end[1] = {0}; #endif LROT_PUBLIC_BEGIN(LOCK_IN_SECTION(rotable) lua_rotables) +#ifdef CONFIG_LUA_BUILTIN_STRING LROT_TABENTRY( string, strlib ) +#endif +#ifdef CONFIG_LUA_BUILTIN_TABLE LROT_TABENTRY( table, tab_funcs ) - LROT_TABENTRY( debug, dblib) +#endif +#ifdef CONFIG_LUA_BUILTIN_COROUTINE LROT_TABENTRY( coroutine, co_funcs ) +#endif +#ifdef CONFIG_LUA_BUILTIN_DEBUG + LROT_TABENTRY( debug, dblib) +#endif +#ifdef CONFIG_LUA_BUILTIN_MATH LROT_TABENTRY( math, math ) +#endif LROT_TABENTRY( ROM, lua_rotables ) #ifdef LUA_CROSS_COMPILER LROT_TABENTRY( os, oslib ) @@ -80,9 +90,15 @@ LROT_BREAK(lua_rotables) LROT_PUBLIC_BEGIN(LOCK_IN_SECTION(libs) lua_libs) LROT_FUNCENTRY( _, luaopen_base ) LROT_FUNCENTRY( package, luaopen_package ) +#ifdef CONFIG_LUA_BUILTIN_STRING LROT_FUNCENTRY( string, luaopen_string ) +#endif +#ifdef CONFIG_LUA_BUILTIN_TABLE LROT_FUNCENTRY( table, luaopen_table ) +#endif +#ifdef CONFIG_LUA_BUILTIN_DEBUG LROT_FUNCENTRY( debug, luaopen_debug ) +#endif #ifndef LUA_CROSS_COMPILER LROT_BREAK(lua_rotables) #else diff --git a/components/base_nodemcu/nodemcu.lf b/components/base_nodemcu/nodemcu.lf new file mode 100644 index 0000000000..610849541d --- /dev/null +++ b/components/base_nodemcu/nodemcu.lf @@ -0,0 +1,29 @@ +[sections:lua_libs] +entries: + .lua_libs + +[sections:lua_rotable] +entries: + .lua_rotable + +[sections:lua_esp_event_cb_table] +entries: + .lua_esp_event_cb_table + +[scheme:nodemcu_arrays] +entries: + lua_libs -> flash_text + lua_rotable -> flash_text + lua_esp_event_cb_table -> flash_text + + +# Important: don't change the alignments below without also updating the +# _Static_assert over in linit.c and/or nodemcu_esp_event.h! + +[mapping:nodemcu] +archive: * +entries: + * (nodemcu_arrays); + lua_libs -> flash_text KEEP() ALIGN(8) SURROUND(lua_libs_map), + lua_rotable -> flash_text KEEP() ALIGN(8) SURROUND(lua_rotables_map), + lua_esp_event_cb_table -> flash_text KEEP() ALIGN(4) SURROUND(esp_event_cb_table) diff --git a/components/base_nodemcu/user_main.c b/components/base_nodemcu/user_main.c index abfde1d549..5b1fc02982 100644 --- a/components/base_nodemcu/user_main.c +++ b/components/base_nodemcu/user_main.c @@ -16,7 +16,6 @@ #include "sdkconfig.h" #include "esp_system.h" #include "esp_event.h" -#include "esp_event_loop.h" #include "nvs_flash.h" #include "flash_api.h" @@ -70,8 +69,8 @@ static void handle_esp_event (task_param_t param, task_prio_t prio) system_event_t evt; while (xQueueReceive (esp_event_queue, &evt, 0) == pdPASS) { - nodemcu_esp_event_reg_t *evregs; - for (evregs = &esp_event_cb_table; evregs->callback; ++evregs) + nodemcu_esp_event_reg_t *evregs = &_esp_event_cb_table_start; + for (; evregs < &_esp_event_cb_table_end; ++evregs) { if (evregs->event_id == evt.event_id) evregs->callback (&evt); @@ -126,7 +125,7 @@ void nodemcu_init(void) return; } -#if defined ( CONFIG_BUILD_SPIFFS ) +#if defined ( CONFIG_NODEMCU_BUILD_SPIFFS ) // This can take a while, so be nice and provide some feedback while waiting printf ("Mounting flash filesystem...\n"); if (!vfs_mount("/FLASH", 0)) { @@ -155,12 +154,12 @@ void app_main (void) esp_event_loop_init(bounce_events, NULL); ConsoleSetup_t cfg; - cfg.bit_rate = CONFIG_CONSOLE_BIT_RATE; + cfg.bit_rate = CONFIG_NODEMCU_CONSOLE_BIT_RATE; cfg.data_bits = CONSOLE_NUM_BITS_8; cfg.parity = CONSOLE_PARITY_NONE; cfg.stop_bits = CONSOLE_STOP_BITS_1; cfg.auto_baud = -#ifdef CONFIG_CONSOLE_BIT_RATE_AUTO +#ifdef CONFIG_NODEMCU_CONSOLE_BIT_RATE_AUTO true; #else false; @@ -172,7 +171,7 @@ void app_main (void) nodemcu_init (); nvs_flash_init (); - tcpip_adapter_init (); + esp_netif_init (); start_lua (); task_pump_messages (); diff --git a/components/driver_can/CMakeLists.txt b/components/driver_can/CMakeLists.txt new file mode 100644 index 0000000000..c79ace83c5 --- /dev/null +++ b/components/driver_can/CMakeLists.txt @@ -0,0 +1,4 @@ +idf_component_register( + SRCS "CAN.c" + INCLUDE_DIRS "include" +) diff --git a/components/driver_can/component.mk b/components/driver_can/component.mk deleted file mode 100644 index 8c8d52abcb..0000000000 --- a/components/driver_can/component.mk +++ /dev/null @@ -1,9 +0,0 @@ -# -# Main component makefile. -# -# This Makefile can be left empty. By default, it will take the sources in the -# src/ directory, compile them and link them into lib(subdirectory_name).a -# in the build directory. This behaviour is entirely configurable, -# please read the ESP-IDF documents if you need to do this. -# - diff --git a/components/driver_console/CMakeLists.txt b/components/driver_console/CMakeLists.txt new file mode 100644 index 0000000000..b412cdeb4b --- /dev/null +++ b/components/driver_console/CMakeLists.txt @@ -0,0 +1,5 @@ +idf_component_register( + SRCS "console.c" + INCLUDE_DIRS "include" + REQUIRES "task" "esp32" +) diff --git a/components/driver_console/component.mk b/components/driver_console/component.mk deleted file mode 100644 index 291db28daf..0000000000 --- a/components/driver_console/component.mk +++ /dev/null @@ -1 +0,0 @@ -COMPONENT_ADD_INCLUDEDIRS:=include diff --git a/components/driver_console/console.c b/components/driver_console/console.c index 273e0803fa..2f656c5dc7 100644 --- a/components/driver_console/console.c +++ b/components/driver_console/console.c @@ -32,7 +32,6 @@ */ #include "driver/console.h" -#include "esp_intr.h" #include "esp_intr_alloc.h" #include "soc/soc.h" #include "soc/uart_reg.h" @@ -41,7 +40,7 @@ #include "freertos/queue.h" #include -#include "rom/libc_stubs.h" +#include "esp32/rom/libc_stubs.h" #include "sys/reent.h" #define UART_INPUT_QUEUE_SZ 0x100 diff --git a/components/driver_console/include/driver/console.h b/components/driver_console/include/driver/console.h index 592c92ab46..d9ed96b9d2 100644 --- a/components/driver_console/include/driver/console.h +++ b/components/driver_console/include/driver/console.h @@ -31,12 +31,12 @@ * @author Johny Mattsson */ -#include "rom/uart.h" +#include "esp32/rom/uart.h" #include "task/task.h" #include #include -#define CONSOLE_UART CONFIG_CONSOLE_UART_NUM +#define CONSOLE_UART CONFIG_ESP_CONSOLE_UART_NUM typedef enum { diff --git a/components/driver_i2c/CMakeLists.txt b/components/driver_i2c/CMakeLists.txt new file mode 100644 index 0000000000..99b838826d --- /dev/null +++ b/components/driver_i2c/CMakeLists.txt @@ -0,0 +1,5 @@ +idf_component_register( + SRCS "i2c_sw_master.c" + INCLUDE_DIRS "include" + REQUIRES "esp32" +) diff --git a/components/driver_i2c/component.mk b/components/driver_i2c/component.mk deleted file mode 100644 index 291db28daf..0000000000 --- a/components/driver_i2c/component.mk +++ /dev/null @@ -1 +0,0 @@ -COMPONENT_ADD_INCLUDEDIRS:=include diff --git a/components/driver_i2c/include/driver/i2c_sw_master.h b/components/driver_i2c/include/driver/i2c_sw_master.h index e9ab756590..c4178a0d95 100644 --- a/components/driver_i2c/include/driver/i2c_sw_master.h +++ b/components/driver_i2c/include/driver/i2c_sw_master.h @@ -1,7 +1,7 @@ #ifndef __I2C_SW_MASTER_H__ #define __I2C_SW_MASTER_H__ -#include "rom/ets_sys.h" +#include "esp32/rom/ets_sys.h" #define I2C_NUM_MAX 1 diff --git a/components/embedded_lfs/CMakeLists.txt b/components/embedded_lfs/CMakeLists.txt new file mode 100644 index 0000000000..e0d9764407 --- /dev/null +++ b/components/embedded_lfs/CMakeLists.txt @@ -0,0 +1,34 @@ +if (CONFIG_NODEMCU_EMBED_LFS) + +# Handle hex size in a shell agnostic manner +math(EXPR lfs_size ${CONFIG_NODEMCU_EMBEDDED_LFS_SIZE}) + +# The luac.out gets written by tools/embed_lfs.sh, but we need a non-empty +# file for the first build pass +add_custom_command( + OUTPUT ${BUILD_DIR}/luac.out + COMMAND [ -s "${BUILD_DIR}/luac.out" ] || echo "" > "${BUILD_DIR}/luac.out" + VERBATIM +) +add_custom_target(luac_out DEPENDS ${BUILD_DIR}/luac.out) + +# We use the automatic file name to symbol generation here, to create the +# expected symbol lua_flash_store_reserved +add_custom_command( + OUTPUT ${BUILD_DIR}/lua.flash.store.reserved + COMMAND truncate --size=${lfs_size} ${BUILD_DIR}/lua.flash.store.reserved && dd if=${BUILD_DIR}/luac.out of=${BUILD_DIR}/lua.flash.store.reserved conv=notrunc status=none + DEPENDS luac_out + VERBATIM +) +add_custom_target(reserved_lfs DEPENDS ${BUILD_DIR}/lua.flash.store.reserved) + +idf_component_register( + EMBED_FILES ${BUILD_DIR}/lua.flash.store.reserved + LDFRAGMENTS "embedded_lfs.lf" +) + +add_dependencies(${COMPONENT_LIB} reserved_lfs) + +else() +idf_component_register() +endif() diff --git a/components/embedded_lfs/component.mk b/components/embedded_lfs/component.mk deleted file mode 100644 index 70e62d1ea5..0000000000 --- a/components/embedded_lfs/component.mk +++ /dev/null @@ -1,19 +0,0 @@ -SHELL:=/bin/bash - -ifeq ($(CONFIG_LUA_EMBED_LFS),y) - -COMPONENT_OBJS := $(COMPONENT_BUILD_DIR)/luac_out.o -COMPONENT_EXTRA_CLEAN := $(COMPONENT_OBJS) $(COMPONENT_BUILD_DIR)/luac_out.o.bin -COMPONENT_ADD_LINKER_DEPS := $(COMPONENT_BUILD_DIR)/luac_out.o -EMBEDDED_LFS_DATA:= $(BUILD_DIR_BASE)/luac.out - -$(COMPONENT_BUILD_DIR)/luac_out.o: $(EMBEDDED_LFS_DATA) - echo "embedding luac.out into object file $@..." - dd if=/dev/zero bs=1 count=$$(( $(CONFIG_LUA_EMBEDDED_FLASH_STORE) )) of="$@.bin" status=none - dd if="$(EMBEDDED_LFS_DATA)" conv=notrunc of="$@.bin" status=none - cd $(dir $@) && $(OBJCOPY) --input-target binary --output-target elf32-xtensa-le --binary-architecture xtensa --rename-section .data=.lfs.reserved --redefine-sym _binary_luac_out_o_bin_start=lua_flash_store_reserved "$(notdir $@.bin)" "$@" - -$(EMBEDDED_LFS_DATA): - touch $@ - -endif diff --git a/components/embedded_lfs/embedded_lfs.lf b/components/embedded_lfs/embedded_lfs.lf new file mode 100644 index 0000000000..8547627a78 --- /dev/null +++ b/components/embedded_lfs/embedded_lfs.lf @@ -0,0 +1,13 @@ +[sections:rodata_embedded] +entries: + .rodata.embedded + +[scheme:embedded_lfs] +entries: + rodata_embedded -> flash_text + +[mapping:embedded_lfs] +archive: libembedded_lfs.a +entries: + * (default); + rodata -> flash_rodata KEEP() ALIGN(4096) diff --git a/components/fatfs/CMakeLists.txt b/components/fatfs/CMakeLists.txt new file mode 100644 index 0000000000..07322d1d30 --- /dev/null +++ b/components/fatfs/CMakeLists.txt @@ -0,0 +1,8 @@ +idf_component_register( + SRCS "diskio.c" "ff.c" "myfatfs.c" "ffunicode.c" "ffsystem.c" + INCLUDE_DIRS "." + REQUIRES "platform" "sdmmc" +) +target_compile_options(${COMPONENT_LIB} PRIVATE -imacros fatfs_prefix_lib.h) + +# TODO: add Kconfig to select code page used? diff --git a/components/fatfs/component.mk b/components/fatfs/component.mk deleted file mode 100644 index 19bb58fb07..0000000000 --- a/components/fatfs/component.mk +++ /dev/null @@ -1,6 +0,0 @@ -COMPONENT_SRCDIRS:=. -# TODO: add Kconfig to select code page used? -COMPONENT_OBJS:=diskio.o ff.o myfatfs.o ffunicode.o ffsystem.o -COMPONENT_ADD_INCLUDEDIRS:=. - -CFLAGS+=-imacros fatfs_prefix_lib.h diff --git a/components/fatfs/ffconf.h b/components/fatfs/ffconf.h index 0c7b9d7526..787e6ece88 100644 --- a/components/fatfs/ffconf.h +++ b/components/fatfs/ffconf.h @@ -100,7 +100,7 @@ #define FF_USE_LFN 3 -#define FF_MAX_LFN (CONFIG_FS_OBJ_NAME_LEN+1+1) +#define FF_MAX_LFN (CONFIG_NODEMCU_FS_OBJ_NAME_LEN+1+1) /* The FF_USE_LFN switches the support for LFN (long file name). / / 0: Disable LFN. FF_MAX_LFN has no effect. diff --git a/components/fatfs/myfatfs.c b/components/fatfs/myfatfs.c index 9d2344811c..2948ab4a62 100644 --- a/components/fatfs/myfatfs.c +++ b/components/fatfs/myfatfs.c @@ -301,8 +301,8 @@ static void myfatfs_fill_stat( const FILINFO *fno, struct vfs_stat *buf ) memset( buf, 0, sizeof( struct vfs_stat ) ); // fill in supported stat entries - strncpy( buf->name, fno->fname, CONFIG_FS_OBJ_NAME_LEN+1 ); - buf->name[CONFIG_FS_OBJ_NAME_LEN] = '\0'; + strncpy( buf->name, fno->fname, CONFIG_NODEMCU_FS_OBJ_NAME_LEN+1 ); + buf->name[CONFIG_NODEMCU_FS_OBJ_NAME_LEN] = '\0'; buf->size = fno->fsize; buf->is_dir = fno->fattrib & AM_DIR ? 1 : 0; buf->is_rdonly = fno->fattrib & AM_RDO ? 1 : 0; diff --git a/components/lua/CMakeLists.txt b/components/lua/CMakeLists.txt new file mode 100644 index 0000000000..5feed73e72 --- /dev/null +++ b/components/lua/CMakeLists.txt @@ -0,0 +1,13 @@ +idf_component_register( + SRCS "lapi.c" "lauxlib.c" "lbaselib.c" "lcode.c" "ldblib.c" "ldebug.c" + "ldo.c" "ldump.c" "legc.c" "lflash.c" "lfunc.c" "lgc.c" "llex.c" "lmathlib.c" + "lmem.c" "loadlib.c" "lobject.c" "lopcodes.c" "lparser.c" "lrotable.c" + "lstate.c" "lstring.c" "lstrlib.c" "ltable.c" "ltablib.c" "ltm.c" + "lua.c" "lundump.c" "lvm.c" "lzio.c" + INCLUDE_DIRS "." + REQUIRES "platform" "uzlib" "driver_console" + PRIV_REQUIRES "base_nodemcu" "embedded_lfs" +) +target_compile_options(${COMPONENT_LIB} PRIVATE + -Wno-error=misleading-indentation +) diff --git a/components/lua/Kconfig b/components/lua/Kconfig new file mode 100644 index 0000000000..1082417a13 --- /dev/null +++ b/components/lua/Kconfig @@ -0,0 +1,81 @@ +menu "Lua configuration" + + config LUA_NUMBER_INTEGRAL + bool "Integer-only build" + default "n" + help + Build Lua without support for floating point numbers. + Not generally recommended, but can save on code size. + + menu "Core Lua modules" + + config LUA_BUILTIN_STRING + bool "String module" + default "y" + help + Includes the string module (recommended). + + config LUA_BUILTIN_TABLE + bool "Table module" + default "y" + help + Includes the table module (recommended). + + config LUA_BUILTIN_COROUTINE + bool "Coroutine module" + default "y" + help + Includes the coroutine module (recommended). + + config LUA_BUILTIN_MATH + bool "Math module" + default "y" + help + Includes the math module (recommended). + + config LUA_BUILTIN_DEBUG + bool "Debug module" + default "n" + help + Includes the debug module. + + config LUA_BUILTIN_DEBUG_EXTENDED + depends on LUA_BUILTIN_DEBUG + bool "Extended debug support" + default "n" + help + Includes the full debug module, rather than just getregistry + and traceback. + + config LUA_BUILTIN_DEBUG_MINIMAL + depends on LUA_BUILTIN_DEBUG + bool + default !LUA_BUILTIN_DEBUG_EXTENDED + + endmenu + + menu "Lua compilation" + + choice LUA_OPTIMIZE_DEBUG_LEVEL + prompt "Discard debug info in compiled Lua" + default LUA_OPTIMIZE_DEBUG_NONE + help + Discard debug information in compiled Lua code to save memory. + + config LUA_OPTIMIZE_DEBUG_NONE + bool "No (keep full debug info)" + config LUA_OPTIMIZE_DEBUG_LOCAL_UPVAL + bool "Some (discard local & upvalue debug info)" + config LUA_OPTIMIZE_DEBUG_LOCAL_UPVAL_LINENO + bool "All (discard local, upvalue & line number info)" + endchoice + + config LUA_OPTIMIZE_DEBUG + int + default 1 if LUA_OPTIMIZE_DEBUG_NONE + default 2 if LUA_OPTIMIZE_DEBUG_LOCAL_UPVAL + default 3 if LUA_OPTIMIZE_DEBUG_LOCAL_UPVAL_LINENO + + endmenu + +endmenu diff --git a/components/lua/Makefile.projbuild b/components/lua/Makefile.projbuild deleted file mode 100644 index d2d4262d63..0000000000 --- a/components/lua/Makefile.projbuild +++ /dev/null @@ -1,7 +0,0 @@ --include $(PROJECT_PATH)/build/include/config/auto.conf - -CFLAGS+=\ - -DLUA_OPTIMIZE_MEMORY=2 \ - -DMIN_OPT_LEVEL=2 \ - -DLUA_OPTIMIZE_DEBUG=$(CONFIG_LUA_OPTIMIZE_DEBUG) \ - diff --git a/components/lua/compiler.h b/components/lua/compiler.h index 867664e336..f3a5ad694d 100644 --- a/components/lua/compiler.h +++ b/components/lua/compiler.h @@ -12,7 +12,7 @@ extern char _irom0_text_end; #define RODATA_START_ADDRESS (&_irom0_text_start) #define RODATA_END_ADDRESS (&_irom0_text_end) -#elif defined(__ESP32__) +#elif defined(__ESP32__) || defined(CONFIG_IDF_TARGET_ESP32) #define RODATA_START_ADDRESS ((char*)0x3F400000) #define RODATA_END_ADDRESS ((char*)0x3F800000) diff --git a/components/lua/component.mk b/components/lua/component.mk deleted file mode 100644 index f50bec1fa8..0000000000 --- a/components/lua/component.mk +++ /dev/null @@ -1 +0,0 @@ -COMPONENT_ADD_INCLUDEDIRS:=. diff --git a/components/lua/lflash.c b/components/lua/lflash.c index 8cd226484b..4b3261f212 100644 --- a/components/lua/lflash.c +++ b/components/lua/lflash.c @@ -81,7 +81,7 @@ struct OUTPUT { } *out; -#ifdef CONFIG_LUA_EMBEDDED_FLASH_STORE +#ifdef CONFIG_NODEMCU_EMBEDDED_LFS_SIZE extern const char lua_flash_store_reserved[0]; #endif @@ -110,7 +110,7 @@ LUA_API void dumpStrings(lua_State *L) { } #endif -#ifndef CONFIG_LUA_EMBEDDED_FLASH_STORE +#ifndef CONFIG_NODEMCU_EMBEDDED_LFS_SIZE /* ===================================================================================== * The next 4 functions: flashPosition, flashSetPosition, flashBlock and flashErase * wrap writing to flash. The last two are platform dependent. Also note that any @@ -155,8 +155,8 @@ static int procFirstPass (void); * Hook in lstate.c:f_luaopen() to set up ROstrt and ROpvmain if needed */ LUAI_FUNC void luaN_init (lua_State *L) { -#ifdef CONFIG_LUA_EMBEDDED_FLASH_STORE - flashSize = CONFIG_LUA_EMBEDDED_FLASH_STORE; +#ifdef CONFIG_NODEMCU_EMBEDDED_LFS_SIZE + flashSize = CONFIG_NODEMCU_EMBEDDED_LFS_SIZE; flashAddr = lua_flash_store_reserved; flashAddrPhys = spi_flash_cache2phys(lua_flash_store_reserved); if (flashAddrPhys == SPI_FLASH_CACHE2PHYS_FAIL) { @@ -226,7 +226,7 @@ LUAI_FUNC void luaN_init (lua_State *L) { * Library function called by node.flashreload(filename). */ LUALIB_API int luaN_reload_reboot (lua_State *L) { -#ifdef CONFIG_LUA_EMBEDDED_FLASH_STORE +#ifdef CONFIG_NODEMCU_EMBEDDED_LFS_SIZE // Updating the LFS section is disabled for now because any changes to the // image requires updating its checksum to prevent boot failure. lua_pushstring(L, "Not allowed to write to LFS section"); @@ -291,7 +291,7 @@ LUALIB_API int luaN_reload_reboot (lua_State *L) { esp_restart(); return 0; -#endif // CONFIG_LUA_EMBEDDED_FLASH_STORE +#endif // CONFIG_NODEMCU_EMBEDDED_LFS_SIZE } @@ -346,7 +346,7 @@ LUAI_FUNC int luaN_index (lua_State *L) { return 5; } -#ifndef CONFIG_LUA_EMBEDDED_FLASH_STORE +#ifndef CONFIG_NODEMCU_EMBEDDED_LFS_SIZE /* ===================================================================================== * The following routines use my uzlib which was based on pfalcon's inflate and * deflate routines. The standard NodeMCU make also makes two host tools uz_zip diff --git a/components/lua/lua.c b/components/lua/lua.c index 9cca08d97a..b56404a9a6 100644 --- a/components/lua/lua.c +++ b/components/lua/lua.c @@ -266,7 +266,7 @@ static int runargs (lua_State *L, char **argv, int n) { static int handle_luainit (lua_State *L) { const char *init = LUA_INIT_STRING; if (init[0] == '@') { - #if CONFIG_LUA_EMBEDDED_FLASH_STORE > 0 + #if CONFIG_NODEMCU_EMBEDDED_LFS_SIZE > 0 int status = dolfsfile(L, init+1); if (status == 0) return status; diff --git a/components/lua/project_include.cmake b/components/lua/project_include.cmake new file mode 100644 index 0000000000..0ab5d01af3 --- /dev/null +++ b/components/lua/project_include.cmake @@ -0,0 +1,11 @@ +foreach(def + "-DLUA_OPTIMIZE_MEMORY=2" + "-DMIN_OPT_LEVEL=2" + "-DLUA_OPTIMIZE_DEBUG=${CONFIG_LUA_OPTIMIZE_DEBUG}" +) + idf_build_set_property(COMPILE_DEFINITIONS ${def} APPEND) +endforeach() + +if(CONFIG_LUA_NUMBER_INTEGRAL) + idf_build_set_property(COMPILE_DEFINITIONS -DLUA_NUMBER_INTEGRAL APPEND) +endif() diff --git a/components/luac_cross/CMakeLists.txt b/components/luac_cross/CMakeLists.txt new file mode 100644 index 0000000000..e26024f528 --- /dev/null +++ b/components/luac_cross/CMakeLists.txt @@ -0,0 +1,22 @@ +idf_component_register(luac_cross) + +# Not sure why we can't directly depend on ${SDKCONFIG_HEADER} in our +# externalproject_add(), but them's the brakes... + +add_custom_command( + OUTPUT sdkconfig.h + COMMAND cp ${SDKCONFIG_HEADER} sdkconfig.h + DEPENDS ${SDKCONFIG_HEADER} + VERBATIM +) +add_custom_target(sdkconfig_h DEPENDS sdkconfig.h) + +externalproject_add(luac_cross_build + PREFIX ${BUILD_DIR}/luac_cross + SOURCE_DIR ${COMPONENT_DIR} + CONFIGURE_COMMAND "" + BUILD_COMMAND make -f ${COMPONENT_DIR}/Makefile BUILD_DIR_BASE=${BUILD_DIR} COMPONENT_PATH=${COMPONENT_DIR} CONFIG_LUA_OPTIMIZE_DEBUG=${CONFIG_LUA_OPTIMIZE_DEBUG} PYTHON=${PYTHON} + INSTALL_COMMAND "" + BUILD_ALWAYS 1 + DEPENDS sdkconfig_h +) diff --git a/components/luac_cross/Makefile b/components/luac_cross/Makefile index 54f9b96b4e..7b5e3eb881 100644 --- a/components/luac_cross/Makefile +++ b/components/luac_cross/Makefile @@ -1,10 +1,19 @@ all: build +HOSTCC?=$(PYTHON) -m ziglang cc + +# zig cc (0.8.0 at least) seems to get itself all confused with its cache +# when we're running a separate path for dependencies, so we skip them for +# now as for most people they're not needed anyway. +ifeq ($(findstring zig,$(HOSTCC)),zig) + WITHOUT_DEPS:=1 +endif + ifeq ($V,) - Q:=@ + Q:=@ endif -LUAC_CFLAGS:= -I$(COMPONENT_PATH)/../uzlib -I$(COMPONENT_PATH)/../lua -I$(BUILD_DIR_BASE)/include -I$(COMPONENT_PATH)/../base_nodemcu/include -O2 -g -Wall -Wextra +LUAC_CFLAGS:= -I$(COMPONENT_PATH)/../uzlib -I$(COMPONENT_PATH)/../lua -I$(BUILD_DIR_BASE)/config -I$(COMPONENT_PATH)/../base_nodemcu/include -O2 -g -Wall -Wextra LUAC_LDFLAGS:= -ldl -lm LUAC_DEFINES += -DLUA_CROSS_COMPILER -DLUA_USE_STDIO @@ -41,14 +50,16 @@ LUAC_OBJS+=$(LUAC_UZSRC:$(COMPONENT_PATH)/../uzlib/%.c=$(LUAC_BUILD_DIR)/%.o) LUAC_OBJS+=$(LUAC_NODEMCUSRC:$(COMPONENT_PATH)/../base_nodemcu/%.c=$(LUAC_BUILD_DIR)/%.o) +ifneq ($(WITHOUT_DEPS),1) LUAC_DEPS:=$(LUAC_OBJS:%.o=%.d) +endif LUAC_CROSS:=$(LUAC_BUILD_DIR)/luac.cross $(LUAC_BUILD_DIR): @mkdir -p "$@" -$(LUAC_BUILD_DIR)/%.o: | $(LUAC_BUILD_DIR) +$(LUAC_BUILD_DIR)/%.o: %.c | $(LUAC_BUILD_DIR) @echo '[hostcc] $(notdir $@)' $Q$(HOSTCC) $(LUAC_DEFINES) $(LUAC_CFLAGS) "$<" -c -o "$@" diff --git a/components/luac_cross/component.mk b/components/luac_cross/component.mk deleted file mode 100644 index b2ebcd7eb0..0000000000 --- a/components/luac_cross/component.mk +++ /dev/null @@ -1,6 +0,0 @@ -COMPONENT_OWNBUILDTARGET:=build -COMPONENT_ADD_LDFLAGS:= - -build: - $(MAKE) -f $(COMPONENT_PATH)/Makefile HOSTCC=$(HOSTCC) BUILD_DIR_BASE=$(BUILD_DIR_BASE) V=$V COMPONENT_PATH=$(COMPONENT_PATH) CONFIG_LUA_OPTIMIZE_DEBUG=$(CONFIG_LUA_OPTIMIZE_DEBUG) - ar cr lib$(COMPONENT_NAME).a # work around IDF regression diff --git a/components/modules/CMakeLists.txt b/components/modules/CMakeLists.txt new file mode 100644 index 0000000000..afb61c1200 --- /dev/null +++ b/components/modules/CMakeLists.txt @@ -0,0 +1,85 @@ +# Globbing isn't recommended, but I dislike it less than having to edit +# this file whenever a new module source file springs into existence. +# Just remember to "idf.py reconfigure" (or do a clean build) to get +# cmake to pick up on the new (or removed) files. +file( + GLOB module_srcs + LIST_DIRECTORIES false + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + *.c +) + +idf_component_register( + SRCS ${module_srcs} + PRIV_INCLUDE_DIRS "." "${CMAKE_CURRENT_BINARY_DIR}" + PRIV_REQUIRES + "app_update" + "base_nodemcu" + "bt" + "driver_can" + "esp_http_client" + "libsodium" + "lua" + "mbedtls" + "mqtt" + "platform" + "qrcodegen" + "sdmmc" + "sjson" + "soc" + "u8g2" + "ucg" +) + +# Match up all the module source files with their corresponding Kconfig +# option in the form NODEMCU_CMODULE_ and if enabled, add a +# "-u _module_selected1" option to force the linker to include +# the module. See components/core/include/module.h for further details on +# how this works. +set(modules_enabled) +foreach(module_src ${module_srcs}) + string(REPLACE ".c" "" module_name ${module_src}) + string(TOUPPER ${module_name} module_ucase) + set(mod_opt "CONFIG_NODEMCU_CMODULE_${module_ucase}") + #message("checking ${mod_opt}") + if (${${mod_opt}}) + list(APPEND modules_enabled ${module_ucase}) + endif() +endforeach() +message("Including the following modules: ${modules_enabled}") + +foreach(mod ${modules_enabled}) + target_link_libraries(${COMPONENT_LIB} "-u ${mod}_module_selected1") +endforeach() + + +# Auto-generation of ucg/u8g2 header files, per +# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html#source-code-generation + +add_custom_command( + OUTPUT ucg_config.h + COMMAND perl -w ${PROJECT_DIR}/tools/ucg_config.pl < ${SDKCONFIG_HEADER} > ucg_config.h + DEPENDS ${SDKCONFIG_HEADER} + VERBATIM +) +add_custom_target(ucg_config DEPENDS ucg_config.h) + +add_custom_command( + OUTPUT u8g2_fonts.h + COMMAND perl -w ${PROJECT_DIR}/tools/u8g2_config_fonts.pl < ${SDKCONFIG_HEADER} > u8g2_fonts.h + DEPENDS ${SDKCONFIG_HEADER} + VERBATIM +) +add_custom_target(u8g2_fonts DEPENDS u8g2_fonts.h) +add_custom_command( + OUTPUT u8g2_displays.h + COMMAND perl -w ${PROJECT_DIR}/tools/u8g2_config_displays.pl < ${SDKCONFIG_HEADER} > u8g2_displays.h +) +add_custom_target(u8g2_displays DEPENDS u8g2_displays.h) + +add_dependencies(${COMPONENT_LIB} ucg_config u8g2_fonts u8g2_displays) + +set_property( + DIRECTORY "${COMPONENT_DIR}" APPEND + PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ucg_config.h u8g2_fonts.h u8g2_displays.h +) diff --git a/components/modules/Kconfig b/components/modules/Kconfig index d4f57f8abc..28624e1814 100644 --- a/components/modules/Kconfig +++ b/components/modules/Kconfig @@ -1,274 +1,229 @@ menu "NodeMCU modules" -menu "Core Lua modules" - -config LUA_BUILTIN_STRING - bool "String module" - default "y" - help - Includes the string module (recommended). - -config LUA_BUILTIN_TABLE - bool "Table module" - default "y" - help - Includes the table module (recommended). - -config LUA_BUILTIN_COROUTINE - bool "Coroutine module" - default "y" - help - Includes the coroutine module (recommended). - -config LUA_BUILTIN_MATH - bool "Math module" - default "y" - help - Includes the math module (recommended). - -config LUA_BUILTIN_DEBUG - bool "Debug module" - default "n" - help - Includes the debug module. - -config LUA_BUILTIN_DEBUG_EXTENDED -depends on LUA_BUILTIN_DEBUG - bool "Extended debug support" - default "n" - help - Includes the full debug module, rather than just getregistry and traceback. - -config LUA_BUILTIN_DEBUG_MINIMAL -depends on LUA_BUILTIN_DEBUG - bool - default !LUA_BUILTIN_DEBUG_EXTENDED - -endmenu - - -config NODEMCU_CMODULE_ADC - bool "ADC module" - default "n" - help - Includes the adc module. This module provides access to the - adc1 hardware. - -config NODEMCU_CMODULE_BIT - bool "Bit module" - default "n" - help - Includes the bit module. This module provide bit manipulation functions - on Lua numbers. - -config NODEMCU_CMODULE_BTHCI - bool "BlueTooth HCI interface module" - default "n" - select BT_ENABLED - help - Includes the simple BlueTooth HCI module. - -config NODEMCU_CMODULE_CAN - bool "CAN module" - default "n" - help - Includes the can module. - -config NODEMCU_CMODULE_CRYPTO - bool "Crypto module" - default "n" - help - Includes the crypto module. - -config NODEMCU_CMODULE_DAC - bool "DAC module" - default "n" - help - Includes the dac module. - -config NODEMCU_CMODULE_DHT - bool "DHT11/21/22/AM2301/AM2302 module" - default "n" - help - Includes the dht module. - -config NODEMCU_CMODULE_ENCODER - bool "Encoder module" - default "n" - help - Includes the encoder module. This provides hex and base64 encoding and - decoding functionality. - -config NODEMCU_CMODULE_ETH - bool "Ethernet module" - default "n" - help - Includes the ethernet module. - -config NODEMCU_CMODULE_FILE - bool "File module" - default "y" - help - Includes the file module (recommended). - -config NODEMCU_CMODULE_GPIO - bool "GPIO module" - default "y" - help - Includes the GPIO module (recommended). - -config NODEMCU_CMODULE_HTTP - bool "HTTP module" - default "y" - help - Includes the HTTP module (recommended). - -config NODEMCU_CMODULE_I2C - bool "I2C module" - default "y" - help - Includes the I2C module (recommended). - -config NODEMCU_CMODULE_I2S - bool "I2S module" - default "n" - help - Includes the I2S module. - -config NODEMCU_CMODULE_LEDC - bool "LEDC module" - default "n" - help - Includes the LEDC module. - -config NODEMCU_CMODULE_MQTT - bool "MQTT module" - default "n" - help - Includes the MQTT module. - -config NODEMCU_CMODULE_NET - bool "Net module" - default "y" - help - Includes the net module (recommended). - -config NODEMCU_CMODULE_NODE - bool "Node module" - default "y" - help - Includes the node module (recommended). - -config NODEMCU_CMODULE_OW - bool "1-Wire module" - default "y" - help - Includes the 1-Wire (ow) module (recommended). - -config NODEMCU_CMODULE_OTAUPGRADE - bool "Over-The-Air upgrade module" - default "n" - help - Includes the over-the-air firmware upgrade module. Use of this requires - a partition table with at least two OTA partitions, plus the OTA data - partition. See the IDF documentation for details. - -config NODEMCU_CMODULE_PULSECNT - bool "Pulse counter module" - default "n" - help - Includes the pulse counter module to use ESP32's built-in pulse counting hardware. - -config NODEMCU_CMODULE_QRCODEGEN - bool "QR Code Generator module" - default "n" - help - Includes the QR Code Generator from - https://www.nayuki.io/page/qr-code-generator-library - -config NODEMCU_CMODULE_SDMMC - bool "SD-MMC module" - default "n" - help - Includes the sdmmc module. - -config NODEMCU_CMODULE_SIGMA_DELTA - bool "Sigma-Delta module" - default "n" - help - Includes the sigma_delta module. This module provides access to the - sigma-delta hardware. - -config NODEMCU_CMODULE_SJSON - bool "SJSON module" - default "n" - help - Includes the sjson module. - -config NODEMCU_CMODULE_SODIUM - bool "Sodium module" - default "n" - help - Includes the libsodium crypto module. - -config NODEMCU_CMODULE_SPI - bool "SPI module" - default "n" - help - Includes the spi module. - -config NODEMCU_CMODULE_STRUCT - bool "Struct module" - default "n" - help - Includes the struct module. This module provides [un]packing of raw - byte strings into Lua values and vice versa. - -config NODEMCU_CMODULE_TMR - bool "Timer module" - default "y" - help - Includes the timer module (recommended). - -config NODEMCU_CMODULE_TOUCH - bool "Touch module" - default "n" - help - Includes the touch module to use ESP32's built-in touch sensor hardware. - -config NODEMCU_CMODULE_U8G2 - bool "U8G2 module" - default "n" - help - Includes the u8g2 module. - -source "$PROJECT_PATH/components/u8g2/u8g2.kconfig" - -config NODEMCU_CMODULE_UCG - bool "UCG module" - default "n" - select NODEMCU_CMODULE_SPI - help - Includes the ucg module. - -source "$PROJECT_PATH/components/ucg/ucg.kconfig" - -config NODEMCU_CMODULE_WIFI - bool "WiFi module" - default "y" - help - Includes the WiFi module (recommended). - -config NODEMCU_CMODULE_WS2812 - bool "WS2812 module" - default "n" - help - Includes the ws2812 module. - -config NODEMCU_CMODULE_TIME - bool "Time module" - default "n" - help - Includes the time module. + config NODEMCU_CMODULE_ADC + bool "ADC module" + default "n" + help + Includes the adc module. This module provides access to the + adc1 hardware. + + config NODEMCU_CMODULE_BIT + bool "Bit module" + default "n" + help + Includes the bit module. This module provide bit manipulation + functions on Lua numbers. + + config NODEMCU_CMODULE_BTHCI + bool "BlueTooth HCI interface module" + default "n" + select BT_ENABLED + help + Includes the simple BlueTooth HCI module. + + config NODEMCU_CMODULE_CAN + bool "CAN module" + default "n" + help + Includes the can module. + + config NODEMCU_CMODULE_CRYPTO + bool "Crypto module" + default "n" + help + Includes the crypto module. + + config NODEMCU_CMODULE_DAC + bool "DAC module" + default "n" + help + Includes the dac module. + + config NODEMCU_CMODULE_DHT + bool "DHT11/21/22/AM2301/AM2302 module" + default "n" + help + Includes the dht module. + + config NODEMCU_CMODULE_ENCODER + bool "Encoder module" + default "n" + help + Includes the encoder module. This provides hex and base64 encoding + and decoding functionality. + + config NODEMCU_CMODULE_ETH + bool "Ethernet module" + default "n" + help + Includes the ethernet module. + + config NODEMCU_CMODULE_FILE + bool "File module" + default "y" + help + Includes the file module (recommended). + + config NODEMCU_CMODULE_GPIO + bool "GPIO module" + default "y" + help + Includes the GPIO module (recommended). + + config NODEMCU_CMODULE_HTTP + bool "HTTP module" + default "y" + help + Includes the HTTP module (recommended). + + config NODEMCU_CMODULE_I2C + bool "I2C module" + default "y" + help + Includes the I2C module (recommended). + + config NODEMCU_CMODULE_I2S + bool "I2S module" + default "n" + help + Includes the I2S module. + + config NODEMCU_CMODULE_LEDC + bool "LEDC module" + default "n" + help + Includes the LEDC module. + + config NODEMCU_CMODULE_MQTT + bool "MQTT module" + default "n" + help + Includes the MQTT module. + + config NODEMCU_CMODULE_NET + bool "Net module" + default "y" + help + Includes the net module (recommended). + + config NODEMCU_CMODULE_NODE + bool "Node module" + default "y" + help + Includes the node module (recommended). + + config NODEMCU_CMODULE_OW + bool "1-Wire module" + default "y" + help + Includes the 1-Wire (ow) module (recommended). + + config NODEMCU_CMODULE_OTAUPGRADE + bool "Over-The-Air upgrade module" + default "n" + help + Includes the over-the-air firmware upgrade module. Use of this + requires a partition table with at least two OTA partitions, plus + the OTA data partition. See the IDF documentation for details. + + config NODEMCU_CMODULE_PULSECNT + bool "Pulse counter module" + default "n" + help + Includes the pulse counter module to use ESP32's built-in pulse + counting hardware. + + config NODEMCU_CMODULE_QRCODEGEN + bool "QR Code Generator module" + default "n" + help + Includes the QR Code Generator from + https://www.nayuki.io/page/qr-code-generator-library + + config NODEMCU_CMODULE_SDMMC + bool "SD-MMC module" + default "n" + help + Includes the sdmmc module. + + config NODEMCU_CMODULE_SIGMA_DELTA + bool "Sigma-Delta module" + default "n" + help + Includes the sigma_delta module. This module provides access to + the sigma-delta hardware. + + config NODEMCU_CMODULE_SJSON + bool "SJSON module" + default "n" + help + Includes the sjson module. + + config NODEMCU_CMODULE_SODIUM + bool "Sodium module" + default "n" + help + Includes the libsodium crypto module. + + config NODEMCU_CMODULE_SPI + bool "SPI module" + default "n" + help + Includes the spi module. + + config NODEMCU_CMODULE_STRUCT + bool "Struct module" + default "n" + help + Includes the struct module. This module provides [un]packing of + raw byte strings into Lua values and vice versa. + + config NODEMCU_CMODULE_TMR + bool "Timer module" + default "y" + help + Includes the timer module (recommended). + + config NODEMCU_CMODULE_TOUCH + bool "Touch module" + default "n" + help + Includes the touch module to use ESP32's built-in touch sensor + hardware. + + config NODEMCU_CMODULE_U8G2 + bool "U8G2 module" + default "n" + help + Includes the u8g2 module. + + rsource "../u8g2/Kconfig.u8g2" + + config NODEMCU_CMODULE_UCG + bool "UCG module" + default "n" + select NODEMCU_CMODULE_SPI + help + Includes the ucg module. + + rsource "../ucg/Kconfig.ucg" + + config NODEMCU_CMODULE_WIFI + bool "WiFi module" + default "y" + help + Includes the WiFi module (recommended). + + config NODEMCU_CMODULE_WS2812 + bool "WS2812 module" + default "n" + help + Includes the ws2812 module. + + config NODEMCU_CMODULE_TIME + bool "Time module" + default "n" + help + Includes the time module. endmenu diff --git a/components/modules/component.mk b/components/modules/component.mk deleted file mode 100644 index 90abe6980b..0000000000 --- a/components/modules/component.mk +++ /dev/null @@ -1,38 +0,0 @@ -# Match up all the module source files with their corresponding Kconfig -# option in the form NODEMCU_CMODULE_ and if enabled, add a -# "-u _module_selected1" option to force the linker to include -# the module. See components/core/include/module.h for further details on -# how this works. --include $(PROJECT_PATH)/build/include/config/auto.conf -include $(PROJECT_PATH)/components/modules/uppercase.mk - -ifneq (4.0, $(firstword $(sort $(MAKE_VERSION) 4.0))) - # make versions below 4.0 will fail on the uppercase function used in - # the exapnsion of MODULE_NAMES. - $(error GNU make version 4.0 or above required) -endif - -MODULE_NAMES:=$(call uppercase,$(patsubst $(COMPONENT_PATH)/%.c,%,$(wildcard $(COMPONENT_PATH)/*.c))) -FORCE_LINK:=$(foreach mod,$(MODULE_NAMES),$(if $(CONFIG_NODEMCU_CMODULE_$(mod)), -u $(mod)_module_selected1)) -COMPONENT_ADD_LDFLAGS=$(FORCE_LINK) -lmodules $(if $(CONFIG_NODEMCU_CMODULE_BTHCI),-lbtdm_app) - -# These are disabled by default in the IDF, so switch them back on -CFLAGS += \ - -Werror=unused-function \ - -Werror=unused-but-set-variable \ - -Werror=unused-variable \ - -COMPONENT_EXTRA_CLEAN := u8g2_fonts.h u8g2_displays.h ucg_config.h - -u8g2.o: u8g2_fonts.h u8g2_displays.h - -u8g2_fonts.h: $(BUILD_DIR_BASE)/include/sdkconfig.h - perl -w $(PROJECT_PATH)/tools/u8g2_config_fonts.pl < $^ > $@ - -u8g2_displays.h: $(BUILD_DIR_BASE)/include/sdkconfig.h - perl -w $(PROJECT_PATH)/tools/u8g2_config_displays.pl < $^ > $@ - -ucg.o: ucg_config.h - -ucg_config.h: $(BUILD_DIR_BASE)/include/sdkconfig.h - perl -w $(PROJECT_PATH)/tools/ucg_config.pl < $^ > $@ diff --git a/components/modules/file.c b/components/modules/file.c index 0a257f5e81..b96a7e5da9 100644 --- a/components/modules/file.c +++ b/components/modules/file.c @@ -147,7 +147,7 @@ static int file_obj_free( lua_State *L ) return 0; } -#ifdef CONFIG_BUILD_SPIFFS +#ifdef CONFIG_NODEMCU_BUILD_SPIFFS // Lua: format() static int file_format( lua_State* L ) { @@ -187,7 +187,7 @@ static int file_open( lua_State* L ) const char *fname = luaL_checklstring( L, 1, &len ); const char *basename = vfs_basename( fname ); - luaL_argcheck(L, strlen(basename) <= CONFIG_FS_OBJ_NAME_LEN && strlen(fname) == len, 1, "filename invalid"); + luaL_argcheck(L, strlen(basename) <= CONFIG_NODEMCU_FS_OBJ_NAME_LEN && strlen(fname) == len, 1, "filename invalid"); const char *mode = luaL_optstring(L, 2, "r"); @@ -265,7 +265,7 @@ static int file_exists( lua_State* L ) size_t len; const char *fname = luaL_checklstring( L, 1, &len ); const char *basename = vfs_basename( fname ); - luaL_argcheck(L, strlen(basename) <= CONFIG_FS_OBJ_NAME_LEN && strlen(fname) == len, 1, "filename invalid"); + luaL_argcheck(L, strlen(basename) <= CONFIG_NODEMCU_FS_OBJ_NAME_LEN && strlen(fname) == len, 1, "filename invalid"); struct vfs_stat stat; lua_pushboolean(L, vfs_stat((char *)fname, &stat) == VFS_RES_OK ? 1 : 0); @@ -279,7 +279,7 @@ static int file_remove( lua_State* L ) size_t len; const char *fname = luaL_checklstring( L, 1, &len ); const char *basename = vfs_basename( fname ); - luaL_argcheck(L, strlen(basename) <= CONFIG_FS_OBJ_NAME_LEN && strlen(fname) == len, 1, "filename invalid"); + luaL_argcheck(L, strlen(basename) <= CONFIG_NODEMCU_FS_OBJ_NAME_LEN && strlen(fname) == len, 1, "filename invalid"); vfs_remove((char *)fname); return 0; } @@ -305,11 +305,11 @@ static int file_rename( lua_State* L ) const char *oldname = luaL_checklstring( L, 1, &len ); const char *basename = vfs_basename( oldname ); - luaL_argcheck(L, strlen(basename) <= CONFIG_FS_OBJ_NAME_LEN && strlen(oldname) == len, 1, "filename invalid"); + luaL_argcheck(L, strlen(basename) <= CONFIG_NODEMCU_FS_OBJ_NAME_LEN && strlen(oldname) == len, 1, "filename invalid"); const char *newname = luaL_checklstring( L, 2, &len ); basename = vfs_basename( newname ); - luaL_argcheck(L, strlen(basename) <= CONFIG_FS_OBJ_NAME_LEN && strlen(newname) == len, 2, "filename invalid"); + luaL_argcheck(L, strlen(basename) <= CONFIG_NODEMCU_FS_OBJ_NAME_LEN && strlen(newname) == len, 2, "filename invalid"); if(0 <= vfs_rename( oldname, newname )){ lua_pushboolean(L, 1); @@ -324,7 +324,7 @@ static int file_stat( lua_State* L ) { size_t len; const char *fname = luaL_checklstring( L, 1, &len ); - luaL_argcheck( L, strlen(fname) <= CONFIG_FS_OBJ_NAME_LEN && strlen(fname) == len, 1, "filename invalid" ); + luaL_argcheck( L, strlen(fname) <= CONFIG_NODEMCU_FS_OBJ_NAME_LEN && strlen(fname) == len, 1, "filename invalid" ); struct vfs_stat stat; if (vfs_stat( (char *)fname, &stat ) != VFS_RES_OK) { @@ -539,7 +539,7 @@ typedef struct { vfs_vol *vol; } volume_type; -#ifdef CONFIG_BUILD_FATFS +#ifdef CONFIG_NODEMCU_BUILD_FATFS // Lua: success = file.chdir("/SD0/") static int file_chdir( lua_State *L ) { @@ -571,7 +571,7 @@ LROT_BEGIN(file) LROT_FUNCENTRY( writeline, file_writeline ) LROT_FUNCENTRY( read, file_read ) LROT_FUNCENTRY( readline, file_readline ) -#ifdef CONFIG_BUILD_SPIFFS +#ifdef CONFIG_NODEMCU_BUILD_SPIFFS LROT_FUNCENTRY( format, file_format ) LROT_FUNCENTRY( fscfg, file_fscfg ) #endif @@ -583,7 +583,7 @@ LROT_BEGIN(file) LROT_FUNCENTRY( fsinfo, file_fsinfo ) LROT_FUNCENTRY( on, file_on ) LROT_FUNCENTRY( stat, file_stat ) -#ifdef CONFIG_BUILD_FATFS +#ifdef CONFIG_NODEMCU_BUILD_FATFS LROT_FUNCENTRY( chdir, file_chdir ) #endif LROT_END(file, NULL, 0) diff --git a/components/modules/i2s.c b/components/modules/i2s.c index d0e95e044c..2add4080e0 100644 --- a/components/modules/i2s.c +++ b/components/modules/i2s.c @@ -198,8 +198,8 @@ static int node_i2s_start( lua_State *L ) if (i2s_config.mode & I2S_MODE_TX) { // prepare TX task - char pcName[8]; - snprintf( pcName, 8, "I2S_tx_%d", i2s_id ); + char pcName[20]; + snprintf( pcName, sizeof(pcName), "I2S_tx_%d", i2s_id ); pcName[7] = '\0'; if ((is->tx.queue = xQueueCreate( 2, sizeof( i2s_tx_data_t ) )) == NULL) return luaL_error( L, "cannot create queue" ); @@ -208,8 +208,8 @@ static int node_i2s_start( lua_State *L ) if (i2s_config.mode & I2S_MODE_RX) { // prepare RX task - char pcName[8]; - snprintf( pcName, 8, "I2S_rx_%d", i2s_id ); + char pcName[20]; + snprintf( pcName, sizeof(pcName), "I2S_rx_%d", i2s_id ); pcName[7] = '\0'; xTaskCreate(task_I2S_rx, pcName, 1024, (void *)i2s_id, ESP_TASK_MAIN_PRIO + 1, &is->rx.taskHandle); } diff --git a/components/modules/net.c b/components/modules/net.c index 4e694d5246..e22be33340 100644 --- a/components/modules/net.c +++ b/components/modules/net.c @@ -150,8 +150,6 @@ typedef struct lnet_userdata { int cb_sent_ref; // Only for TCP: bool connecting; - int hold; - size_t num_held; size_t num_send; int cb_connect_ref; int cb_disconnect_ref; @@ -250,8 +248,6 @@ lnet_userdata *net_create( lua_State *L, enum net_type type ) { ud->client.cb_connect_ref = LUA_NOREF; ud->client.cb_reconnect_ref = LUA_NOREF; ud->client.cb_disconnect_ref = LUA_NOREF; - ud->client.hold = 0; - ud->client.num_held = 0; ud->client.connecting = false; case TYPE_UDP_SOCKET: ud->client.wait_dns = 0; @@ -497,7 +493,6 @@ static int net_listen( lua_State *L ) { if (!ud->netconn) return luaL_error(L, "cannot allocate netconn"); netconn_set_nonblocking(ud->netconn, 1); - netconn_set_noautorecved(ud->netconn, 1); err = netconn_bind(ud->netconn, &addr, port); if (err == ERR_OK) { @@ -509,7 +504,6 @@ static int net_listen( lua_State *L ) { if (!ud->netconn) return luaL_error(L, "cannot allocate netconn"); netconn_set_nonblocking(ud->netconn, 1); - netconn_set_noautorecved(ud->netconn, 1); err = netconn_bind(ud->netconn, &addr, port); break; @@ -557,7 +551,6 @@ static int net_connect( lua_State *L ) { if (!ud->netconn) return luaL_error(L, "cannot allocate netconn"); netconn_set_nonblocking(ud->netconn, 1); - netconn_set_noautorecved(ud->netconn, 1); ud->port = port; return lnet_socket_resolve_dns(L, ud, domain, true); @@ -680,39 +673,6 @@ static int net_send( lua_State *L ) { return lwip_lua_checkerr(L, err); } -// Lua: client:hold() -static int net_hold( lua_State *L ) { - lnet_userdata *ud = net_get_udata(L); - if (!ud || ud->type != TYPE_TCP_CLIENT) - return luaL_error(L, "invalid user data"); - if (!ud->client.hold && ud->netconn) - { - if (ud->client.hold == 0) - { - ud->client.hold = 1; - ud->client.num_held = 0; - } - } - return 0; -} - -// Lua: client:unhold() -static int net_unhold( lua_State *L ) { - lnet_userdata *ud = net_get_udata(L); - if (!ud || ud->type != TYPE_TCP_CLIENT) - return luaL_error(L, "invalid user data"); - if (ud->client.hold && ud->netconn) - { - if (ud->client.hold != 0) - { - ud->client.hold = 0; - netconn_recved(ud->netconn, ud->client.num_held); - ud->client.num_held = 0; - } - } - return 0; -} - // Lua: client/socket:dns(domain, callback(socket, addr)) static int net_dns( lua_State *L ) { lnet_userdata *ud = net_get_udata(L); @@ -1082,17 +1042,8 @@ static void lrecv_cb (lua_State *L, lnet_userdata *ud) { } } while (netbuf_next(p) != -1); - if (p) { + if (p) netbuf_delete(p); - - if (ud->type == TYPE_TCP_CLIENT) { - if (ud->client.hold) { - ud->client.num_held += len; - } else { - netconn_recved(ud->netconn, len); - } - } - } } @@ -1110,7 +1061,6 @@ static void laccept_cb (lua_State *L, lnet_userdata *ud) { if (err == ERR_OK) { nud->netconn = newconn; netconn_set_nonblocking(nud->netconn, 1); - netconn_set_noautorecved(nud->netconn, 1); nud->netconn->pcb.tcp->so_options |= SOF_KEEPALIVE; nud->netconn->pcb.tcp->keep_idle = ud->server.timeout * 1000; nud->netconn->pcb.tcp->keep_cnt = 1; @@ -1168,8 +1118,6 @@ LROT_BEGIN(net_tcpsocket) LROT_FUNCENTRY( close, net_close ) LROT_FUNCENTRY( on, net_on ) LROT_FUNCENTRY( send, net_send ) - LROT_FUNCENTRY( hold, net_hold ) - LROT_FUNCENTRY( unhold, net_unhold ) LROT_FUNCENTRY( dns, net_dns ) LROT_FUNCENTRY( getpeer, net_getpeer ) LROT_FUNCENTRY( getaddr, net_getaddr ) diff --git a/components/modules/node.c b/components/modules/node.c index 43e372eeed..af68d1d17d 100644 --- a/components/modules/node.c +++ b/components/modules/node.c @@ -560,7 +560,7 @@ static int node_compile( lua_State* L ) size_t len; const char *fname = luaL_checklstring( L, 1, &len ); const char *basename = vfs_basename( fname ); - luaL_argcheck(L, strlen(basename) <= CONFIG_FS_OBJ_NAME_LEN && strlen(fname) == len, 1, "filename invalid"); + luaL_argcheck(L, strlen(basename) <= CONFIG_NODEMCU_FS_OBJ_NAME_LEN && strlen(fname) == len, 1, "filename invalid"); char *output = luaM_malloc( L, len+1 ); strcpy(output, fname); diff --git a/components/modules/time.c b/components/modules/time.c index 9559269f52..cc7acd4d6a 100644 --- a/components/modules/time.c +++ b/components/modules/time.c @@ -13,7 +13,7 @@ lua_pushinteger (L, val); \ lua_setfield (L, -2, key); -void inline time_tmToTable(lua_State *L, struct tm *date) +static void inline time_tmToTable(lua_State *L, struct tm *date) { lua_createtable (L, 0, 9); diff --git a/components/modules/touch.c b/components/modules/touch.c index b37d64af11..9e8afdbece 100644 --- a/components/modules/touch.c +++ b/components/modules/touch.c @@ -27,7 +27,7 @@ CONDITIONS OF ANY KIND, either express or implied. #include "esp_log.h" #include "lextra.h" #include "soc/rtc_periph.h" -#include "soc/touch_channel.h" +#include "soc/touch_sensor_periph.h" #include diff --git a/components/platform/CMakeLists.txt b/components/platform/CMakeLists.txt new file mode 100644 index 0000000000..f25d804342 --- /dev/null +++ b/components/platform/CMakeLists.txt @@ -0,0 +1,8 @@ +idf_component_register( + SRCS "dht.c" "flash_api.c" "flash_fs.c" "onewire.c" "platform.c" + "platform_flash.c" "platform_partition.c" "platform_rmt.c" + "u8x8_nodemcu_hal.c" "ucg_nodemcu_hal.c" "vfs.c" "wdt.c" "ws2812.c" + INCLUDE_DIRS "include" + REQUIRES "spiffs" "u8g2" "ucg" "driver_i2c" + PRIV_REQUIRES "bootloader_support" "driver_console" "lua" "esp32" +) diff --git a/components/platform/Kconfig b/components/platform/Kconfig index d62b03f28c..103fd527e6 100644 --- a/components/platform/Kconfig +++ b/components/platform/Kconfig @@ -1,144 +1,145 @@ -menu "Platform config" - -choice CONSOLE_BIT_RATE - prompt "UART console default bit rate" - default CONSOLE_BIT_RATE_115200 - help - Configure the default bit rate for the UART console. - - The resulting UART setting will be xxx-8N1, where xxx represents the - chosen bit rate. -config CONSOLE_BIT_RATE_300 - bool "300" -config CONSOLE_BIT_RATE_600 - bool "600" -config CONSOLE_BIT_RATE_1200 - bool "1200" -config CONSOLE_BIT_RATE_2400 - bool "2400" -config CONSOLE_BIT_RATE_4800 - bool "4800" -config CONSOLE_BIT_RATE_9600 - bool "9600" -config CONSOLE_BIT_RATE_19200 - bool "19200" -config CONSOLE_BIT_RATE_38400 - bool "38400" -config CONSOLE_BIT_RATE_57600 - bool "57600" -config CONSOLE_BIT_RATE_74880 - bool "74880" -config CONSOLE_BIT_RATE_115200 - bool "115200" -config CONSOLE_BIT_RATE_230400 - bool "230400" -config CONSOLE_BIT_RATE_460800 - bool "460800" -config CONSOLE_BIT_RATE_921600 - bool "921600" -config CONSOLE_BIT_RATE_1843200 - bool "1843200" -config CONSOLE_BIT_RATE_3683400 - bool "3683400" -endchoice - -config CONSOLE_BIT_RATE - int - default 300 if CONSOLE_BIT_RATE_300 - default 600 if CONSOLE_BIT_RATE_600 - default 1200 if CONSOLE_BIT_RATE_1200 - default 2400 if CONSOLE_BIT_RATE_2400 - default 4800 if CONSOLE_BIT_RATE_4800 - default 9600 if CONSOLE_BIT_RATE_9600 - default 19200 if CONSOLE_BIT_RATE_19200 - default 38400 if CONSOLE_BIT_RATE_38400 - default 57600 if CONSOLE_BIT_RATE_57600 - default 74880 if CONSOLE_BIT_RATE_74880 - default 115200 if CONSOLE_BIT_RATE_115200 - default 230400 if CONSOLE_BIT_RATE_230400 - default 460800 if CONSOLE_BIT_RATE_460800 - default 921600 if CONSOLE_BIT_RATE_921600 - default 1843200 if CONSOLE_BIT_RATE_1843200 - default 3683400 if CONSOLE_BIT_RATE_3683400 - -config CONSOLE_BIT_RATE_AUTO - bool "UART console auto-baud detection" - default "y" - help - Enables auto-baud detection for the UART console. - - By typing a few characters into the console shortly after boot, - NodeMCU can automatically detect your terminal settings and - adjust accordingly. - - If you are doing advanced things with the console, you may want - to disable this feature. - -config NODE_DEBUG - bool "Enable NODE_DBG() output" - default "n" - help - Enable debugging output via NODE_DBG(). This is VERY chatty. - For development/debugging use only. - -config NODE_ERR - bool "Enable NODE_ERR() output" - default "y" - help - Enable error reporting via NODE_ERR(). - - It is recommended to leave this enabled - if it ever produces output, - something has gone seriously wrong and you probably want to know about - it. - -config FS_OBJ_NAME_LEN - int "Make filesystem object name length" - default 31 - help - Maximum name of filesystem objects (files, directories). - -config SPIFFS_MAX_OPEN_FILES - int "Maximum number of open files for SPIFFS" - default 4 - help - Maximum number of open files for SPIFFS - -# I don't think we can deal without SPIFFS at this point, so always on for now -config BUILD_SPIFFS - bool - default "y" - -config LUA_EMBED_LFS - bool "Embed LFS as part of the NodeMCU firmware" - default "n" - help - The LFS (Lua Flash Store) normally has its own partition entry, and can - can be replaced at will. Optionally, the LFS can instead be permanently - embedded into the NodeMCU firmware image itself. This can be useful for - scenarios where over-the-air firmware upgrades are needed to also - bundle Lua code. The major downside is that once embedded, the LFS can - no longer be changed, as doing so would break the firmware checksums - and signatures and leave the system unable to boot. - - The default option is to not embed the LFS, in which case LFS is - looked for in a partition of type 0xC2 and subtype 0x01. - - To embed LFS data into firmware, use: - ./tools/embed_lfs.sh /path/to/file1.lua /path/to/file2.lua ... - -config LUA_EMBEDDED_FLASH_STORE - hex "Embedded LUA Flash Store size" - default 0x0 - depends on LUA_EMBED_LFS - help - Embedded LUA Flash Store size. Set to zero to use an LFS partition instead - of embedding the LFS within the NodeMCU firmware itself. - -config BUILD_FATFS - bool "Support for FAT filesystems" - default "n" - select NODEMCU_CMODULE_SDMMC - help - Include support for accessing FAT filesystems on SD cards. +menu "NodeMCU platform config" + + choice NODEMCU_CONSOLE_BIT_RATE + prompt "UART console default bit rate" + default NODEMCU_CONSOLE_BIT_RATE_115200 + help + Configure the default bit rate for the UART console. + + The resulting UART setting will be xxx-8N1, where xxx represents + the chosen bit rate. + config NODEMCU_CONSOLE_BIT_RATE_300 + bool "300" + config NODEMCU_CONSOLE_BIT_RATE_600 + bool "600" + config NODEMCU_CONSOLE_BIT_RATE_1200 + bool "1200" + config NODEMCU_CONSOLE_BIT_RATE_2400 + bool "2400" + config NODEMCU_CONSOLE_BIT_RATE_4800 + bool "4800" + config NODEMCU_CONSOLE_BIT_RATE_9600 + bool "9600" + config NODEMCU_CONSOLE_BIT_RATE_19200 + bool "19200" + config NODEMCU_CONSOLE_BIT_RATE_38400 + bool "38400" + config NODEMCU_CONSOLE_BIT_RATE_57600 + bool "57600" + config NODEMCU_CONSOLE_BIT_RATE_74880 + bool "74880" + config NODEMCU_CONSOLE_BIT_RATE_115200 + bool "115200" + config NODEMCU_CONSOLE_BIT_RATE_230400 + bool "230400" + config NODEMCU_CONSOLE_BIT_RATE_460800 + bool "460800" + config NODEMCU_CONSOLE_BIT_RATE_921600 + bool "921600" + config NODEMCU_CONSOLE_BIT_RATE_1843200 + bool "1843200" + config NODEMCU_CONSOLE_BIT_RATE_3683400 + bool "3683400" + endchoice + + config NODEMCU_CONSOLE_BIT_RATE + int + default 300 if NODEMCU_CONSOLE_BIT_RATE_300 + default 600 if NODEMCU_CONSOLE_BIT_RATE_600 + default 1200 if NODEMCU_CONSOLE_BIT_RATE_1200 + default 2400 if NODEMCU_CONSOLE_BIT_RATE_2400 + default 4800 if NODEMCU_CONSOLE_BIT_RATE_4800 + default 9600 if NODEMCU_CONSOLE_BIT_RATE_9600 + default 19200 if NODEMCU_CONSOLE_BIT_RATE_19200 + default 38400 if NODEMCU_CONSOLE_BIT_RATE_38400 + default 57600 if NODEMCU_CONSOLE_BIT_RATE_57600 + default 74880 if NODEMCU_CONSOLE_BIT_RATE_74880 + default 115200 if NODEMCU_CONSOLE_BIT_RATE_115200 + default 230400 if NODEMCU_CONSOLE_BIT_RATE_230400 + default 460800 if NODEMCU_CONSOLE_BIT_RATE_460800 + default 921600 if NODEMCU_CONSOLE_BIT_RATE_921600 + default 1843200 if NODEMCU_CONSOLE_BIT_RATE_1843200 + default 3683400 if NODEMCU_CONSOLE_BIT_RATE_3683400 + + config NODEMCU_CONSOLE_BIT_RATE_AUTO + bool "UART console auto-baud detection" + default "y" + help + Enables auto-baud detection for the UART console. + + By typing a few characters into the console shortly after boot, + NodeMCU can automatically detect your terminal settings and + adjust accordingly. + + If you are doing advanced things with the console, you may want + to disable this feature. + + config NODEMCU_NODE_DEBUG + bool "Enable NODE_DBG() output" + default "n" + help + Enable debugging output via NODE_DBG(). This is VERY chatty. + For development/debugging use only. + + config NODEMCU_NODE_ERR + bool "Enable NODE_ERR() output" + default "y" + help + Enable error reporting via NODE_ERR(). + + It is recommended to leave this enabled - if it ever produces + output, something has gone seriously wrong and you probably want + to know about it. + + config NODEMCU_FS_OBJ_NAME_LEN + int "Make filesystem object name length" + default 31 + help + Maximum name of filesystem objects (files, directories). + + config NODEMCU_SPIFFS_MAX_OPEN_FILES + int "Maximum number of open files for SPIFFS" + default 4 + help + Maximum number of open files for SPIFFS + + config NODEMCU_BUILD_SPIFFS + bool + default "y" + # I don't think we can deal without SPIFFS at this point, so always on for now + + config NODEMCU_BUILD_FATFS + bool "Support for FAT filesystems" + default "n" + select NODEMCU_CMODULE_SDMMC + help + Include support for accessing FAT filesystems on SD cards. + + config NODEMCU_EMBED_LFS + bool "Embed LFS as part of the NodeMCU firmware" + default "n" + help + The LFS (Lua Flash Store) normally has its own partition entry, + and can can be replaced at will. Optionally, the LFS can instead + be permanently embedded into the NodeMCU firmware image itself. + This can be useful for scenarios where over-the-air firmware + upgrades are needed to also bundle Lua code. The major downside + is that once embedded, the LFS can no longer be changed, as + doing so would break the firmware checksums and signatures and + leave the system unable to boot. + + The default option is to not embed the LFS, in which case LFS is + looked for in a partition of type 0xC2 and subtype 0x01. + + To embed LFS data into firmware, use: + ./tools/embed_lfs.sh /path/to/file1.lua /path/to/file2.lua ... + + config NODEMCU_EMBEDDED_LFS_SIZE + hex "Embedded LUA Flash Store size" + default 0x0 + depends on NODEMCU_EMBED_LFS + help + Embedded LUA Flash Store size. Set to zero to use an LFS partition + instead of embedding the LFS within the NodeMCU firmware itself. endmenu diff --git a/components/platform/component.mk b/components/platform/component.mk deleted file mode 100644 index af50e2c41d..0000000000 --- a/components/platform/component.mk +++ /dev/null @@ -1,5 +0,0 @@ -COMPONENT_ADD_INCLUDEDIRS:=include -# for u8x8 -CPPFLAGS+=-DU8X8_USE_PINS -DU8X8_WITH_USER_PTR -# for ucg -CPPFLAGS+=-DUSE_PIN_LIST diff --git a/components/platform/flash_api.c b/components/platform/flash_api.c index 2526074684..12b2a3f247 100644 --- a/components/platform/flash_api.c +++ b/components/platform/flash_api.c @@ -7,7 +7,7 @@ #include #include #include -#include "rom/spi_flash.h" +#include "esp32/rom/spi_flash.h" #include "platform_wdt.h" diff --git a/components/platform/include/platform.h b/components/platform/include/platform.h index f75456b2f9..714d10d11a 100644 --- a/components/platform/include/platform.h +++ b/components/platform/include/platform.h @@ -23,13 +23,13 @@ enum }; -#if CONFIG_NODE_DEBUG +#if CONFIG_NODEMCU_NODE_DEBUG # define NODE_DBG printf #else # define NODE_DBG(...) do{}while(0) #endif -#if CONFIG_NODE_ERR +#if CONFIG_NODEMCU_NODE_ERR # define NODE_ERR printf #else # define NODE_ERR(...) do{}while(0) diff --git a/components/platform/include/vfs.h b/components/platform/include/vfs.h index 9200143ac7..a959eff0ca 100644 --- a/components/platform/include/vfs.h +++ b/components/platform/include/vfs.h @@ -18,7 +18,7 @@ // vfs_close - close file descriptor and free memory // fd: file descriptor // Returns: VFS_RES_OK or negative value in case of error -inline int32_t vfs_close( int fd ) { +static inline int32_t vfs_close( int fd ) { vfs_file *f = (vfs_file *)fd; return f ? f->fns->close( f ) : VFS_RES_ERR; } @@ -28,7 +28,7 @@ inline int32_t vfs_close( int fd ) { // ptr: destination data buffer // len: requested length // Returns: Number of bytes read, or VFS_RES_ERR in case of error -inline int32_t vfs_read( int fd, void *ptr, size_t len ) { +static inline int32_t vfs_read( int fd, void *ptr, size_t len ) { vfs_file *f = (vfs_file *)fd; return f ? f->fns->read( f, ptr, len ) : VFS_RES_ERR; } @@ -38,7 +38,7 @@ inline int32_t vfs_read( int fd, void *ptr, size_t len ) { // ptr: source data buffer // len: requested length // Returns: Number of bytes written, or VFS_RES_ERR in case of error -inline int32_t vfs_write( int fd, const void *ptr, size_t len ) { +static inline int32_t vfs_write( int fd, const void *ptr, size_t len ) { vfs_file *f = (vfs_file *)fd; return f ? f->fns->write( f, ptr, len ) : VFS_RES_ERR; } @@ -54,7 +54,7 @@ int vfs_ungetc( int c, int fd ); // VFS_SEEK_CUR - set pointer to current position + off // VFS_SEEK_END - set pointer to end of file + off // Returns: New position, or VFS_RES_ERR in case of error -inline int32_t vfs_lseek( int fd, int32_t off, int whence ) { +static inline int32_t vfs_lseek( int fd, int32_t off, int whence ) { vfs_file *f = (vfs_file *)fd; return f ? f->fns->lseek( f, off, whence ) : VFS_RES_ERR; } @@ -62,7 +62,7 @@ inline int32_t vfs_lseek( int fd, int32_t off, int whence ) { // vfs_eof - test for end-of-file // fd: file descriptor // Returns: 0 if not at end, != 0 if end of file -inline int32_t vfs_eof( int fd ) { +static inline int32_t vfs_eof( int fd ) { vfs_file *f = (vfs_file *)fd; return f ? f->fns->eof( f ) : VFS_RES_ERR; } @@ -70,7 +70,7 @@ inline int32_t vfs_eof( int fd ) { // vfs_tell - get read/write position // fd: file descriptor // Returns: Current position -inline int32_t vfs_tell( int fd ) { +static inline int32_t vfs_tell( int fd ) { vfs_file *f = (vfs_file *)fd; return f ? f->fns->tell( f ) : VFS_RES_ERR; } @@ -78,7 +78,7 @@ inline int32_t vfs_tell( int fd ) { // vfs_flush - flush write cache to file // fd: file descriptor // Returns: VFS_RES_OK, or VFS_RES_ERR in case of error -inline int32_t vfs_flush( int fd ) { +static inline int32_t vfs_flush( int fd ) { vfs_file *f = (vfs_file *)fd; return f ? f->fns->flush( f ) : VFS_RES_ERR; } @@ -86,7 +86,7 @@ inline int32_t vfs_flush( int fd ) { // vfs_size - get current file size // fd: file descriptor // Returns: File size -inline uint32_t vfs_size( int fd ) { +static inline uint32_t vfs_size( int fd ) { vfs_file *f = (vfs_file *)fd; return f ? f->fns->size( f ) : 0; } @@ -103,13 +103,13 @@ int32_t vfs_ferrno( int fd ); // vfs_closedir - close directory descriptor and free memory // dd: dir descriptor // Returns: VFS_RES_OK, or VFS_RES_ERR in case of error -inline int32_t vfs_closedir( vfs_dir *dd ) { return dd->fns->close( dd ); } +static inline int32_t vfs_closedir( vfs_dir *dd ) { return dd->fns->close( dd ); } // vfs_readdir - read next directory item // dd: dir descriptor // buf: pre-allocated stat structure to be filled in // Returns: VFS_RES_OK if next item found, otherwise VFS_RES_ERR -inline int32_t vfs_readdir( vfs_dir *dd, struct vfs_stat *buf ) { return dd->fns->readdir( dd, buf ); } +static inline int32_t vfs_readdir( vfs_dir *dd, struct vfs_stat *buf ) { return dd->fns->readdir( dd, buf ); } // --------------------------------------------------------------------------- // volume functions @@ -118,7 +118,7 @@ inline int32_t vfs_readdir( vfs_dir *dd, struct vfs_stat *buf ) { return dd->fns // vfs_umount - unmount logical drive and free memory // vol: volume object // Returns: VFS_RES_OK, or VFS_RES_ERR in case of error -inline int32_t vfs_umount( vfs_vol *vol ) { return vol->fns->umount( vol ); } +static inline int32_t vfs_umount( vfs_vol *vol ) { return vol->fns->umount( vol ); } // --------------------------------------------------------------------------- // file system functions diff --git a/components/platform/include/vfs_int.h b/components/platform/include/vfs_int.h index ec50fd9ac0..3c38674638 100644 --- a/components/platform/include/vfs_int.h +++ b/components/platform/include/vfs_int.h @@ -50,7 +50,7 @@ typedef const struct vfs_file vfs_file; // stat data struct vfs_stat { uint32_t size; - char name[CONFIG_FS_OBJ_NAME_LEN+1]; + char name[CONFIG_NODEMCU_FS_OBJ_NAME_LEN+1]; struct vfs_time tm; uint8_t tm_valid; uint8_t is_dir; diff --git a/components/platform/platform.c b/components/platform/platform.c index 0bd2d55a40..7475ea6ddf 100644 --- a/components/platform/platform.c +++ b/components/platform/platform.c @@ -248,10 +248,10 @@ uint32_t platform_uart_setup( unsigned id, uint32_t baud, int databits, int pari } uart_param_config(id, &cfg); uart_set_pin(id, pins->tx_pin, pins->rx_pin, pins->rts_pin, pins->cts_pin); - uart_set_line_inverse(id, (pins->tx_inverse? UART_INVERSE_TXD : UART_INVERSE_DISABLE) - | (pins->rx_inverse? UART_INVERSE_RXD : UART_INVERSE_DISABLE) - | (pins->rts_inverse? UART_INVERSE_RTS : UART_INVERSE_DISABLE) - | (pins->cts_inverse? UART_INVERSE_CTS : UART_INVERSE_DISABLE) + uart_set_line_inverse(id, (pins->tx_inverse? UART_TXD_INV_M : 0) + | (pins->rx_inverse? UART_RXD_INV_M : 0) + | (pins->rts_inverse? UART_RTS_INV_M : 0) + | (pins->cts_inverse? UART_CTS_INV_M : 0) ); if(uart_event_task_id == 0) uart_event_task_id = task_get_id( uart_event_task ); diff --git a/components/platform/platform_partition.c b/components/platform/platform_partition.c index 01b71c9b9e..46cedca618 100644 --- a/components/platform/platform_partition.c +++ b/components/platform/platform_partition.c @@ -35,7 +35,6 @@ #include #include -#include "esp_flash_data_types.h" #include "esp_flash_partitions.h" #include "esp_spi_flash.h" diff --git a/components/platform/project_include.cmake b/components/platform/project_include.cmake new file mode 100644 index 0000000000..51a1176e50 --- /dev/null +++ b/components/platform/project_include.cmake @@ -0,0 +1,3 @@ +if(DEFINED ENV{BUILD_DATE}) + idf_build_set_property(COMPILE_OPTIONS -DBUILD_DATE="$ENV{BUILD_DATE}" APPEND) +endif() diff --git a/components/platform/u8x8_nodemcu_hal.c b/components/platform/u8x8_nodemcu_hal.c index 53ed6d6b1b..3613994565 100644 --- a/components/platform/u8x8_nodemcu_hal.c +++ b/components/platform/u8x8_nodemcu_hal.c @@ -1,7 +1,7 @@ #include -#include "rom/ets_sys.h" +#include "esp32/rom/ets_sys.h" #include "driver/gpio.h" #include "driver/i2c.h" diff --git a/components/platform/vfs.c b/components/platform/vfs.c index 5ef216bb94..1102941fdf 100644 --- a/components/platform/vfs.c +++ b/components/platform/vfs.c @@ -76,13 +76,13 @@ vfs_vol *vfs_mount( const char *name, int num ) const char *normname = normalize_path( name ); char *outname; -#ifdef CONFIG_BUILD_SPIFFS +#ifdef CONFIG_NODEMCU_BUILD_SPIFFS if ((fs_fns = myspiffs_realm( normname, &outname, false ))) { return fs_fns->mount( outname, num ); } #endif -#ifdef CONFIG_BUILD_FATFS +#ifdef CONFIG_NODEMCU_BUILD_FATFS if ((fs_fns = myfatfs_realm( normname, &outname, false ))) { vfs_vol *r = fs_fns->mount( outname, num ); free( outname ); @@ -99,13 +99,13 @@ int vfs_open( const char *name, const char *mode ) const char *normname = normalize_path( name ); char *outname; -#ifdef CONFIG_BUILD_SPIFFS +#ifdef CONFIG_NODEMCU_BUILD_SPIFFS if ((fs_fns = myspiffs_realm( normname, &outname, false ))) { return (int)fs_fns->open( outname, mode ); } #endif -#ifdef CONFIG_BUILD_FATFS +#ifdef CONFIG_NODEMCU_BUILD_FATFS if ((fs_fns = myfatfs_realm( normname, &outname, false ))) { int r = (int)fs_fns->open( outname, mode ); free( outname ); @@ -122,13 +122,13 @@ vfs_dir *vfs_opendir( const char *name ) const char *normname = normalize_path( name ); char *outname; -#ifdef CONFIG_BUILD_SPIFFS +#ifdef CONFIG_NODEMCU_BUILD_SPIFFS if ((fs_fns = myspiffs_realm( normname, &outname, false ))) { return fs_fns->opendir( outname ); } #endif -#ifdef CONFIG_BUILD_FATFS +#ifdef CONFIG_NODEMCU_BUILD_FATFS if ((fs_fns = myfatfs_realm( normname, &outname, false ))) { vfs_dir *r = fs_fns->opendir( outname ); free( outname ); @@ -145,13 +145,13 @@ int32_t vfs_stat( const char *name, struct vfs_stat *buf ) const char *normname = normalize_path( name ); char *outname; -#ifdef CONFIG_BUILD_SPIFFS +#ifdef CONFIG_NODEMCU_BUILD_SPIFFS if ((fs_fns = myspiffs_realm( normname, &outname, false ))) { return fs_fns->stat( outname, buf ); } #endif -#ifdef CONFIG_BUILD_FATFS +#ifdef CONFIG_NODEMCU_BUILD_FATFS if ((fs_fns = myfatfs_realm( normname, &outname, false ))) { int32_t r = fs_fns->stat( outname, buf ); free( outname ); @@ -168,13 +168,13 @@ int32_t vfs_remove( const char *name ) const char *normname = normalize_path( name ); char *outname; -#ifdef CONFIG_BUILD_SPIFFS +#ifdef CONFIG_NODEMCU_BUILD_SPIFFS if ((fs_fns = myspiffs_realm( normname, &outname, false ))) { return fs_fns->remove( outname ); } #endif -#ifdef CONFIG_BUILD_FATFS +#ifdef CONFIG_NODEMCU_BUILD_FATFS if ((fs_fns = myfatfs_realm( normname, &outname, false ))) { int32_t r = fs_fns->remove( outname ); free( outname ); @@ -192,7 +192,7 @@ int32_t vfs_rename( const char *oldname, const char *newname ) const char *normnewname = normalize_path( newname ); char *oldoutname, *newoutname; -#ifdef CONFIG_BUILD_SPIFFS +#ifdef CONFIG_NODEMCU_BUILD_SPIFFS if (myspiffs_realm( normoldname, &oldoutname, false )) { if ((fs_fns = myspiffs_realm( normnewname, &newoutname, false ))) { return fs_fns->rename( oldoutname, newoutname ); @@ -200,7 +200,7 @@ int32_t vfs_rename( const char *oldname, const char *newname ) } #endif -#ifdef CONFIG_BUILD_FATFS +#ifdef CONFIG_NODEMCU_BUILD_FATFS if (myfatfs_realm( normoldname, &oldoutname, false )) { if ((fs_fns = myfatfs_realm( normnewname, &newoutname, false ))) { int32_t r = fs_fns->rename( oldoutname, newoutname ); @@ -219,12 +219,12 @@ int32_t vfs_mkdir( const char *name ) { vfs_fs_fns *fs_fns; -#ifdef CONFIG_BUILD_SPIFFS +#ifdef CONFIG_NODEMCU_BUILD_SPIFFS // not supported (void)fs_fns; #endif -#ifdef CONFIG_BUILD_FATFS +#ifdef CONFIG_NODEMCU_BUILD_FATFS const char *normname = normalize_path( name ); char *outname; if ((fs_fns = myfatfs_realm( normname, &outname, false ))) { @@ -246,13 +246,13 @@ int32_t vfs_fsinfo( const char *name, uint32_t *total, uint32_t *used ) const char *normname = normalize_path( name ); -#ifdef CONFIG_BUILD_SPIFFS +#ifdef CONFIG_NODEMCU_BUILD_SPIFFS if ((fs_fns = myspiffs_realm( normname, &outname, false ))) { return fs_fns->fsinfo( total, used ); } #endif -#ifdef CONFIG_BUILD_FATFS +#ifdef CONFIG_NODEMCU_BUILD_FATFS if ((fs_fns = myfatfs_realm( normname, &outname, false ))) { free( outname ); return fs_fns->fsinfo( total, used ); @@ -267,13 +267,13 @@ int32_t vfs_fscfg( const char *name, uint32_t *phys_addr, uint32_t *phys_size) vfs_fs_fns *fs_fns; char *outname; -#ifdef CONFIG_BUILD_SPIFFS +#ifdef CONFIG_NODEMCU_BUILD_SPIFFS if ((fs_fns = myspiffs_realm( "/FLASH", &outname, false ))) { return fs_fns->fscfg( phys_addr, phys_size ); } #endif -#ifdef CONFIG_BUILD_FATFS +#ifdef CONFIG_NODEMCU_BUILD_FATFS // not supported #endif @@ -286,13 +286,13 @@ int32_t vfs_format( void ) vfs_fs_fns *fs_fns; char *outname; -#ifdef CONFIG_BUILD_SPIFFS +#ifdef CONFIG_NODEMCU_BUILD_SPIFFS if ((fs_fns = myspiffs_realm( "/FLASH", &outname, false ))) { return fs_fns->format(); } #endif -#ifdef CONFIG_BUILD_FATFS +#ifdef CONFIG_NODEMCU_BUILD_FATFS // not supported #endif @@ -326,7 +326,7 @@ int32_t vfs_chdir( const char *path ) } #endif -#ifdef CONFIG_BUILD_SPIFFS +#ifdef CONFIG_NODEMCU_BUILD_SPIFFS if ((fs_fns = myspiffs_realm( normpath, &outname, true ))) { // our SPIFFS integration doesn't support directories if (strlen( outname ) == 0) { @@ -335,7 +335,7 @@ int32_t vfs_chdir( const char *path ) } #endif -#ifdef CONFIG_BUILD_FATFS +#ifdef CONFIG_NODEMCU_BUILD_FATFS if ((fs_fns = myfatfs_realm( normpath, &outname, true ))) { if (strchr( outname, ':' )) { // need to set FatFS' default drive @@ -361,13 +361,13 @@ int32_t vfs_errno( const char *name ) if (!name) name = ""; // current drive -#ifdef CONFIG_BUILD_SPIFFS +#ifdef CONFIG_NODEMCU_BUILD_SPIFFS if ((fs_fns = myspiffs_realm( normname, &outname, false ))) { return fs_fns->ferrno( ); } #endif -#ifdef CONFIG_BUILD_FATFS +#ifdef CONFIG_NODEMCU_BUILD_FATFS if ((fs_fns = myfatfs_realm( normname, &outname, false ))) { int32_t r = fs_fns->ferrno( ); free( outname ); @@ -389,13 +389,13 @@ int32_t vfs_ferrno( int fd ) const char *name = ""; // current drive char *outname; -#ifdef CONFIG_BUILD_SPIFFS +#ifdef CONFIG_NODEMCU_BUILD_SPIFFS if ((fs_fns = myspiffs_realm( name, &outname, false ))) { return fs_fns->ferrno( ); } #endif -#ifdef CONFIG_BUILD_FATFS +#ifdef CONFIG_NODEMCU_BUILD_FATFS if ((fs_fns = myfatfs_realm( name, &outname, false ))) { int32_t r = fs_fns->ferrno( ); free( outname ); @@ -416,13 +416,13 @@ void vfs_clearerr( const char *name ) const char *normname = normalize_path( name ); -#ifdef CONFIG_BUILD_SPIFFS +#ifdef CONFIG_NODEMCU_BUILD_SPIFFS if ((fs_fns = myspiffs_realm( normname, &outname, false ))) { fs_fns->clearerr( ); } #endif -#ifdef CONFIG_BUILD_FATFS +#ifdef CONFIG_NODEMCU_BUILD_FATFS if ((fs_fns = myfatfs_realm( normname, &outname, false ))) { fs_fns->clearerr( ); free( outname ); diff --git a/components/qrcodegen/CMakeLists.txt b/components/qrcodegen/CMakeLists.txt new file mode 100644 index 0000000000..e041736ece --- /dev/null +++ b/components/qrcodegen/CMakeLists.txt @@ -0,0 +1,4 @@ +idf_component_register( + SRCS "qrcodegen/c/qrcodegen.c" + INCLUDE_DIRS "qrcodegen/c" +) diff --git a/components/qrcodegen/component.mk b/components/qrcodegen/component.mk deleted file mode 100644 index c478fb3292..0000000000 --- a/components/qrcodegen/component.mk +++ /dev/null @@ -1,3 +0,0 @@ -COMPONENT_SRCDIRS:=qrcodegen/c -COMPONENT_OBJS:=qrcodegen/c/qrcodegen.o -COMPONENT_ADD_INCLUDEDIRS:=qrcodegen/c diff --git a/components/rtos_dbg/CMakeLists.txt b/components/rtos_dbg/CMakeLists.txt new file mode 100644 index 0000000000..d9648132ff --- /dev/null +++ b/components/rtos_dbg/CMakeLists.txt @@ -0,0 +1,4 @@ +idf_component_register( + SRCS "hexdump.c" "rtos_dbg.c" + INCLUDE_DIRS "include" +) diff --git a/components/rtos_dbg/component.mk b/components/rtos_dbg/component.mk deleted file mode 100644 index 291db28daf..0000000000 --- a/components/rtos_dbg/component.mk +++ /dev/null @@ -1 +0,0 @@ -COMPONENT_ADD_INCLUDEDIRS:=include diff --git a/components/sjson/CMakeLists.txt b/components/sjson/CMakeLists.txt new file mode 100644 index 0000000000..50f576e47c --- /dev/null +++ b/components/sjson/CMakeLists.txt @@ -0,0 +1,9 @@ +idf_component_register( + SRCS "jsonsl.c" + INCLUDE_DIRS "." + REQUIRES "platform" +) +target_compile_options(${COMPONENT_LIB} PRIVATE + -Wno-error=unused-const-variable + -imacros json_config.h +) diff --git a/components/sjson/component.mk b/components/sjson/component.mk deleted file mode 100644 index 396679a72b..0000000000 --- a/components/sjson/component.mk +++ /dev/null @@ -1,2 +0,0 @@ -COMPONENT_ADD_INCLUDEDIRS:=. -CFLAGS+=-imacros json_config.h \ No newline at end of file diff --git a/components/spiffs/CMakeLists.txt b/components/spiffs/CMakeLists.txt new file mode 100644 index 0000000000..473a0742e7 --- /dev/null +++ b/components/spiffs/CMakeLists.txt @@ -0,0 +1,8 @@ +idf_component_register( + SRCS "spiffs.c" "spiffs_cache.c" "spiffs_check.c" "spiffs_gc.c" + "spiffs_hydrogen.c" "spiffs_nucleus.c" + INCLUDE_DIRS "." + REQUIRES "spi_flash" + PRIV_REQUIRES "platform" +) +target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-error=pointer-sign ) diff --git a/components/spiffs/component.mk b/components/spiffs/component.mk deleted file mode 100644 index b58232422c..0000000000 --- a/components/spiffs/component.mk +++ /dev/null @@ -1,4 +0,0 @@ -COMPONENT_ADD_INCLUDEDIRS:=. - -# TODO: clean up codebase to be sign clean... -EXTRA_CFLAGS+=-Wno-error=pointer-sign diff --git a/components/spiffs/project_include.cmake b/components/spiffs/project_include.cmake new file mode 100644 index 0000000000..b94c6004b7 --- /dev/null +++ b/components/spiffs/project_include.cmake @@ -0,0 +1,16 @@ +foreach(def + "-Du32_t=uint32_t" + "-Du16_t=uint16_t" + "-Du8_t=uint8_t" + "-Ds32_t=int32_t" + "-Ds16_t=int16_t" + "-Duint32=uint32_t" + "-Duint16=uint16_t" + "-Duint8=uint8_t" + "-Dsint32=int32_t" + "-Dsint16=int16_t" + "-Dsint8=int8_t" +) + idf_build_set_property(COMPILE_DEFINITIONS ${def} APPEND) +endforeach() + diff --git a/components/spiffs/spiffs.c b/components/spiffs/spiffs.c index e6cf04fbf5..4d7a2b7445 100644 --- a/components/spiffs/spiffs.c +++ b/components/spiffs/spiffs.c @@ -15,7 +15,7 @@ static spiffs fs; #define MIN_BLOCKS_FS 4 static u8_t spiffs_work_buf[LOG_PAGE_SIZE*2]; -static u8_t spiffs_fds[sizeof(spiffs_fd) * CONFIG_SPIFFS_MAX_OPEN_FILES]; +static u8_t spiffs_fds[sizeof(spiffs_fd) * CONFIG_NODEMCU_SPIFFS_MAX_OPEN_FILES]; #if SPIFFS_CACHE static u8_t myspiffs_cache[(LOG_PAGE_SIZE+32)*2]; #endif @@ -290,8 +290,8 @@ static int32_t myspiffs_vfs_readdir( const struct vfs_dir *dd, struct vfs_stat * memset( buf, 0, sizeof( struct vfs_stat ) ); // copy entries to item // fill in supported stat entries - strncpy( buf->name, (char *)dirent.name, CONFIG_FS_OBJ_NAME_LEN+1 ); - buf->name[CONFIG_FS_OBJ_NAME_LEN] = '\0'; + strncpy( buf->name, (char *)dirent.name, CONFIG_NODEMCU_FS_OBJ_NAME_LEN+1 ); + buf->name[CONFIG_NODEMCU_FS_OBJ_NAME_LEN] = '\0'; buf->size = dirent.size; return VFS_RES_OK; } @@ -453,8 +453,8 @@ static int32_t myspiffs_vfs_stat( const char *name, struct vfs_stat *buf ) { memset( buf, 0, sizeof( struct vfs_stat ) ); // fill in supported stat entries - strncpy( buf->name, (char *)stat.name, CONFIG_FS_OBJ_NAME_LEN+1 ); - buf->name[CONFIG_FS_OBJ_NAME_LEN] = '\0'; + strncpy( buf->name, (char *)stat.name, CONFIG_NODEMCU_FS_OBJ_NAME_LEN+1 ); + buf->name[CONFIG_NODEMCU_FS_OBJ_NAME_LEN] = '\0'; buf->size = stat.size; return VFS_RES_OK; } else { diff --git a/components/spiffs/spiffs_config.h b/components/spiffs/spiffs_config.h index f69280b564..794a1fe201 100644 --- a/components/spiffs/spiffs_config.h +++ b/components/spiffs/spiffs_config.h @@ -96,7 +96,7 @@ // zero-termination character, meaning maximum string of characters // can at most be CONFIG_SPIFFS_OBJ_NAME_LEN - 1. #ifndef SPIFFS_OBJ_NAME_LEN -#define SPIFFS_OBJ_NAME_LEN (CONFIG_FS_OBJ_NAME_LEN+1) +#define SPIFFS_OBJ_NAME_LEN (CONFIG_NODEMCU_FS_OBJ_NAME_LEN+1) #endif // Size of buffer allocated on stack used when copying data. diff --git a/components/task/CMakeLists.txt b/components/task/CMakeLists.txt new file mode 100644 index 0000000000..9ea0d554d8 --- /dev/null +++ b/components/task/CMakeLists.txt @@ -0,0 +1,4 @@ +idf_component_register( + SRCS "task.c" + INCLUDE_DIRS "include" +) diff --git a/components/task/Kconfig b/components/task/Kconfig index d9f5ba8925..918469ab00 100644 --- a/components/task/Kconfig +++ b/components/task/Kconfig @@ -1,22 +1,22 @@ menu "NodeMCU task slot configuration" -config NODEMCU_TASK_SLOT_MEMORY - int "Task slot buffer size" - default 2000 - range 80 16000 - help - NodeMCU uses a fixed size RTOS queue for messaging between internal - LVM tasks as well as from other RTOS tasks. If this queue is too - small, events and data will go missing. On the other hand, if the - queue is too big, some memory will go unused. + config NODEMCU_TASK_SLOT_MEMORY + int "Task slot buffer size" + default 2000 + range 80 16000 + help + NodeMCU uses a fixed size RTOS queue for messaging between internal + LVM tasks as well as from other RTOS tasks. If this queue is too + small, events and data will go missing. On the other hand, if the + queue is too big, some memory will go unused. - The default value is chosen to be on the safe side for most use - cases. Lowering this value will yield more available RAM for use - in Lua, but at the increased risk of data loss. Conversely, - increasing this value can help resolve aforementioned data loss - issues, if encountered. + The default value is chosen to be on the safe side for most use + cases. Lowering this value will yield more available RAM for use + in Lua, but at the increased risk of data loss. Conversely, + increasing this value can help resolve aforementioned data loss + issues, if encountered. - The assigned memory size here gets partitioned to the different - task priorities; some rounding down may take place as a result. + The assigned memory size here gets partitioned to the different + task priorities; some rounding down may take place as a result. endmenu diff --git a/components/task/component.mk b/components/task/component.mk deleted file mode 100644 index 291db28daf..0000000000 --- a/components/task/component.mk +++ /dev/null @@ -1 +0,0 @@ -COMPONENT_ADD_INCLUDEDIRS:=include diff --git a/components/u8g2/CMakeLists.txt b/components/u8g2/CMakeLists.txt new file mode 100644 index 0000000000..a2ce919adf --- /dev/null +++ b/components/u8g2/CMakeLists.txt @@ -0,0 +1,8 @@ +idf_component_register( + SRC_DIRS "." "u8g2/src/clib" + INCLUDE_DIRS "u8g2/src/clib" + PRIV_REQUIRES "lua" "platform" +) +target_compile_options(${COMPONENT_LIB} PRIVATE + -Wno-error=unused-const-variable +) diff --git a/components/u8g2/Kconfig.u8g2 b/components/u8g2/Kconfig.u8g2 new file mode 100644 index 0000000000..598d9baa69 --- /dev/null +++ b/components/u8g2/Kconfig.u8g2 @@ -0,0 +1,637 @@ +menu "Displays" + depends on NODEMCU_CMODULE_U8G2 + + menuconfig U8G2_COMM_I2C + bool "I2C" + select NODEMCU_CMODULE_I2C + default "y" + + config U8G2_I2C_LD7032_60X32 + depends on U8G2_COMM_I2C + bool "ld7032_i2c_60x32" + default "n" + + config U8G2_I2C_SH1106_128X64_NONAME + depends on U8G2_COMM_I2C + bool "sh1106_i2c_128x64_noname" + default "n" + + config U8G2_I2C_SH1106_128X64_VCOMH0 + depends on U8G2_COMM_I2C + bool "sh1106_i2c_128x64_vcomh0" + default "n" + + config U8G2_I2C_SH1107_64X128 + depends on U8G2_COMM_I2C + bool "sh1107_i2c_64x128" + default "n" + + config U8G2_I2C_SH1107_SEEED_96X96 + depends on U8G2_COMM_I2C + bool "sh1107_i2c_seeed_96x96" + default "n" + + config U8G2_I2C_SH1107_128X128 + depends on U8G2_COMM_I2C + bool "sh1107_i2c_128x128" + default "n" + + config U8G2_I2C_SH1108_160X160 + depends on U8G2_COMM_I2C + bool "sh1108_i2c_160x160" + default "n" + + config U8G2_I2C_SSD0323_OS128064 + depends on U8G2_COMM_I2C + bool "ssd0323_i2c_os128064" + default "n" + + config U8G2_I2C_SSD1305_128X32_NONAME + depends on U8G2_COMM_I2C + bool "ssd1305_i2c_128x32_noname" + default "n" + + config U8G2_I2C_SSD1306_64X48_ER + depends on U8G2_COMM_I2C + bool "ssd1306_i2c_64x48_er" + default "n" + + config U8G2_I2C_SSD1306_96X16_ER + depends on U8G2_COMM_I2C + bool "ssd1306_i2c_96x16_er" + default "n" + + config U8G2_I2C_SSD1306_128X32_UNIVISION + depends on U8G2_COMM_I2C + bool "ssd1306_i2c_128x32_univision" + default "n" + + config U8G2_I2C_SSD1306_128X64_NONAME + depends on U8G2_COMM_I2C + bool "ssd1306_i2c_128x64_noname" + default "y" + + config U8G2_I2C_SSD1306_128X64_VCOMH0 + depends on U8G2_COMM_I2C + bool "ssd1306_i2c_128x64_vcomh0" + default "n" + + config U8G2_I2C_SSD1306_128X64_ALT0 + depends on U8G2_COMM_I2C + bool "ssd1306_i2c_128x64_alt0" + default "n" + + config U8G2_I2C_SSD1309_128X64_NONAME0 + depends on U8G2_COMM_I2C + bool "ssd1309_i2c_128x64_noname0" + default "n" + + config U8G2_I2C_SSD1309_128X64_NONAME2 + depends on U8G2_COMM_I2C + bool "ssd1309_i2c_128x64_noname2" + default "n" + + config U8G2_I2C_SSD1318_128X96 + depends on U8G2_COMM_I2C + bool "ssd1318_i2c_128x96" + default "n" + + config U8G2_I2C_SSD1318_128X96_XCP + depends on U8G2_COMM_I2C + bool "ssd1318_i2c_128x96_xcp" + default "n" + + config U8G2_I2C_SSD1325_NHD_128X64 + depends on U8G2_COMM_I2C + bool "ssd1325_i2c_nhd_128x64" + default "n" + + config U8G2_I2C_SSD1326_ER_256X32 + depends on U8G2_COMM_I2C + bool "ssd1326_i2c_er_256x32" + default "n" + + config U8G2_I2C_SSD1327_MIDAS_128X128 + depends on U8G2_COMM_I2C + bool "ssd1327_i2c_midas_128x128" + default "n" + + config U8G2_I2C_SSD1327_EA_W128128 + depends on U8G2_COMM_I2C + bool "ssd1327_i2c_ea_w128128" + default "n" + + config U8G2_I2C_SSD1327_SEEED_96X96 + depends on U8G2_COMM_I2C + bool "ssd1327_i2c_seeed_96x96" + default "n" + + config U8G2_I2C_ST7567_64X32 + depends on U8G2_COMM_I2C + bool "st7567_i2c_64x32" + default "n" + + config U8G2_I2C_ST7588_JLX12864 + depends on U8G2_COMM_I2C + bool "st7588_i2c_jlx12864" + default "n" + + config U8G2_I2C_ST75256_JLX256128 + depends on U8G2_COMM_I2C + bool "st75256_i2c_jlx256128" + default "n" + + config U8G2_I2C_ST75256_JLX256160 + depends on U8G2_COMM_I2C + bool "st75256_i2c_jlx256160" + default "n" + + config U8G2_I2C_ST75256_JLX240160 + depends on U8G2_COMM_I2C + bool "st75256_i2c_jlx240160" + default "n" + + config U8G2_I2C_ST75256_JLX25664 + depends on U8G2_COMM_I2C + bool "st75256_i2c_jlx25664" + default "n" + + config U8G2_I2C_ST75256_JLX172104 + depends on U8G2_COMM_I2C + bool "st75256_i2c_jlx172104" + default "n" + + config U8G2_I2C_UC1601_128X32 + depends on U8G2_COMM_I2C + bool "uc1601_i2c_128X32" + default "n" + + config U8G2_I2C_UC1604_JLX19264 + depends on U8G2_COMM_I2C + bool "uc1604_i2c_jlx19264" + default "n" + + config U8G2_I2C_UC1608_ERC24064 + depends on U8G2_COMM_I2C + bool "uc1608_i2c_erc24064" + default "n" + + config U8G2_I2C_UC1608_240X128 + depends on U8G2_COMM_I2C + bool "uc1608_i2c_240x128" + default "n" + + config U8G2_I2C_UC1610_EA_DOGXL160 + depends on U8G2_COMM_I2C + bool "uc1610_i2c_ea_dogxl160" + default "n" + + config U8G2_I2C_UC1611_EA_DOGM240 + depends on U8G2_COMM_I2C + bool "uc1611_i2c_ea_dogm240" + default "n" + + config U8G2_I2C_UC1611_EA_DOGXL240 + depends on U8G2_COMM_I2C + bool "uc1611_i2c_ea_dogxl240" + default "n" + + config U8G2_I2C_UC1611_EW50850 + depends on U8G2_COMM_I2C + bool "uc1611_i2c_ew50850" + default "n" + + + menuconfig U8G2_COMM_SPI + bool "SPI" + select NODEMCU_CMODULE_SPI + default "y" + + config U8G2_SPI_HX1230_96X68 + depends on U8G2_COMM_SPI + bool "hx1230_96x68" + default "n" + + config U8G2_SPI_IL3820_V2_296X128 + depends on U8G2_COMM_SPI + bool "il3820_v2_296x128" + default "n" + + config U8G2_SPI_IST3020_ERC19264 + depends on U8G2_COMM_SPI + bool "ist3020_erc19264" + default "n" + + config U8G2_SPI_LC7981_160X80 + depends on U8G2_COMM_SPI + bool "lc7981_160x80" + default "n" + + config U8G2_SPI_LC7981_160X160 + depends on U8G2_COMM_SPI + bool "lc7981_160x160" + default "n" + + config U8G2_SPI_LC7981_240X128 + depends on U8G2_COMM_SPI + bool "lc7981_240x128" + default "n" + + config U8G2_SPI_LC7981_240X64 + depends on U8G2_COMM_SPI + bool "lc7981_240x64" + default "n" + + config U8G2_SPI_LD7032_60X32 + depends on U8G2_COMM_SPI + bool "ld7032_60x32" + default "n" + + config U8G2_SPI_LS013B7DH03_128X128 + depends on U8G2_COMM_SPI + bool "ls013b7dh03_128x128" + default "n" + + config U8G2_SPI_MAX7219_32X8 + depends on U8G2_COMM_SPI + bool "max7219_32x8" + default "n" + + config U8G2_SPI_NT7534_TG12864R + depends on U8G2_COMM_SPI + bool "nt7534_tg12864r" + default "n" + + config U8G2_SPI_PCD8544_84X48 + depends on U8G2_COMM_SPI + bool "pcd8544_84x48" + default "n" + + config U8G2_SPI_PCF8812_96X65 + depends on U8G2_COMM_SPI + bool "pcf8812_96x65" + default "n" + + config U8G2_SPI_SED1520_122x32 + depends on U8G2_COMM_SPI + bool "sed1520_122x32" + default "n" + + config U8G2_SPI_SH1106_128X64_NONAME + depends on U8G2_COMM_SPI + bool "sh1106_128x64_noname" + default "n" + + config U8G2_SPI_SH1106_128X64_VCOMH0 + depends on U8G2_COMM_SPI + bool "sh1106_128x64_vcomh0" + default "n" + + config U8G2_SPI_SH1107_64X128 + depends on U8G2_COMM_SPI + bool "sh1107_64x128" + default "n" + + config U8G2_SPI_SH1107_SEEED_96X96 + depends on U8G2_COMM_SPI + bool "sh1107_seeed_96x96" + default "n" + + config U8G2_SPI_SH1107_128X128 + depends on U8G2_COMM_SPI + bool "sh1107_128x128" + default "n" + + config U8G2_SPI_SH1108_160X160 + depends on U8G2_COMM_SPI + bool "sh1108_160x160" + default "n" + + config U8G2_SPI_SH1122_256X64 + depends on U8G2_COMM_SPI + bool "sh1122_256x64" + default "n" + + config U8G2_SPI_SSD0323_OS128064 + depends on U8G2_COMM_SPI + bool "ssd0323_os128064" + default "n" + + config U8G2_SPI_SSD1305_128X32_NONAME + depends on U8G2_COMM_SPI + bool "ssd1305_128x32_noname" + default "n" + + config U8G2_SPI_SSD1306_128X32_UNIVISION + depends on U8G2_COMM_SPI + bool "ssd1306_128x32_univision" + default "n" + + config U8G2_SPI_SSD1306_128X64_NONAME + depends on U8G2_COMM_SPI + bool "ssd1306_128x64_noname" + default "y" + + config U8G2_SPI_SSD1306_128X64_VCOMH0 + depends on U8G2_COMM_SPI + bool "ssd1306_128x64_vcomh0" + default "n" + + config U8G2_SPI_SSD1306_128X64_ALT0 + depends on U8G2_COMM_SPI + bool "ssd1306_128x64_alt0" + default "n" + + config U8G2_SPI_SSD1306_64X48_ER + depends on U8G2_COMM_SPI + bool "ssd1306_64x48_er" + default "n" + + config U8G2_SPI_SSD1306_96X16_ER + depends on U8G2_COMM_SPI + bool "ssd1306_96x16_er" + default "n" + + config U8G2_SPI_SSD1309_128X64_NONAME0 + depends on U8G2_COMM_SPI + bool "ssd1309_128x64_noname0" + default "n" + + config U8G2_SPI_SSD1309_128X64_NONAME2 + depends on U8G2_COMM_SPI + bool "ssd1309_128x64_noname2" + default "n" + + config U8G2_SPI_SSD1318_128X96 + depends on U8G2_COMM_SPI + bool "ssd1318_128x96" + default "n" + + config U8G2_SPI_SSD1318_128X96_XCP + depends on U8G2_COMM_SPI + bool "ssd1318_128x96_xcp" + default "n" + + config U8G2_SPI_SSD1322_NHD_128X64 + depends on U8G2_COMM_SPI + bool "ssd1322_nhd_128x64" + default "n" + + config U8G2_SPI_SSD1322_NHD_256X64 + depends on U8G2_COMM_SPI + bool "ssd1322_nhd_256x64" + default "n" + + config U8G2_SPI_SSD1325_NHD_128X64 + depends on U8G2_COMM_SPI + bool "ssd1325_nhd_128x64" + default "n" + + config U8G2_SPI_SSD1326_ER_256X32 + depends on U8G2_COMM_SPI + bool "ssd1326_er_256x32" + default "n" + + config U8G2_SPI_SSD1327_EA_W128128 + depends on U8G2_COMM_SPI + bool "ssd1327_ea_w128128" + default "n" + + config U8G2_SPI_SSD1327_MIDAS_128X128 + depends on U8G2_COMM_SPI + bool "ssd1327_midas_128x128" + default "n" + + config U8G2_SPI_SSD1327_SEEED_96X96 + depends on U8G2_COMM_SPI + bool "ssd1327_seeed_96x96" + default "n" + + config U8G2_SPI_SSD1329_128X96_NONAME + depends on U8G2_COMM_SPI + bool "ssd1329_128x96_noname" + default "n" + + config U8G2_SPI_SSD1606_172X72 + depends on U8G2_COMM_SPI + bool "ssd1606_172x72" + default "n" + + config U8G2_SPI_SSD1607_200X200 + depends on U8G2_COMM_SPI + bool "ssd1607_200x200" + default "n" + + config U8G2_SPI_SSD1607_GD_200X200 + depends on U8G2_COMM_SPI + bool "ssd1607_gd_200x200" + default "n" + + config U8G2_SPI_SSD1607_WS_200X200 + depends on U8G2_COMM_SPI + bool "ssd1607_ws_200x200" + default "n" + + config U8G2_SPI_ST7565_64128N + depends on U8G2_COMM_SPI + bool "st7565_64128n" + default "n" + + config U8G2_SPI_ST7565_EA_DOGM128 + depends on U8G2_COMM_SPI + bool "st7565_ea_dogm128" + default "n" + + config U8G2_SPI_ST7565_EA_DOGM132 + depends on U8G2_COMM_SPI + bool "st7565_ea_dogm132" + default "n" + + config U8G2_SPI_ST7565_ERC12864 + depends on U8G2_COMM_SPI + bool "st7565_erc12864" + default "n" + + config U8G2_SPI_ST7565_ERC12864_ALT + depends on U8G2_COMM_SPI + bool "st7565_erc12864_alt" + default "n" + + config U8G2_SPI_ST7565_LM6059 + depends on U8G2_COMM_SPI + bool "st7565_lm6059" + default "n" + + config U8G2_SPI_ST7565_NHD_C12832 + depends on U8G2_COMM_SPI + bool "st7565_nhd_c12832" + default "n" + + config U8G2_SPI_ST7565_NHD_C12864 + depends on U8G2_COMM_SPI + bool "st7565_nhd_c12864" + default "n" + + config U8G2_SPI_ST7565_ZOLEN_128X64 + depends on U8G2_COMM_SPI + bool "st7565_zolen_128x64" + default "n" + + config U8G2_SPI_ST7567_64X32 + depends on U8G2_COMM_SPI + bool "st7567_64x32" + default "n" + + config U8G2_SPI_ST7567_ENH_DG128064I + depends on U8G2_COMM_SPI + bool "st7567_enh_dg128064i" + default "n" + + config U8G2_SPI_ST7567_JLX12864 + depends on U8G2_COMM_SPI + bool "st7567_jxl12864" + default "n" + + config U8G2_SPI_ST7567_PI_132X64 + depends on U8G2_COMM_SPI + bool "st7567_pi_132x64" + default "n" + + config U8G2_SPI_ST7586S_S028HN118A + depends on U8G2_COMM_SPI + bool "st7586s_s028hn118a" + default "n" + + config U8G2_SPI_ST7586S_ERC240160 + depends on U8G2_COMM_SPI + bool "st7586s_erc240160" + default "n" + + config U8G2_SPI_ST7588_JLX12864 + depends on U8G2_COMM_SPI + bool "st7588_jlx12864" + default "n" + + config U8G2_SPI_ST7920_S_128X64 + depends on U8G2_COMM_SPI + bool "st7920_s_128x64" + default "n" + + config U8G2_SPI_ST7920_S_192X32 + depends on U8G2_COMM_SPI + bool "st7920_s_192x32" + default "n" + + config U8G2_SPI_ST75256_JLX25664 + depends on U8G2_COMM_SPI + bool "st75256_jlx25664" + default "n" + + config U8G2_SPI_ST75256_JLX172104 + depends on U8G2_COMM_SPI + bool "st75256_jlx172104" + default "n" + + config U8G2_SPI_ST75256_JLX240160 + depends on U8G2_COMM_SPI + bool "st75256_jlx240160" + default "n" + + config U8G2_SPI_ST75256_JLX256128 + depends on U8G2_COMM_SPI + bool "st75256_jlx256128" + default "n" + + config U8G2_SPI_ST75256_JLX256160 + depends on U8G2_COMM_SPI + bool "st75256_jlx256160" + default "n" + + config U8G2_SPI_T6963_240X128 + depends on U8G2_COMM_SPI + bool "t6963_240x128" + default "n" + + config U8G2_SPI_T6963_240X64 + depends on U8G2_COMM_SPI + bool "t6963_240x64" + default "n" + + config U8G2_SPI_T6963_256X64 + depends on U8G2_COMM_SPI + bool "t6963_256x64" + default "n" + + config U8G2_SPI_T6963_128X64 + depends on U8G2_COMM_SPI + bool "t6963_128x64" + default "n" + + config U8G2_SPI_T6963_160X80 + depends on U8G2_COMM_SPI + bool "t6963_160x80" + default "n" + + config U8G2_SPI_UC1601_128X32 + depends on U8G2_COMM_SPI + bool "uc1601_128X32" + default "n" + + config U8G2_SPI_UC1604_JLX19264 + depends on U8G2_COMM_SPI + bool "uc1604_jlx19264" + default "n" + + config U8G2_SPI_UC1608_240X128 + depends on U8G2_COMM_SPI + bool "uc1608_240x128" + default "n" + + config U8G2_SPI_UC1608_ERC24064 + depends on U8G2_COMM_SPI + bool "uc1608_erc24064" + default "n" + + config U8G2_SPI_UC1610_EA_DOGXL160 + depends on U8G2_COMM_SPI + bool "uc1610_ea_dogxl160" + default "n" + + config U8G2_SPI_UC1611_EA_DOGM240 + depends on U8G2_COMM_SPI + bool "uc1611_ea_dogm240" + default "n" + + config U8G2_SPI_UC1611_EA_DOGXL240 + depends on U8G2_COMM_SPI + bool "uc1611_ea_dogxl240" + default "n" + + config U8G2_SPI_UC1611_EW50850 + depends on U8G2_COMM_SPI + bool "uc1611_ew50850" + default "n" + + config U8G2_SPI_UC1701_EA_DOGS102 + depends on U8G2_COMM_SPI + bool "uc1701_ea_dogs102" + default "n" + + config U8G2_SPI_UC1701_MINI12864 + depends on U8G2_COMM_SPI + bool "uc1701_mini12864" + default "n" + +endmenu + +menu "Fonts" + depends on NODEMCU_CMODULE_U8G2 + + config U8G2_FONT_SELECTION + depends on NODEMCU_CMODULE_U8G2 + string "Font list" + default "font_6x10_tf,font_unifont_t_symbols" + help + Enter a comma-separated list of fonts. + +endmenu diff --git a/components/u8g2/component.mk b/components/u8g2/component.mk deleted file mode 100644 index 5738c8dde2..0000000000 --- a/components/u8g2/component.mk +++ /dev/null @@ -1,3 +0,0 @@ -COMPONENT_SRCDIRS:=u8g2/src/clib . -COMPONENT_ADD_INCLUDEDIRS:=u8g2/src/clib -CPPFLAGS+=-DU8X8_USE_PINS -DU8X8_WITH_USER_PTR diff --git a/components/u8g2/project_include.cmake b/components/u8g2/project_include.cmake new file mode 100644 index 0000000000..09dfeced03 --- /dev/null +++ b/components/u8g2/project_include.cmake @@ -0,0 +1,6 @@ +foreach(def + "-DU8X8_USE_PINS" + "-DU8X8_WITH_USER_PTR" +) + idf_build_set_property(COMPILE_DEFINITIONS ${def} APPEND) +endforeach() diff --git a/components/u8g2/u8g2.kconfig b/components/u8g2/u8g2.kconfig deleted file mode 100644 index b9cc84bef5..0000000000 --- a/components/u8g2/u8g2.kconfig +++ /dev/null @@ -1,637 +0,0 @@ -menu "Displays" - depends on NODEMCU_CMODULE_U8G2 - -menuconfig U8G2_COMM_I2C - bool "I2C" - select NODEMCU_CMODULE_I2C - default "y" - -config U8G2_I2C_LD7032_60X32 - depends on U8G2_COMM_I2C - bool "ld7032_i2c_60x32" - default "n" - -config U8G2_I2C_SH1106_128X64_NONAME - depends on U8G2_COMM_I2C - bool "sh1106_i2c_128x64_noname" - default "n" - -config U8G2_I2C_SH1106_128X64_VCOMH0 - depends on U8G2_COMM_I2C - bool "sh1106_i2c_128x64_vcomh0" - default "n" - -config U8G2_I2C_SH1107_64X128 - depends on U8G2_COMM_I2C - bool "sh1107_i2c_64x128" - default "n" - -config U8G2_I2C_SH1107_SEEED_96X96 - depends on U8G2_COMM_I2C - bool "sh1107_i2c_seeed_96x96" - default "n" - -config U8G2_I2C_SH1107_128X128 - depends on U8G2_COMM_I2C - bool "sh1107_i2c_128x128" - default "n" - -config U8G2_I2C_SH1108_160X160 - depends on U8G2_COMM_I2C - bool "sh1108_i2c_160x160" - default "n" - -config U8G2_I2C_SSD0323_OS128064 - depends on U8G2_COMM_I2C - bool "ssd0323_i2c_os128064" - default "n" - -config U8G2_I2C_SSD1305_128X32_NONAME - depends on U8G2_COMM_I2C - bool "ssd1305_i2c_128x32_noname" - default "n" - -config U8G2_I2C_SSD1306_64X48_ER - depends on U8G2_COMM_I2C - bool "ssd1306_i2c_64x48_er" - default "n" - -config U8G2_I2C_SSD1306_96X16_ER - depends on U8G2_COMM_I2C - bool "ssd1306_i2c_96x16_er" - default "n" - -config U8G2_I2C_SSD1306_128X32_UNIVISION - depends on U8G2_COMM_I2C - bool "ssd1306_i2c_128x32_univision" - default "n" - -config U8G2_I2C_SSD1306_128X64_NONAME - depends on U8G2_COMM_I2C - bool "ssd1306_i2c_128x64_noname" - default "y" - -config U8G2_I2C_SSD1306_128X64_VCOMH0 - depends on U8G2_COMM_I2C - bool "ssd1306_i2c_128x64_vcomh0" - default "n" - -config U8G2_I2C_SSD1306_128X64_ALT0 - depends on U8G2_COMM_I2C - bool "ssd1306_i2c_128x64_alt0" - default "n" - -config U8G2_I2C_SSD1309_128X64_NONAME0 - depends on U8G2_COMM_I2C - bool "ssd1309_i2c_128x64_noname0" - default "n" - -config U8G2_I2C_SSD1309_128X64_NONAME2 - depends on U8G2_COMM_I2C - bool "ssd1309_i2c_128x64_noname2" - default "n" - -config U8G2_I2C_SSD1318_128X96 - depends on U8G2_COMM_I2C - bool "ssd1318_i2c_128x96" - default "n" - -config U8G2_I2C_SSD1318_128X96_XCP - depends on U8G2_COMM_I2C - bool "ssd1318_i2c_128x96_xcp" - default "n" - -config U8G2_I2C_SSD1325_NHD_128X64 - depends on U8G2_COMM_I2C - bool "ssd1325_i2c_nhd_128x64" - default "n" - -config U8G2_I2C_SSD1326_ER_256X32 - depends on U8G2_COMM_I2C - bool "ssd1326_i2c_er_256x32" - default "n" - -config U8G2_I2C_SSD1327_MIDAS_128X128 - depends on U8G2_COMM_I2C - bool "ssd1327_i2c_midas_128x128" - default "n" - -config U8G2_I2C_SSD1327_EA_W128128 - depends on U8G2_COMM_I2C - bool "ssd1327_i2c_ea_w128128" - default "n" - -config U8G2_I2C_SSD1327_SEEED_96X96 - depends on U8G2_COMM_I2C - bool "ssd1327_i2c_seeed_96x96" - default "n" - -config U8G2_I2C_ST7567_64X32 - depends on U8G2_COMM_I2C - bool "st7567_i2c_64x32" - default "n" - -config U8G2_I2C_ST7588_JLX12864 - depends on U8G2_COMM_I2C - bool "st7588_i2c_jlx12864" - default "n" - -config U8G2_I2C_ST75256_JLX256128 - depends on U8G2_COMM_I2C - bool "st75256_i2c_jlx256128" - default "n" - -config U8G2_I2C_ST75256_JLX256160 - depends on U8G2_COMM_I2C - bool "st75256_i2c_jlx256160" - default "n" - -config U8G2_I2C_ST75256_JLX240160 - depends on U8G2_COMM_I2C - bool "st75256_i2c_jlx240160" - default "n" - -config U8G2_I2C_ST75256_JLX25664 - depends on U8G2_COMM_I2C - bool "st75256_i2c_jlx25664" - default "n" - -config U8G2_I2C_ST75256_JLX172104 - depends on U8G2_COMM_I2C - bool "st75256_i2c_jlx172104" - default "n" - -config U8G2_I2C_UC1601_128X32 - depends on U8G2_COMM_I2C - bool "uc1601_i2c_128X32" - default "n" - -config U8G2_I2C_UC1604_JLX19264 - depends on U8G2_COMM_I2C - bool "uc1604_i2c_jlx19264" - default "n" - -config U8G2_I2C_UC1608_ERC24064 - depends on U8G2_COMM_I2C - bool "uc1608_i2c_erc24064" - default "n" - -config U8G2_I2C_UC1608_240X128 - depends on U8G2_COMM_I2C - bool "uc1608_i2c_240x128" - default "n" - -config U8G2_I2C_UC1610_EA_DOGXL160 - depends on U8G2_COMM_I2C - bool "uc1610_i2c_ea_dogxl160" - default "n" - -config U8G2_I2C_UC1611_EA_DOGM240 - depends on U8G2_COMM_I2C - bool "uc1611_i2c_ea_dogm240" - default "n" - -config U8G2_I2C_UC1611_EA_DOGXL240 - depends on U8G2_COMM_I2C - bool "uc1611_i2c_ea_dogxl240" - default "n" - -config U8G2_I2C_UC1611_EW50850 - depends on U8G2_COMM_I2C - bool "uc1611_i2c_ew50850" - default "n" - - -menuconfig U8G2_COMM_SPI - bool "SPI" - select NODEMCU_CMODULE_SPI - default "y" - -config U8G2_SPI_HX1230_96X68 - depends on U8G2_COMM_SPI - bool "hx1230_96x68" - default "n" - -config U8G2_SPI_IL3820_V2_296X128 - depends on U8G2_COMM_SPI - bool "il3820_v2_296x128" - default "n" - -config U8G2_SPI_IST3020_ERC19264 - depends on U8G2_COMM_SPI - bool "ist3020_erc19264" - default "n" - -config U8G2_SPI_LC7981_160X80 - depends on U8G2_COMM_SPI - bool "lc7981_160x80" - default "n" - -config U8G2_SPI_LC7981_160X160 - depends on U8G2_COMM_SPI - bool "lc7981_160x160" - default "n" - -config U8G2_SPI_LC7981_240X128 - depends on U8G2_COMM_SPI - bool "lc7981_240x128" - default "n" - -config U8G2_SPI_LC7981_240X64 - depends on U8G2_COMM_SPI - bool "lc7981_240x64" - default "n" - -config U8G2_SPI_LD7032_60X32 - depends on U8G2_COMM_SPI - bool "ld7032_60x32" - default "n" - -config U8G2_SPI_LS013B7DH03_128X128 - depends on U8G2_COMM_SPI - bool "ls013b7dh03_128x128" - default "n" - -config U8G2_SPI_MAX7219_32X8 - depends on U8G2_COMM_SPI - bool "max7219_32x8" - default "n" - -config U8G2_SPI_NT7534_TG12864R - depends on U8G2_COMM_SPI - bool "nt7534_tg12864r" - default "n" - -config U8G2_SPI_PCD8544_84X48 - depends on U8G2_COMM_SPI - bool "pcd8544_84x48" - default "n" - -config U8G2_SPI_PCF8812_96X65 - depends on U8G2_COMM_SPI - bool "pcf8812_96x65" - default "n" - -config U8G2_SPI_SED1520_122x32 - depends on U8G2_COMM_SPI - bool "sed1520_122x32" - default "n" - -config U8G2_SPI_SH1106_128X64_NONAME - depends on U8G2_COMM_SPI - bool "sh1106_128x64_noname" - default "n" - -config U8G2_SPI_SH1106_128X64_VCOMH0 - depends on U8G2_COMM_SPI - bool "sh1106_128x64_vcomh0" - default "n" - -config U8G2_SPI_SH1107_64X128 - depends on U8G2_COMM_SPI - bool "sh1107_64x128" - default "n" - -config U8G2_SPI_SH1107_SEEED_96X96 - depends on U8G2_COMM_SPI - bool "sh1107_seeed_96x96" - default "n" - -config U8G2_SPI_SH1107_128X128 - depends on U8G2_COMM_SPI - bool "sh1107_128x128" - default "n" - -config U8G2_SPI_SH1108_160X160 - depends on U8G2_COMM_SPI - bool "sh1108_160x160" - default "n" - -config U8G2_SPI_SH1122_256X64 - depends on U8G2_COMM_SPI - bool "sh1122_256x64" - default "n" - -config U8G2_SPI_SSD0323_OS128064 - depends on U8G2_COMM_SPI - bool "ssd0323_os128064" - default "n" - -config U8G2_SPI_SSD1305_128X32_NONAME - depends on U8G2_COMM_SPI - bool "ssd1305_128x32_noname" - default "n" - -config U8G2_SPI_SSD1306_128X32_UNIVISION - depends on U8G2_COMM_SPI - bool "ssd1306_128x32_univision" - default "n" - -config U8G2_SPI_SSD1306_128X64_NONAME - depends on U8G2_COMM_SPI - bool "ssd1306_128x64_noname" - default "y" - -config U8G2_SPI_SSD1306_128X64_VCOMH0 - depends on U8G2_COMM_SPI - bool "ssd1306_128x64_vcomh0" - default "n" - -config U8G2_SPI_SSD1306_128X64_ALT0 - depends on U8G2_COMM_SPI - bool "ssd1306_128x64_alt0" - default "n" - -config U8G2_SPI_SSD1306_64X48_ER - depends on U8G2_COMM_SPI - bool "ssd1306_64x48_er" - default "n" - -config U8G2_SPI_SSD1306_96X16_ER - depends on U8G2_COMM_SPI - bool "ssd1306_96x16_er" - default "n" - -config U8G2_SPI_SSD1309_128X64_NONAME0 - depends on U8G2_COMM_SPI - bool "ssd1309_128x64_noname0" - default "n" - -config U8G2_SPI_SSD1309_128X64_NONAME2 - depends on U8G2_COMM_SPI - bool "ssd1309_128x64_noname2" - default "n" - -config U8G2_SPI_SSD1318_128X96 - depends on U8G2_COMM_SPI - bool "ssd1318_128x96" - default "n" - -config U8G2_SPI_SSD1318_128X96_XCP - depends on U8G2_COMM_SPI - bool "ssd1318_128x96_xcp" - default "n" - -config U8G2_SPI_SSD1322_NHD_128X64 - depends on U8G2_COMM_SPI - bool "ssd1322_nhd_128x64" - default "n" - -config U8G2_SPI_SSD1322_NHD_256X64 - depends on U8G2_COMM_SPI - bool "ssd1322_nhd_256x64" - default "n" - -config U8G2_SPI_SSD1325_NHD_128X64 - depends on U8G2_COMM_SPI - bool "ssd1325_nhd_128x64" - default "n" - -config U8G2_SPI_SSD1326_ER_256X32 - depends on U8G2_COMM_SPI - bool "ssd1326_er_256x32" - default "n" - -config U8G2_SPI_SSD1327_EA_W128128 - depends on U8G2_COMM_SPI - bool "ssd1327_ea_w128128" - default "n" - -config U8G2_SPI_SSD1327_MIDAS_128X128 - depends on U8G2_COMM_SPI - bool "ssd1327_midas_128x128" - default "n" - -config U8G2_SPI_SSD1327_SEEED_96X96 - depends on U8G2_COMM_SPI - bool "ssd1327_seeed_96x96" - default "n" - -config U8G2_SPI_SSD1329_128X96_NONAME - depends on U8G2_COMM_SPI - bool "ssd1329_128x96_noname" - default "n" - -config U8G2_SPI_SSD1606_172X72 - depends on U8G2_COMM_SPI - bool "ssd1606_172x72" - default "n" - -config U8G2_SPI_SSD1607_200X200 - depends on U8G2_COMM_SPI - bool "ssd1607_200x200" - default "n" - -config U8G2_SPI_SSD1607_GD_200X200 - depends on U8G2_COMM_SPI - bool "ssd1607_gd_200x200" - default "n" - -config U8G2_SPI_SSD1607_WS_200X200 - depends on U8G2_COMM_SPI - bool "ssd1607_ws_200x200" - default "n" - -config U8G2_SPI_ST7565_64128N - depends on U8G2_COMM_SPI - bool "st7565_64128n" - default "n" - -config U8G2_SPI_ST7565_EA_DOGM128 - depends on U8G2_COMM_SPI - bool "st7565_ea_dogm128" - default "n" - -config U8G2_SPI_ST7565_EA_DOGM132 - depends on U8G2_COMM_SPI - bool "st7565_ea_dogm132" - default "n" - -config U8G2_SPI_ST7565_ERC12864 - depends on U8G2_COMM_SPI - bool "st7565_erc12864" - default "n" - -config U8G2_SPI_ST7565_ERC12864_ALT - depends on U8G2_COMM_SPI - bool "st7565_erc12864_alt" - default "n" - -config U8G2_SPI_ST7565_LM6059 - depends on U8G2_COMM_SPI - bool "st7565_lm6059" - default "n" - -config U8G2_SPI_ST7565_NHD_C12832 - depends on U8G2_COMM_SPI - bool "st7565_nhd_c12832" - default "n" - -config U8G2_SPI_ST7565_NHD_C12864 - depends on U8G2_COMM_SPI - bool "st7565_nhd_c12864" - default "n" - -config U8G2_SPI_ST7565_ZOLEN_128X64 - depends on U8G2_COMM_SPI - bool "st7565_zolen_128x64" - default "n" - -config U8G2_SPI_ST7567_64X32 - depends on U8G2_COMM_SPI - bool "st7567_64x32" - default "n" - -config U8G2_SPI_ST7567_ENH_DG128064I - depends on U8G2_COMM_SPI - bool "st7567_enh_dg128064i" - default "n" - -config U8G2_SPI_ST7567_JLX12864 - depends on U8G2_COMM_SPI - bool "st7567_jxl12864" - default "n" - -config U8G2_SPI_ST7567_PI_132X64 - depends on U8G2_COMM_SPI - bool "st7567_pi_132x64" - default "n" - -config U8G2_SPI_ST7586S_S028HN118A - depends on U8G2_COMM_SPI - bool "st7586s_s028hn118a" - default "n" - -config U8G2_SPI_ST7586S_ERC240160 - depends on U8G2_COMM_SPI - bool "st7586s_erc240160" - default "n" - -config U8G2_SPI_ST7588_JLX12864 - depends on U8G2_COMM_SPI - bool "st7588_jlx12864" - default "n" - -config U8G2_SPI_ST7920_S_128X64 - depends on U8G2_COMM_SPI - bool "st7920_s_128x64" - default "n" - -config U8G2_SPI_ST7920_S_192X32 - depends on U8G2_COMM_SPI - bool "st7920_s_192x32" - default "n" - -config U8G2_SPI_ST75256_JLX25664 - depends on U8G2_COMM_SPI - bool "st75256_jlx25664" - default "n" - -config U8G2_SPI_ST75256_JLX172104 - depends on U8G2_COMM_SPI - bool "st75256_jlx172104" - default "n" - -config U8G2_SPI_ST75256_JLX240160 - depends on U8G2_COMM_SPI - bool "st75256_jlx240160" - default "n" - -config U8G2_SPI_ST75256_JLX256128 - depends on U8G2_COMM_SPI - bool "st75256_jlx256128" - default "n" - -config U8G2_SPI_ST75256_JLX256160 - depends on U8G2_COMM_SPI - bool "st75256_jlx256160" - default "n" - -config U8G2_SPI_T6963_240X128 - depends on U8G2_COMM_SPI - bool "t6963_240x128" - default "n" - -config U8G2_SPI_T6963_240X64 - depends on U8G2_COMM_SPI - bool "t6963_240x64" - default "n" - -config U8G2_SPI_T6963_256X64 - depends on U8G2_COMM_SPI - bool "t6963_256x64" - default "n" - -config U8G2_SPI_T6963_128X64 - depends on U8G2_COMM_SPI - bool "t6963_128x64" - default "n" - -config U8G2_SPI_T6963_160X80 - depends on U8G2_COMM_SPI - bool "t6963_160x80" - default "n" - -config U8G2_SPI_UC1601_128X32 - depends on U8G2_COMM_SPI - bool "uc1601_128X32" - default "n" - -config U8G2_SPI_UC1604_JLX19264 - depends on U8G2_COMM_SPI - bool "uc1604_jlx19264" - default "n" - -config U8G2_SPI_UC1608_240X128 - depends on U8G2_COMM_SPI - bool "uc1608_240x128" - default "n" - -config U8G2_SPI_UC1608_ERC24064 - depends on U8G2_COMM_SPI - bool "uc1608_erc24064" - default "n" - -config U8G2_SPI_UC1610_EA_DOGXL160 - depends on U8G2_COMM_SPI - bool "uc1610_ea_dogxl160" - default "n" - -config U8G2_SPI_UC1611_EA_DOGM240 - depends on U8G2_COMM_SPI - bool "uc1611_ea_dogm240" - default "n" - -config U8G2_SPI_UC1611_EA_DOGXL240 - depends on U8G2_COMM_SPI - bool "uc1611_ea_dogxl240" - default "n" - -config U8G2_SPI_UC1611_EW50850 - depends on U8G2_COMM_SPI - bool "uc1611_ew50850" - default "n" - -config U8G2_SPI_UC1701_EA_DOGS102 - depends on U8G2_COMM_SPI - bool "uc1701_ea_dogs102" - default "n" - -config U8G2_SPI_UC1701_MINI12864 - depends on U8G2_COMM_SPI - bool "uc1701_mini12864" - default "n" - -endmenu - -menu "Fonts" - depends on NODEMCU_CMODULE_U8G2 - -config U8G2_FONT_SELECTION - depends on NODEMCU_CMODULE_U8G2 - string "Font list" - default "font_6x10_tf,font_unifont_t_symbols" - help - Enter a comma-separated list of fonts. - -endmenu diff --git a/components/ucg/CMakeLists.txt b/components/ucg/CMakeLists.txt new file mode 100644 index 0000000000..76af2b687b --- /dev/null +++ b/components/ucg/CMakeLists.txt @@ -0,0 +1,7 @@ +idf_component_register( + SRC_DIRS "ucg/src/clib" + INCLUDE_DIRS "ucg/src/clib" +) +target_compile_options(${COMPONENT_LIB} PRIVATE + -Wno-error=unused-const-variable +) diff --git a/components/ucg/Kconfig.ucg b/components/ucg/Kconfig.ucg new file mode 100644 index 0000000000..d0f4dfb771 --- /dev/null +++ b/components/ucg/Kconfig.ucg @@ -0,0 +1,66 @@ +menu "Displays" + depends on NODEMCU_CMODULE_UCG + + config UCG_DISPLAY_HX8352C_18X240X400 + depends on NODEMCU_CMODULE_SPI + bool "hx8352c_18x240x400_hw_spi" + default "n" + + config UCG_DISPLAY_ILI9163_18X128X128 + depends on NODEMCU_CMODULE_SPI + bool "ili9163_18x128x128_hw_spi" + default "n" + + config UCG_DISPLAY_ILI9341_18X240X320 + depends on NODEMCU_CMODULE_SPI + bool "ili9341_18x240x320_hw_spi" + default "y" + + config UCG_DISPLAY_ILI9486_18X320X480 + depends on NODEMCU_CMODULE_SPI + bool "ili9486_18x320x480_hw_spi" + default "n" + + config UCG_DISPLAY_PCF8833_16X132X132 + depends on NODEMCU_CMODULE_SPI + bool "pcf8833_16x132x132_hw_spi" + default "n" + + config UCG_DISPLAY_SEPS225_16X128X128_UNIVISION + depends on NODEMCU_CMODULE_SPI + bool "seps225_16x128x128_uvis_hw_spi" + default "n" + + config UCG_DISPLAY_SSD1351_18X128X128_ILSOFT + depends on NODEMCU_CMODULE_SPI + bool "ssd1351_18x128x128_hw_spi" + default "n" + + config UCG_DISPLAY_SSD1351_18X128X128_FT + depends on NODEMCU_CMODULE_SPI + bool "ssd1351_18x128x128_ft_hw_spi" + default "n" + + config UCG_DISPLAY_SSD1331_18X96X64_UNIVISION + depends on NODEMCU_CMODULE_SPI + bool "ssd1331_18x96x64_uvis_hw_spi" + default "n" + + config UCG_DISPLAY_ST7735_18X128X160 + depends on NODEMCU_CMODULE_SPI + bool "st7735_18x128x160_hw_spi" + default "y" + +endmenu + +menu "Fonts" + depends on NODEMCU_CMODULE_UCG + + config UCG_FONT_SELECTION + depends on NODEMCU_CMODULE_UCG + string "Font list" + default "font_7x13B_tr,font_helvB08_hr,font_helvB10_hr,font_helvB12_hr,font_helvB18_hr,font_ncenB24_tr,font_ncenR12_tr,font_ncenR14_hr" + help + Enter a comma-separated list of fonts. + +endmenu diff --git a/components/ucg/component.mk b/components/ucg/component.mk deleted file mode 100644 index 8e4ecae7a2..0000000000 --- a/components/ucg/component.mk +++ /dev/null @@ -1,3 +0,0 @@ -COMPONENT_SRCDIRS:=ucg/src/clib . -COMPONENT_ADD_INCLUDEDIRS:=ucg/src/clib -CPPFLAGS+=-DUSE_PIN_LIST diff --git a/components/ucg/project_include.cmake b/components/ucg/project_include.cmake new file mode 100644 index 0000000000..c744fa9882 --- /dev/null +++ b/components/ucg/project_include.cmake @@ -0,0 +1 @@ +idf_build_set_property(COMPILE_OPTIONS "-DUSE_PIN_LIST" APPEND) diff --git a/components/ucg/ucg.kconfig b/components/ucg/ucg.kconfig deleted file mode 100644 index d32dae3be1..0000000000 --- a/components/ucg/ucg.kconfig +++ /dev/null @@ -1,66 +0,0 @@ -menu "Displays" - depends on NODEMCU_CMODULE_UCG - -config UCG_DISPLAY_HX8352C_18X240X400 - depends on NODEMCU_CMODULE_SPI - bool "hx8352c_18x240x400_hw_spi" - default "n" - -config UCG_DISPLAY_ILI9163_18X128X128 - depends on NODEMCU_CMODULE_SPI - bool "ili9163_18x128x128_hw_spi" - default "n" - -config UCG_DISPLAY_ILI9341_18X240X320 - depends on NODEMCU_CMODULE_SPI - bool "ili9341_18x240x320_hw_spi" - default "y" - -config UCG_DISPLAY_ILI9486_18X320X480 - depends on NODEMCU_CMODULE_SPI - bool "ili9486_18x320x480_hw_spi" - default "n" - -config UCG_DISPLAY_PCF8833_16X132X132 - depends on NODEMCU_CMODULE_SPI - bool "pcf8833_16x132x132_hw_spi" - default "n" - -config UCG_DISPLAY_SEPS225_16X128X128_UNIVISION - depends on NODEMCU_CMODULE_SPI - bool "seps225_16x128x128_uvis_hw_spi" - default "n" - -config UCG_DISPLAY_SSD1351_18X128X128_ILSOFT - depends on NODEMCU_CMODULE_SPI - bool "ssd1351_18x128x128_hw_spi" - default "n" - -config UCG_DISPLAY_SSD1351_18X128X128_FT - depends on NODEMCU_CMODULE_SPI - bool "ssd1351_18x128x128_ft_hw_spi" - default "n" - -config UCG_DISPLAY_SSD1331_18X96X64_UNIVISION - depends on NODEMCU_CMODULE_SPI - bool "ssd1331_18x96x64_uvis_hw_spi" - default "n" - -config UCG_DISPLAY_ST7735_18X128X160 - depends on NODEMCU_CMODULE_SPI - bool "st7735_18x128x160_hw_spi" - default "y" - -endmenu - -menu "Fonts" - depends on NODEMCU_CMODULE_UCG - -config UCG_FONT_SELECTION - depends on NODEMCU_CMODULE_UCG - string "Font list" - default "font_7x13B_tr,font_helvB08_hr,font_helvB10_hr,font_helvB12_hr,font_helvB18_hr,font_ncenB24_tr,font_ncenR12_tr,font_ncenR14_hr" - help - Enter a comma-separated list of fonts. - -endmenu diff --git a/components/uzlib/CMakeLists.txt b/components/uzlib/CMakeLists.txt new file mode 100644 index 0000000000..970ef4d558 --- /dev/null +++ b/components/uzlib/CMakeLists.txt @@ -0,0 +1,4 @@ +idf_component_register( + SRCS "crc32.c" "uzlib_deflate.c" "uzlib_inflate.c" + INCLUDE_DIRS "." +) diff --git a/components/uzlib/Makefile.projbuild b/components/uzlib/Makefile.projbuild deleted file mode 100644 index f2c522d8d2..0000000000 --- a/components/uzlib/Makefile.projbuild +++ /dev/null @@ -1,2 +0,0 @@ --include $(PROJECT_PATH)/build/include/config/auto.conf - diff --git a/components/uzlib/component.mk b/components/uzlib/component.mk deleted file mode 100644 index f50bec1fa8..0000000000 --- a/components/uzlib/component.mk +++ /dev/null @@ -1 +0,0 @@ -COMPONENT_ADD_INCLUDEDIRS:=. diff --git a/docs/modules/net.md b/docs/modules/net.md index 0c3462c572..37fdab02ab 100644 --- a/docs/modules/net.md +++ b/docs/modules/net.md @@ -274,19 +274,8 @@ none ## net.socket:hold() -Throttle data reception by placing a request to block the TCP receive function. This request is not effective immediately, Espressif recommends to call it while reserving 5*1460 bytes of memory. - -#### Syntax -`hold()` - -#### Parameters -none - -#### Returns -`nil` - -#### See also -[`net.socket:unhold()`](#netsocketunhold) +This call is no longer available, as the underlying functionality was +removed upstream. ## net.socket:on() @@ -337,13 +326,11 @@ srv:on("receive", function(sck, c) buffer = buffer .. c end end) --- throttling could be implemented using socket:hold() -- example: https://github.com/nodemcu/nodemcu-firmware/blob/master/lua_examples/pcm/play_network.lua#L83 ``` #### See also - [`net.createServer()`](#netcreateserver) -- [`net.socket:hold()`](#netsockethold) ## net.socket:send() @@ -418,19 +405,8 @@ end) ## net.socket:unhold() -Unblock TCP receiving data by revocation of a preceding `hold()`. - -#### Syntax -`unhold()` - -#### Parameters -none - -#### Returns -`nil` - -#### See also -[`net.socket:hold()`](#netsockethold) +This call is no longer available as the underlying functionality was +removed upstream. # net.udpsocket Module diff --git a/install.sh b/install.sh new file mode 100755 index 0000000000..cf18df4574 --- /dev/null +++ b/install.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -e + +echo "Installing IDF prerequisites..." + +IDF_DIR=./sdk/esp32-esp-idf + +${IDF_DIR}/install.sh +. ${IDF_DIR}/export.sh + +echo "Installing NodeMCU prerequisites..." + +export PATH=${IDF_PYTHON_ENV_PATH}:${PATH} +pip install -r requirements.txt + +cat << EOF + +Installation of prerequisites complete. +EOF diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000..ce3a0c1d35 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +ziglang>=0.8.0 diff --git a/sdk/esp32-esp-idf b/sdk/esp32-esp-idf index b64b375234..8e3e65a47b 160000 --- a/sdk/esp32-esp-idf +++ b/sdk/esp32-esp-idf @@ -1 +1 @@ -Subproject commit b64b3752342a23469ada0188d4838a4fb96fe172 +Subproject commit 8e3e65a47b7d9b5dc4f52eb56660a748fda1884e diff --git a/sdkconfig.defaults b/sdkconfig.defaults index 11ea055b85..dfff71f0a4 100644 --- a/sdkconfig.defaults +++ b/sdkconfig.defaults @@ -1,45 +1,41 @@ -# set custom partition table for 1.5MB firmware +# Default to 4MB for builds +CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y + +# Set custom partition table for 1.5MB firmware +CONFIG_PARTITION_TABLE_CUSTOM=y CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="components/platform/partitions.csv" -CONFIG_PARTITION_TABLE_FILENAME="components/platform/partitions.csv" CONFIG_PARTITION_TABLE_SINGLE_APP=n CONFIG_PARTITION_TABLE_TWO_OTA=n -CONFIG_PARTITION_TABLE_CUSTOM=y - -# Default to 4MB for builds -CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y -# Don't warn about undefined variables -CONFIG_MAKE_WARN_UNDEFINED_VARIABLES=n +# Squeeze in as much code as we can manage +CONFIG_COMPILER_OPTIMIZATION_SIZE=y # Empirical value to prevent a firmware crash due to stack overflow. -CONFIG_MAIN_TASK_STACK_SIZE=8192 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 -# Enable address reuse for sockets in TIME_WAIT -# see https://github.com/nodemcu/nodemcu-firmware/pull/1838 -CONFIG_LWIP_SO_REUSE=y +# Enable panic handler for task wdt to reset the firmware upon wdt timeout +CONFIG_ESP_TASK_WDT_PANIC=y -# Decrease the duration of sockets in TIME_WAIT -# see https://github.com/nodemcu/nodemcu-firmware/issues/1836 -CONFIG_TCP_MSL=5000 +# Disable advanced features by default +CONFIG_MQTT_TRANSPORT_SSL=n +CONFIG_MQTT_TRANSPORT_WEBSOCKET=n +CONFIG_MQTT_USE_CUSTOM_CONFIG=n # Allow writing to dangerous regions to avoid boot loops when creating filesystem # Symptom: # Mounting flash filesystem... # No filesystem partition found, attempting to create it... # abort() was called at PC 0x400ecddd on core 0 -CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED=y +CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED=y -# Enable panic handler for task wdt to reset the firmware upon wdt timeout -CONFIG_TASK_WDT_PANIC=y +# Enable address reuse for sockets in TIME_WAIT +# see https://github.com/nodemcu/nodemcu-firmware/pull/1838 +CONFIG_LWIP_SO_REUSE=y -# Disable advanced features by default -CONFIG_MQTT_TRANSPORT_SSL=n -CONFIG_MQTT_TRANSPORT_WEBSOCKET=n -CONFIG_MQTT_USE_CUSTOM_CONFIG=n +# Decrease the duration of sockets in TIME_WAIT +# see https://github.com/nodemcu/nodemcu-firmware/issues/1836 +CONFIG_TCP_MSL=5000 # Disable esp-idf's bluetooth component by default. # The bthci module is also disabled and will enable bt when selected CONFIG_BT_ENABLED=n - -# Set "Release" code optimization level for -Os -CONFIG_OPTIMIZATION_LEVEL_RELEASE=y diff --git a/tools/embed_lfs.sh b/tools/embed_lfs.sh index deb3e01846..51fe29f583 100755 --- a/tools/embed_lfs.sh +++ b/tools/embed_lfs.sh @@ -2,7 +2,7 @@ LUA_APP_SRC="$@" -MAP_FILE=build/NodeMCU.map +MAP_FILE=build/nodemcu.map LUAC_OUTPUT=build/luac.out LUAC_CROSS=build/luac_cross/luac.cross @@ -15,18 +15,19 @@ if [ ! -f "${LUAC_CROSS}" ]; then exit 1 fi -LFS_ADDR_SIZE=`grep -E "\.lfs\.reserved[ ]+0x[0-9a-f]+[ ]+0x[0-9a-z]+" ${MAP_FILE} | tr -s ' '` +LFS_ADDR_SIZE=$(grep -E "0x[0-9a-f]+[ ]+0x[0-9a-f]+[ ]+esp-idf/embedded_lfs/libembedded_lfs.a\(lua.flash.store.reserved.S.obj\)" "${MAP_FILE}" | grep -v -w 0x0 | tr -s ' ') if [ -z "${LFS_ADDR_SIZE}" ]; then echo "Error: LFS segment not found. Use 'make clean; make' perhaps?" exit 1 fi -LFS_ADDR=`echo "${LFS_ADDR_SIZE}" | cut -d ' ' -f 3` +LFS_ADDR=$(echo "${LFS_ADDR_SIZE}" | cut -d ' ' -f 2) if [ -z "${LFS_ADDR}" ]; then echo "Error: LFS segment address not found" exit 1 fi -LFS_SIZE=`echo "${LFS_ADDR_SIZE}" | cut -d ' ' -f 4` +# The reported size is +4 due to the length field added by the IDF +LFS_SIZE=$(( $(echo "${LFS_ADDR_SIZE}" | cut -d ' ' -f 3) - 4 )) if [ -z "${LFS_SIZE}" ]; then echo "Error: LFS segment size not found" exit 1 @@ -39,5 +40,7 @@ if [ $? != 0 ]; then echo "Error: luac.cross failed" exit 1 fi +# cmake depencies don't seem to pick up the change to luac.out? +rm -f build/lua.flash.store.reserved make