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
This commit is contained in:
Johny Mattsson 2021-07-15 16:25:25 +10:00
parent 8e0e0cb31c
commit 16ef39e255
93 changed files with 1672 additions and 1563 deletions

View File

@ -9,11 +9,13 @@ addons:
# we can use the system python and python-serial, rather than messing around # we can use the system python and python-serial, rather than messing around
# with pip all over the place # with pip all over the place
install: install:
- export PATH=$PWD/tools/toolchains/esp8266/bin:$PWD/tools/toolchains/esp32/bin:/bin:/usr/bin:/sbin:/usr/sbin - export PATH=/bin:/usr/bin:/sbin:/usr/sbin
- /usr/bin/python -m pip install --user -r $PWD/sdk/esp32-esp-idf/requirements.txt - ./install.sh
script: script:
- export BUILD_DATE=$(date +%Y%m%d) - export BUILD_DATE=$(date +%Y%m%d)
- env BUILD_DIR_BASE=`pwd`/build/float make MORE_CFLAGS="-DBUILD_DATE='\"'$BUILD_DATE'\"'" defconfig all - cp sdkconfig.defaults sdkconfig
- env BUILD_DIR_BASE=`pwd`/build/integer make MORE_CFLAGS="-DLUA_NUMBER_INTEGRAL -DBUILD_DATE='\"'$BUILD_DATE'\"'" defconfig all - 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 # 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 #- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bash "$TRAVIS_BUILD_DIR"/tools/pr-build.sh; fi

3
CMakeLists.txt Normal file
View File

@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(nodemcu)

View File

@ -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),) ifeq ($(IDF_PATH),)
THIS_MK_FILE:=$(notdir $(lastword $(MAKEFILE_LIST))) THIS_MK_FILE:=$(notdir $(lastword $(MAKEFILE_LIST)))
THIS_DIR:=$(abspath $(dir $(lastword $(MAKEFILE_LIST)))) THIS_DIR:=$(abspath $(dir $(lastword $(MAKEFILE_LIST))))
IDF_PATH=$(THIS_DIR)/sdk/esp32-esp-idf IDF_PATH=$(THIS_DIR)/sdk/esp32-esp-idf
TOOLCHAIN_RELEASES_BASEURL:=https://github.com/jmattsson/esp-toolchains/releases/ all:
TOOLCHAIN_VERSION:=20181106.1 . $(IDF_PATH)/export.sh && $(MAKE) "$@"
PLATFORM:=linux-$(shell uname --machine)
## Directory to place external modules: %:
export EXTRA_COMPONENT_DIRS:=$(THIS_DIR)/components/modules/external . $(IDF_PATH)/export.sh && $(MAKE) "$@"
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)
$(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; }
else else
PROJECT_NAME:=NodeMCU all:
$(IDF_PATH)/tools/idf.py $(IDFPY_ARGS) "$@"
# This is, sadly, the cleanest way to resolve the different non-standard %:
# conventions for sized integers across the various components. $(IDF_PATH)/tools/idf.py $(IDFPY_ARGS) "$@"
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
$(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)
endif endif
extmod-update: # FIXME - needs updating to work in IDF4
@tools/extmod/extmod.sh update #
#extmod-update:
extmod-clean: # @tools/extmod/extmod.sh update
@tools/extmod/extmod.sh clean #
#extmod-clean:
## @tools/extmod/extmod.sh clean

View File

@ -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"
)

View File

@ -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

View File

@ -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 $@

View File

@ -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"

View File

@ -65,7 +65,8 @@ typedef struct {
nodemcu_esp_event_cb callback; nodemcu_esp_event_cb callback;
} nodemcu_esp_event_reg_t; } 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) \ #define NODEMCU_ESP_EVENT(evcode, func) \
static const LOCK_IN_SECTION(esp_event_cb_table) \ static const LOCK_IN_SECTION(esp_event_cb_table) \

View File

@ -63,11 +63,21 @@ const LOCK_IN_SECTION(zzzzzzzz) char _ro_end[1] = {0};
#endif #endif
LROT_PUBLIC_BEGIN(LOCK_IN_SECTION(rotable) lua_rotables) LROT_PUBLIC_BEGIN(LOCK_IN_SECTION(rotable) lua_rotables)
#ifdef CONFIG_LUA_BUILTIN_STRING
LROT_TABENTRY( string, strlib ) LROT_TABENTRY( string, strlib )
#endif
#ifdef CONFIG_LUA_BUILTIN_TABLE
LROT_TABENTRY( table, tab_funcs ) LROT_TABENTRY( table, tab_funcs )
LROT_TABENTRY( debug, dblib) #endif
#ifdef CONFIG_LUA_BUILTIN_COROUTINE
LROT_TABENTRY( coroutine, co_funcs ) 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 ) LROT_TABENTRY( math, math )
#endif
LROT_TABENTRY( ROM, lua_rotables ) LROT_TABENTRY( ROM, lua_rotables )
#ifdef LUA_CROSS_COMPILER #ifdef LUA_CROSS_COMPILER
LROT_TABENTRY( os, oslib ) LROT_TABENTRY( os, oslib )
@ -80,9 +90,15 @@ LROT_BREAK(lua_rotables)
LROT_PUBLIC_BEGIN(LOCK_IN_SECTION(libs) lua_libs) LROT_PUBLIC_BEGIN(LOCK_IN_SECTION(libs) lua_libs)
LROT_FUNCENTRY( _, luaopen_base ) LROT_FUNCENTRY( _, luaopen_base )
LROT_FUNCENTRY( package, luaopen_package ) LROT_FUNCENTRY( package, luaopen_package )
#ifdef CONFIG_LUA_BUILTIN_STRING
LROT_FUNCENTRY( string, luaopen_string ) LROT_FUNCENTRY( string, luaopen_string )
#endif
#ifdef CONFIG_LUA_BUILTIN_TABLE
LROT_FUNCENTRY( table, luaopen_table ) LROT_FUNCENTRY( table, luaopen_table )
#endif
#ifdef CONFIG_LUA_BUILTIN_DEBUG
LROT_FUNCENTRY( debug, luaopen_debug ) LROT_FUNCENTRY( debug, luaopen_debug )
#endif
#ifndef LUA_CROSS_COMPILER #ifndef LUA_CROSS_COMPILER
LROT_BREAK(lua_rotables) LROT_BREAK(lua_rotables)
#else #else

View File

@ -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)

View File

@ -16,7 +16,6 @@
#include "sdkconfig.h" #include "sdkconfig.h"
#include "esp_system.h" #include "esp_system.h"
#include "esp_event.h" #include "esp_event.h"
#include "esp_event_loop.h"
#include "nvs_flash.h" #include "nvs_flash.h"
#include "flash_api.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; system_event_t evt;
while (xQueueReceive (esp_event_queue, &evt, 0) == pdPASS) while (xQueueReceive (esp_event_queue, &evt, 0) == pdPASS)
{ {
nodemcu_esp_event_reg_t *evregs; nodemcu_esp_event_reg_t *evregs = &_esp_event_cb_table_start;
for (evregs = &esp_event_cb_table; evregs->callback; ++evregs) for (; evregs < &_esp_event_cb_table_end; ++evregs)
{ {
if (evregs->event_id == evt.event_id) if (evregs->event_id == evt.event_id)
evregs->callback (&evt); evregs->callback (&evt);
@ -126,7 +125,7 @@ void nodemcu_init(void)
return; 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 // This can take a while, so be nice and provide some feedback while waiting
printf ("Mounting flash filesystem...\n"); printf ("Mounting flash filesystem...\n");
if (!vfs_mount("/FLASH", 0)) { if (!vfs_mount("/FLASH", 0)) {
@ -155,12 +154,12 @@ void app_main (void)
esp_event_loop_init(bounce_events, NULL); esp_event_loop_init(bounce_events, NULL);
ConsoleSetup_t cfg; 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.data_bits = CONSOLE_NUM_BITS_8;
cfg.parity = CONSOLE_PARITY_NONE; cfg.parity = CONSOLE_PARITY_NONE;
cfg.stop_bits = CONSOLE_STOP_BITS_1; cfg.stop_bits = CONSOLE_STOP_BITS_1;
cfg.auto_baud = cfg.auto_baud =
#ifdef CONFIG_CONSOLE_BIT_RATE_AUTO #ifdef CONFIG_NODEMCU_CONSOLE_BIT_RATE_AUTO
true; true;
#else #else
false; false;
@ -172,7 +171,7 @@ void app_main (void)
nodemcu_init (); nodemcu_init ();
nvs_flash_init (); nvs_flash_init ();
tcpip_adapter_init (); esp_netif_init ();
start_lua (); start_lua ();
task_pump_messages (); task_pump_messages ();

View File

@ -0,0 +1,4 @@
idf_component_register(
SRCS "CAN.c"
INCLUDE_DIRS "include"
)

View File

@ -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.
#

View File

@ -0,0 +1,5 @@
idf_component_register(
SRCS "console.c"
INCLUDE_DIRS "include"
REQUIRES "task" "esp32"
)

View File

@ -1 +0,0 @@
COMPONENT_ADD_INCLUDEDIRS:=include

View File

@ -32,7 +32,6 @@
*/ */
#include "driver/console.h" #include "driver/console.h"
#include "esp_intr.h"
#include "esp_intr_alloc.h" #include "esp_intr_alloc.h"
#include "soc/soc.h" #include "soc/soc.h"
#include "soc/uart_reg.h" #include "soc/uart_reg.h"
@ -41,7 +40,7 @@
#include "freertos/queue.h" #include "freertos/queue.h"
#include <unistd.h> #include <unistd.h>
#include "rom/libc_stubs.h" #include "esp32/rom/libc_stubs.h"
#include "sys/reent.h" #include "sys/reent.h"
#define UART_INPUT_QUEUE_SZ 0x100 #define UART_INPUT_QUEUE_SZ 0x100

View File

@ -31,12 +31,12 @@
* @author Johny Mattsson <jmattsson@dius.com.au> * @author Johny Mattsson <jmattsson@dius.com.au>
*/ */
#include "rom/uart.h" #include "esp32/rom/uart.h"
#include "task/task.h" #include "task/task.h"
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#define CONSOLE_UART CONFIG_CONSOLE_UART_NUM #define CONSOLE_UART CONFIG_ESP_CONSOLE_UART_NUM
typedef enum typedef enum
{ {

View File

@ -0,0 +1,5 @@
idf_component_register(
SRCS "i2c_sw_master.c"
INCLUDE_DIRS "include"
REQUIRES "esp32"
)

View File

@ -1 +0,0 @@
COMPONENT_ADD_INCLUDEDIRS:=include

View File

@ -1,7 +1,7 @@
#ifndef __I2C_SW_MASTER_H__ #ifndef __I2C_SW_MASTER_H__
#define __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 #define I2C_NUM_MAX 1

View File

@ -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()

View File

@ -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

View File

@ -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)

View File

@ -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?

View File

@ -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

View File

@ -100,7 +100,7 @@
#define FF_USE_LFN 3 #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). /* The FF_USE_LFN switches the support for LFN (long file name).
/ /
/ 0: Disable LFN. FF_MAX_LFN has no effect. / 0: Disable LFN. FF_MAX_LFN has no effect.

View File

@ -301,8 +301,8 @@ static void myfatfs_fill_stat( const FILINFO *fno, struct vfs_stat *buf )
memset( buf, 0, sizeof( struct vfs_stat ) ); memset( buf, 0, sizeof( struct vfs_stat ) );
// fill in supported stat entries // fill in supported stat entries
strncpy( buf->name, fno->fname, CONFIG_FS_OBJ_NAME_LEN+1 ); strncpy( buf->name, fno->fname, CONFIG_NODEMCU_FS_OBJ_NAME_LEN+1 );
buf->name[CONFIG_FS_OBJ_NAME_LEN] = '\0'; buf->name[CONFIG_NODEMCU_FS_OBJ_NAME_LEN] = '\0';
buf->size = fno->fsize; buf->size = fno->fsize;
buf->is_dir = fno->fattrib & AM_DIR ? 1 : 0; buf->is_dir = fno->fattrib & AM_DIR ? 1 : 0;
buf->is_rdonly = fno->fattrib & AM_RDO ? 1 : 0; buf->is_rdonly = fno->fattrib & AM_RDO ? 1 : 0;

View File

@ -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
)

81
components/lua/Kconfig Normal file
View File

@ -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

View File

@ -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) \

View File

@ -12,7 +12,7 @@ extern char _irom0_text_end;
#define RODATA_START_ADDRESS (&_irom0_text_start) #define RODATA_START_ADDRESS (&_irom0_text_start)
#define RODATA_END_ADDRESS (&_irom0_text_end) #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_START_ADDRESS ((char*)0x3F400000)
#define RODATA_END_ADDRESS ((char*)0x3F800000) #define RODATA_END_ADDRESS ((char*)0x3F800000)

View File

@ -1 +0,0 @@
COMPONENT_ADD_INCLUDEDIRS:=.

View File

@ -81,7 +81,7 @@ struct OUTPUT {
} *out; } *out;
#ifdef CONFIG_LUA_EMBEDDED_FLASH_STORE #ifdef CONFIG_NODEMCU_EMBEDDED_LFS_SIZE
extern const char lua_flash_store_reserved[0]; extern const char lua_flash_store_reserved[0];
#endif #endif
@ -110,7 +110,7 @@ LUA_API void dumpStrings(lua_State *L) {
} }
#endif #endif
#ifndef CONFIG_LUA_EMBEDDED_FLASH_STORE #ifndef CONFIG_NODEMCU_EMBEDDED_LFS_SIZE
/* ===================================================================================== /* =====================================================================================
* The next 4 functions: flashPosition, flashSetPosition, flashBlock and flashErase * The next 4 functions: flashPosition, flashSetPosition, flashBlock and flashErase
* wrap writing to flash. The last two are platform dependent. Also note that any * 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 * Hook in lstate.c:f_luaopen() to set up ROstrt and ROpvmain if needed
*/ */
LUAI_FUNC void luaN_init (lua_State *L) { LUAI_FUNC void luaN_init (lua_State *L) {
#ifdef CONFIG_LUA_EMBEDDED_FLASH_STORE #ifdef CONFIG_NODEMCU_EMBEDDED_LFS_SIZE
flashSize = CONFIG_LUA_EMBEDDED_FLASH_STORE; flashSize = CONFIG_NODEMCU_EMBEDDED_LFS_SIZE;
flashAddr = lua_flash_store_reserved; flashAddr = lua_flash_store_reserved;
flashAddrPhys = spi_flash_cache2phys(lua_flash_store_reserved); flashAddrPhys = spi_flash_cache2phys(lua_flash_store_reserved);
if (flashAddrPhys == SPI_FLASH_CACHE2PHYS_FAIL) { 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). * Library function called by node.flashreload(filename).
*/ */
LUALIB_API int luaN_reload_reboot (lua_State *L) { 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 // Updating the LFS section is disabled for now because any changes to the
// image requires updating its checksum to prevent boot failure. // image requires updating its checksum to prevent boot failure.
lua_pushstring(L, "Not allowed to write to LFS section"); 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(); esp_restart();
return 0; 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; 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 * 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 * deflate routines. The standard NodeMCU make also makes two host tools uz_zip

View File

@ -266,7 +266,7 @@ static int runargs (lua_State *L, char **argv, int n) {
static int handle_luainit (lua_State *L) { static int handle_luainit (lua_State *L) {
const char *init = LUA_INIT_STRING; const char *init = LUA_INIT_STRING;
if (init[0] == '@') { if (init[0] == '@') {
#if CONFIG_LUA_EMBEDDED_FLASH_STORE > 0 #if CONFIG_NODEMCU_EMBEDDED_LFS_SIZE > 0
int status = dolfsfile(L, init+1); int status = dolfsfile(L, init+1);
if (status == 0) if (status == 0)
return status; return status;

View File

@ -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()

View File

@ -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
)

View File

@ -1,10 +1,19 @@
all: build all: build
ifeq ($V,) HOSTCC?=$(PYTHON) -m ziglang cc
Q:=@
# 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 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 ifeq ($V,)
Q:=@
endif
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_LDFLAGS:= -ldl -lm
LUAC_DEFINES += -DLUA_CROSS_COMPILER -DLUA_USE_STDIO 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) LUAC_OBJS+=$(LUAC_NODEMCUSRC:$(COMPONENT_PATH)/../base_nodemcu/%.c=$(LUAC_BUILD_DIR)/%.o)
ifneq ($(WITHOUT_DEPS),1)
LUAC_DEPS:=$(LUAC_OBJS:%.o=%.d) LUAC_DEPS:=$(LUAC_OBJS:%.o=%.d)
endif
LUAC_CROSS:=$(LUAC_BUILD_DIR)/luac.cross LUAC_CROSS:=$(LUAC_BUILD_DIR)/luac.cross
$(LUAC_BUILD_DIR): $(LUAC_BUILD_DIR):
@mkdir -p "$@" @mkdir -p "$@"
$(LUAC_BUILD_DIR)/%.o: | $(LUAC_BUILD_DIR) $(LUAC_BUILD_DIR)/%.o: %.c | $(LUAC_BUILD_DIR)
@echo '[hostcc] $(notdir $@)' @echo '[hostcc] $(notdir $@)'
$Q$(HOSTCC) $(LUAC_DEFINES) $(LUAC_CFLAGS) "$<" -c -o "$@" $Q$(HOSTCC) $(LUAC_DEFINES) $(LUAC_CFLAGS) "$<" -c -o "$@"

View File

@ -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

View File

@ -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_<modname> and if enabled, add a
# "-u <modname>_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
)

View File

@ -1,274 +1,229 @@
menu "NodeMCU modules" menu "NodeMCU modules"
menu "Core Lua modules" config NODEMCU_CMODULE_ADC
bool "ADC module"
default "n"
help
Includes the adc module. This module provides access to the
adc1 hardware.
config LUA_BUILTIN_STRING config NODEMCU_CMODULE_BIT
bool "String module" bool "Bit module"
default "y" default "n"
help help
Includes the string module (recommended). Includes the bit module. This module provide bit manipulation
functions on Lua numbers.
config LUA_BUILTIN_TABLE config NODEMCU_CMODULE_BTHCI
bool "Table module" bool "BlueTooth HCI interface module"
default "y" default "n"
help select BT_ENABLED
Includes the table module (recommended). help
Includes the simple BlueTooth HCI module.
config LUA_BUILTIN_COROUTINE config NODEMCU_CMODULE_CAN
bool "Coroutine module" bool "CAN module"
default "y" default "n"
help help
Includes the coroutine module (recommended). Includes the can module.
config LUA_BUILTIN_MATH config NODEMCU_CMODULE_CRYPTO
bool "Math module" bool "Crypto module"
default "y" default "n"
help help
Includes the math module (recommended). Includes the crypto module.
config LUA_BUILTIN_DEBUG config NODEMCU_CMODULE_DAC
bool "Debug module" bool "DAC module"
default "n" default "n"
help help
Includes the debug module. Includes the dac module.
config LUA_BUILTIN_DEBUG_EXTENDED config NODEMCU_CMODULE_DHT
depends on LUA_BUILTIN_DEBUG bool "DHT11/21/22/AM2301/AM2302 module"
bool "Extended debug support" default "n"
default "n" help
help Includes the dht module.
Includes the full debug module, rather than just getregistry and traceback.
config LUA_BUILTIN_DEBUG_MINIMAL config NODEMCU_CMODULE_ENCODER
depends on LUA_BUILTIN_DEBUG bool "Encoder module"
bool default "n"
default !LUA_BUILTIN_DEBUG_EXTENDED help
Includes the encoder module. This provides hex and base64 encoding
endmenu and decoding functionality.
config NODEMCU_CMODULE_ETH
config NODEMCU_CMODULE_ADC bool "Ethernet module"
bool "ADC module" default "n"
default "n" help
help Includes the ethernet module.
Includes the adc module. This module provides access to the
adc1 hardware. config NODEMCU_CMODULE_FILE
bool "File module"
config NODEMCU_CMODULE_BIT default "y"
bool "Bit module" help
default "n" Includes the file module (recommended).
help
Includes the bit module. This module provide bit manipulation functions config NODEMCU_CMODULE_GPIO
on Lua numbers. bool "GPIO module"
default "y"
config NODEMCU_CMODULE_BTHCI help
bool "BlueTooth HCI interface module" Includes the GPIO module (recommended).
default "n"
select BT_ENABLED config NODEMCU_CMODULE_HTTP
help bool "HTTP module"
Includes the simple BlueTooth HCI module. default "y"
help
config NODEMCU_CMODULE_CAN Includes the HTTP module (recommended).
bool "CAN module"
default "n" config NODEMCU_CMODULE_I2C
help bool "I2C module"
Includes the can module. default "y"
help
config NODEMCU_CMODULE_CRYPTO Includes the I2C module (recommended).
bool "Crypto module"
default "n" config NODEMCU_CMODULE_I2S
help bool "I2S module"
Includes the crypto module. default "n"
help
config NODEMCU_CMODULE_DAC Includes the I2S module.
bool "DAC module"
default "n" config NODEMCU_CMODULE_LEDC
help bool "LEDC module"
Includes the dac module. default "n"
help
config NODEMCU_CMODULE_DHT Includes the LEDC module.
bool "DHT11/21/22/AM2301/AM2302 module"
default "n" config NODEMCU_CMODULE_MQTT
help bool "MQTT module"
Includes the dht module. default "n"
help
config NODEMCU_CMODULE_ENCODER Includes the MQTT module.
bool "Encoder module"
default "n" config NODEMCU_CMODULE_NET
help bool "Net module"
Includes the encoder module. This provides hex and base64 encoding and default "y"
decoding functionality. help
Includes the net module (recommended).
config NODEMCU_CMODULE_ETH
bool "Ethernet module" config NODEMCU_CMODULE_NODE
default "n" bool "Node module"
help default "y"
Includes the ethernet module. help
Includes the node module (recommended).
config NODEMCU_CMODULE_FILE
bool "File module" config NODEMCU_CMODULE_OW
default "y" bool "1-Wire module"
help default "y"
Includes the file module (recommended). help
Includes the 1-Wire (ow) module (recommended).
config NODEMCU_CMODULE_GPIO
bool "GPIO module" config NODEMCU_CMODULE_OTAUPGRADE
default "y" bool "Over-The-Air upgrade module"
help default "n"
Includes the GPIO module (recommended). help
Includes the over-the-air firmware upgrade module. Use of this
config NODEMCU_CMODULE_HTTP requires a partition table with at least two OTA partitions, plus
bool "HTTP module" the OTA data partition. See the IDF documentation for details.
default "y"
help config NODEMCU_CMODULE_PULSECNT
Includes the HTTP module (recommended). bool "Pulse counter module"
default "n"
config NODEMCU_CMODULE_I2C help
bool "I2C module" Includes the pulse counter module to use ESP32's built-in pulse
default "y" counting hardware.
help
Includes the I2C module (recommended). config NODEMCU_CMODULE_QRCODEGEN
bool "QR Code Generator module"
config NODEMCU_CMODULE_I2S default "n"
bool "I2S module" help
default "n" Includes the QR Code Generator from
help https://www.nayuki.io/page/qr-code-generator-library
Includes the I2S module.
config NODEMCU_CMODULE_SDMMC
config NODEMCU_CMODULE_LEDC bool "SD-MMC module"
bool "LEDC module" default "n"
default "n" help
help Includes the sdmmc module.
Includes the LEDC module.
config NODEMCU_CMODULE_SIGMA_DELTA
config NODEMCU_CMODULE_MQTT bool "Sigma-Delta module"
bool "MQTT module" default "n"
default "n" help
help Includes the sigma_delta module. This module provides access to
Includes the MQTT module. the sigma-delta hardware.
config NODEMCU_CMODULE_NET config NODEMCU_CMODULE_SJSON
bool "Net module" bool "SJSON module"
default "y" default "n"
help help
Includes the net module (recommended). Includes the sjson module.
config NODEMCU_CMODULE_NODE config NODEMCU_CMODULE_SODIUM
bool "Node module" bool "Sodium module"
default "y" default "n"
help help
Includes the node module (recommended). Includes the libsodium crypto module.
config NODEMCU_CMODULE_OW config NODEMCU_CMODULE_SPI
bool "1-Wire module" bool "SPI module"
default "y" default "n"
help help
Includes the 1-Wire (ow) module (recommended). Includes the spi module.
config NODEMCU_CMODULE_OTAUPGRADE config NODEMCU_CMODULE_STRUCT
bool "Over-The-Air upgrade module" bool "Struct module"
default "n" default "n"
help help
Includes the over-the-air firmware upgrade module. Use of this requires Includes the struct module. This module provides [un]packing of
a partition table with at least two OTA partitions, plus the OTA data raw byte strings into Lua values and vice versa.
partition. See the IDF documentation for details.
config NODEMCU_CMODULE_TMR
config NODEMCU_CMODULE_PULSECNT bool "Timer module"
bool "Pulse counter module" default "y"
default "n" help
help Includes the timer module (recommended).
Includes the pulse counter module to use ESP32's built-in pulse counting hardware.
config NODEMCU_CMODULE_TOUCH
config NODEMCU_CMODULE_QRCODEGEN bool "Touch module"
bool "QR Code Generator module" default "n"
default "n" help
help Includes the touch module to use ESP32's built-in touch sensor
Includes the QR Code Generator from hardware.
https://www.nayuki.io/page/qr-code-generator-library
config NODEMCU_CMODULE_U8G2
config NODEMCU_CMODULE_SDMMC bool "U8G2 module"
bool "SD-MMC module" default "n"
default "n" help
help Includes the u8g2 module.
Includes the sdmmc module.
rsource "../u8g2/Kconfig.u8g2"
config NODEMCU_CMODULE_SIGMA_DELTA
bool "Sigma-Delta module" config NODEMCU_CMODULE_UCG
default "n" bool "UCG module"
help default "n"
Includes the sigma_delta module. This module provides access to the select NODEMCU_CMODULE_SPI
sigma-delta hardware. help
Includes the ucg module.
config NODEMCU_CMODULE_SJSON
bool "SJSON module" rsource "../ucg/Kconfig.ucg"
default "n"
help config NODEMCU_CMODULE_WIFI
Includes the sjson module. bool "WiFi module"
default "y"
config NODEMCU_CMODULE_SODIUM help
bool "Sodium module" Includes the WiFi module (recommended).
default "n"
help config NODEMCU_CMODULE_WS2812
Includes the libsodium crypto module. bool "WS2812 module"
default "n"
config NODEMCU_CMODULE_SPI help
bool "SPI module" Includes the ws2812 module.
default "n"
help config NODEMCU_CMODULE_TIME
Includes the spi module. bool "Time module"
default "n"
config NODEMCU_CMODULE_STRUCT help
bool "Struct module" Includes the time 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.
endmenu endmenu

View File

@ -1,38 +0,0 @@
# Match up all the module source files with their corresponding Kconfig
# option in the form NODEMCU_CMODULE_<modname> and if enabled, add a
# "-u <modname>_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 < $^ > $@

View File

@ -147,7 +147,7 @@ static int file_obj_free( lua_State *L )
return 0; return 0;
} }
#ifdef CONFIG_BUILD_SPIFFS #ifdef CONFIG_NODEMCU_BUILD_SPIFFS
// Lua: format() // Lua: format()
static int file_format( lua_State* L ) 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 *fname = luaL_checklstring( L, 1, &len );
const char *basename = vfs_basename( fname ); 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"); const char *mode = luaL_optstring(L, 2, "r");
@ -265,7 +265,7 @@ static int file_exists( lua_State* L )
size_t len; size_t len;
const char *fname = luaL_checklstring( L, 1, &len ); const char *fname = luaL_checklstring( L, 1, &len );
const char *basename = vfs_basename( fname ); 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; struct vfs_stat stat;
lua_pushboolean(L, vfs_stat((char *)fname, &stat) == VFS_RES_OK ? 1 : 0); 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; size_t len;
const char *fname = luaL_checklstring( L, 1, &len ); const char *fname = luaL_checklstring( L, 1, &len );
const char *basename = vfs_basename( fname ); 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); vfs_remove((char *)fname);
return 0; return 0;
} }
@ -305,11 +305,11 @@ static int file_rename( lua_State* L )
const char *oldname = luaL_checklstring( L, 1, &len ); const char *oldname = luaL_checklstring( L, 1, &len );
const char *basename = vfs_basename( oldname ); 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 ); const char *newname = luaL_checklstring( L, 2, &len );
basename = vfs_basename( newname ); 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 )){ if(0 <= vfs_rename( oldname, newname )){
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
@ -324,7 +324,7 @@ static int file_stat( lua_State* L )
{ {
size_t len; size_t len;
const char *fname = luaL_checklstring( L, 1, &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; struct vfs_stat stat;
if (vfs_stat( (char *)fname, &stat ) != VFS_RES_OK) { if (vfs_stat( (char *)fname, &stat ) != VFS_RES_OK) {
@ -539,7 +539,7 @@ typedef struct {
vfs_vol *vol; vfs_vol *vol;
} volume_type; } volume_type;
#ifdef CONFIG_BUILD_FATFS #ifdef CONFIG_NODEMCU_BUILD_FATFS
// Lua: success = file.chdir("/SD0/") // Lua: success = file.chdir("/SD0/")
static int file_chdir( lua_State *L ) static int file_chdir( lua_State *L )
{ {
@ -571,7 +571,7 @@ LROT_BEGIN(file)
LROT_FUNCENTRY( writeline, file_writeline ) LROT_FUNCENTRY( writeline, file_writeline )
LROT_FUNCENTRY( read, file_read ) LROT_FUNCENTRY( read, file_read )
LROT_FUNCENTRY( readline, file_readline ) LROT_FUNCENTRY( readline, file_readline )
#ifdef CONFIG_BUILD_SPIFFS #ifdef CONFIG_NODEMCU_BUILD_SPIFFS
LROT_FUNCENTRY( format, file_format ) LROT_FUNCENTRY( format, file_format )
LROT_FUNCENTRY( fscfg, file_fscfg ) LROT_FUNCENTRY( fscfg, file_fscfg )
#endif #endif
@ -583,7 +583,7 @@ LROT_BEGIN(file)
LROT_FUNCENTRY( fsinfo, file_fsinfo ) LROT_FUNCENTRY( fsinfo, file_fsinfo )
LROT_FUNCENTRY( on, file_on ) LROT_FUNCENTRY( on, file_on )
LROT_FUNCENTRY( stat, file_stat ) LROT_FUNCENTRY( stat, file_stat )
#ifdef CONFIG_BUILD_FATFS #ifdef CONFIG_NODEMCU_BUILD_FATFS
LROT_FUNCENTRY( chdir, file_chdir ) LROT_FUNCENTRY( chdir, file_chdir )
#endif #endif
LROT_END(file, NULL, 0) LROT_END(file, NULL, 0)

View File

@ -198,8 +198,8 @@ static int node_i2s_start( lua_State *L )
if (i2s_config.mode & I2S_MODE_TX) { if (i2s_config.mode & I2S_MODE_TX) {
// prepare TX task // prepare TX task
char pcName[8]; char pcName[20];
snprintf( pcName, 8, "I2S_tx_%d", i2s_id ); snprintf( pcName, sizeof(pcName), "I2S_tx_%d", i2s_id );
pcName[7] = '\0'; pcName[7] = '\0';
if ((is->tx.queue = xQueueCreate( 2, sizeof( i2s_tx_data_t ) )) == NULL) if ((is->tx.queue = xQueueCreate( 2, sizeof( i2s_tx_data_t ) )) == NULL)
return luaL_error( L, "cannot create queue" ); 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) { if (i2s_config.mode & I2S_MODE_RX) {
// prepare RX task // prepare RX task
char pcName[8]; char pcName[20];
snprintf( pcName, 8, "I2S_rx_%d", i2s_id ); snprintf( pcName, sizeof(pcName), "I2S_rx_%d", i2s_id );
pcName[7] = '\0'; pcName[7] = '\0';
xTaskCreate(task_I2S_rx, pcName, 1024, (void *)i2s_id, ESP_TASK_MAIN_PRIO + 1, &is->rx.taskHandle); xTaskCreate(task_I2S_rx, pcName, 1024, (void *)i2s_id, ESP_TASK_MAIN_PRIO + 1, &is->rx.taskHandle);
} }

View File

@ -150,8 +150,6 @@ typedef struct lnet_userdata {
int cb_sent_ref; int cb_sent_ref;
// Only for TCP: // Only for TCP:
bool connecting; bool connecting;
int hold;
size_t num_held;
size_t num_send; size_t num_send;
int cb_connect_ref; int cb_connect_ref;
int cb_disconnect_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_connect_ref = LUA_NOREF;
ud->client.cb_reconnect_ref = LUA_NOREF; ud->client.cb_reconnect_ref = LUA_NOREF;
ud->client.cb_disconnect_ref = LUA_NOREF; ud->client.cb_disconnect_ref = LUA_NOREF;
ud->client.hold = 0;
ud->client.num_held = 0;
ud->client.connecting = false; ud->client.connecting = false;
case TYPE_UDP_SOCKET: case TYPE_UDP_SOCKET:
ud->client.wait_dns = 0; ud->client.wait_dns = 0;
@ -497,7 +493,6 @@ static int net_listen( lua_State *L ) {
if (!ud->netconn) if (!ud->netconn)
return luaL_error(L, "cannot allocate netconn"); return luaL_error(L, "cannot allocate netconn");
netconn_set_nonblocking(ud->netconn, 1); netconn_set_nonblocking(ud->netconn, 1);
netconn_set_noautorecved(ud->netconn, 1);
err = netconn_bind(ud->netconn, &addr, port); err = netconn_bind(ud->netconn, &addr, port);
if (err == ERR_OK) { if (err == ERR_OK) {
@ -509,7 +504,6 @@ static int net_listen( lua_State *L ) {
if (!ud->netconn) if (!ud->netconn)
return luaL_error(L, "cannot allocate netconn"); return luaL_error(L, "cannot allocate netconn");
netconn_set_nonblocking(ud->netconn, 1); netconn_set_nonblocking(ud->netconn, 1);
netconn_set_noautorecved(ud->netconn, 1);
err = netconn_bind(ud->netconn, &addr, port); err = netconn_bind(ud->netconn, &addr, port);
break; break;
@ -557,7 +551,6 @@ static int net_connect( lua_State *L ) {
if (!ud->netconn) if (!ud->netconn)
return luaL_error(L, "cannot allocate netconn"); return luaL_error(L, "cannot allocate netconn");
netconn_set_nonblocking(ud->netconn, 1); netconn_set_nonblocking(ud->netconn, 1);
netconn_set_noautorecved(ud->netconn, 1);
ud->port = port; ud->port = port;
return lnet_socket_resolve_dns(L, ud, domain, true); 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); 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)) // Lua: client/socket:dns(domain, callback(socket, addr))
static int net_dns( lua_State *L ) { static int net_dns( lua_State *L ) {
lnet_userdata *ud = net_get_udata(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); } while (netbuf_next(p) != -1);
if (p) { if (p)
netbuf_delete(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) { if (err == ERR_OK) {
nud->netconn = newconn; nud->netconn = newconn;
netconn_set_nonblocking(nud->netconn, 1); netconn_set_nonblocking(nud->netconn, 1);
netconn_set_noautorecved(nud->netconn, 1);
nud->netconn->pcb.tcp->so_options |= SOF_KEEPALIVE; nud->netconn->pcb.tcp->so_options |= SOF_KEEPALIVE;
nud->netconn->pcb.tcp->keep_idle = ud->server.timeout * 1000; nud->netconn->pcb.tcp->keep_idle = ud->server.timeout * 1000;
nud->netconn->pcb.tcp->keep_cnt = 1; nud->netconn->pcb.tcp->keep_cnt = 1;
@ -1168,8 +1118,6 @@ LROT_BEGIN(net_tcpsocket)
LROT_FUNCENTRY( close, net_close ) LROT_FUNCENTRY( close, net_close )
LROT_FUNCENTRY( on, net_on ) LROT_FUNCENTRY( on, net_on )
LROT_FUNCENTRY( send, net_send ) LROT_FUNCENTRY( send, net_send )
LROT_FUNCENTRY( hold, net_hold )
LROT_FUNCENTRY( unhold, net_unhold )
LROT_FUNCENTRY( dns, net_dns ) LROT_FUNCENTRY( dns, net_dns )
LROT_FUNCENTRY( getpeer, net_getpeer ) LROT_FUNCENTRY( getpeer, net_getpeer )
LROT_FUNCENTRY( getaddr, net_getaddr ) LROT_FUNCENTRY( getaddr, net_getaddr )

View File

@ -560,7 +560,7 @@ static int node_compile( lua_State* L )
size_t len; size_t len;
const char *fname = luaL_checklstring( L, 1, &len ); const char *fname = luaL_checklstring( L, 1, &len );
const char *basename = vfs_basename( fname ); 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 ); char *output = luaM_malloc( L, len+1 );
strcpy(output, fname); strcpy(output, fname);

View File

@ -13,7 +13,7 @@
lua_pushinteger (L, val); \ lua_pushinteger (L, val); \
lua_setfield (L, -2, key); 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); lua_createtable (L, 0, 9);

View File

@ -27,7 +27,7 @@ CONDITIONS OF ANY KIND, either express or implied.
#include "esp_log.h" #include "esp_log.h"
#include "lextra.h" #include "lextra.h"
#include "soc/rtc_periph.h" #include "soc/rtc_periph.h"
#include "soc/touch_channel.h" #include "soc/touch_sensor_periph.h"
#include <string.h> #include <string.h>

View File

@ -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"
)

View File

@ -1,144 +1,145 @@
menu "Platform config" menu "NodeMCU platform config"
choice CONSOLE_BIT_RATE choice NODEMCU_CONSOLE_BIT_RATE
prompt "UART console default bit rate" prompt "UART console default bit rate"
default CONSOLE_BIT_RATE_115200 default NODEMCU_CONSOLE_BIT_RATE_115200
help help
Configure the default bit rate for the UART console. Configure the default bit rate for the UART console.
The resulting UART setting will be xxx-8N1, where xxx represents the The resulting UART setting will be xxx-8N1, where xxx represents
chosen bit rate. the chosen bit rate.
config CONSOLE_BIT_RATE_300 config NODEMCU_CONSOLE_BIT_RATE_300
bool "300" bool "300"
config CONSOLE_BIT_RATE_600 config NODEMCU_CONSOLE_BIT_RATE_600
bool "600" bool "600"
config CONSOLE_BIT_RATE_1200 config NODEMCU_CONSOLE_BIT_RATE_1200
bool "1200" bool "1200"
config CONSOLE_BIT_RATE_2400 config NODEMCU_CONSOLE_BIT_RATE_2400
bool "2400" bool "2400"
config CONSOLE_BIT_RATE_4800 config NODEMCU_CONSOLE_BIT_RATE_4800
bool "4800" bool "4800"
config CONSOLE_BIT_RATE_9600 config NODEMCU_CONSOLE_BIT_RATE_9600
bool "9600" bool "9600"
config CONSOLE_BIT_RATE_19200 config NODEMCU_CONSOLE_BIT_RATE_19200
bool "19200" bool "19200"
config CONSOLE_BIT_RATE_38400 config NODEMCU_CONSOLE_BIT_RATE_38400
bool "38400" bool "38400"
config CONSOLE_BIT_RATE_57600 config NODEMCU_CONSOLE_BIT_RATE_57600
bool "57600" bool "57600"
config CONSOLE_BIT_RATE_74880 config NODEMCU_CONSOLE_BIT_RATE_74880
bool "74880" bool "74880"
config CONSOLE_BIT_RATE_115200 config NODEMCU_CONSOLE_BIT_RATE_115200
bool "115200" bool "115200"
config CONSOLE_BIT_RATE_230400 config NODEMCU_CONSOLE_BIT_RATE_230400
bool "230400" bool "230400"
config CONSOLE_BIT_RATE_460800 config NODEMCU_CONSOLE_BIT_RATE_460800
bool "460800" bool "460800"
config CONSOLE_BIT_RATE_921600 config NODEMCU_CONSOLE_BIT_RATE_921600
bool "921600" bool "921600"
config CONSOLE_BIT_RATE_1843200 config NODEMCU_CONSOLE_BIT_RATE_1843200
bool "1843200" bool "1843200"
config CONSOLE_BIT_RATE_3683400 config NODEMCU_CONSOLE_BIT_RATE_3683400
bool "3683400" bool "3683400"
endchoice endchoice
config CONSOLE_BIT_RATE config NODEMCU_CONSOLE_BIT_RATE
int int
default 300 if CONSOLE_BIT_RATE_300 default 300 if NODEMCU_CONSOLE_BIT_RATE_300
default 600 if CONSOLE_BIT_RATE_600 default 600 if NODEMCU_CONSOLE_BIT_RATE_600
default 1200 if CONSOLE_BIT_RATE_1200 default 1200 if NODEMCU_CONSOLE_BIT_RATE_1200
default 2400 if CONSOLE_BIT_RATE_2400 default 2400 if NODEMCU_CONSOLE_BIT_RATE_2400
default 4800 if CONSOLE_BIT_RATE_4800 default 4800 if NODEMCU_CONSOLE_BIT_RATE_4800
default 9600 if CONSOLE_BIT_RATE_9600 default 9600 if NODEMCU_CONSOLE_BIT_RATE_9600
default 19200 if CONSOLE_BIT_RATE_19200 default 19200 if NODEMCU_CONSOLE_BIT_RATE_19200
default 38400 if CONSOLE_BIT_RATE_38400 default 38400 if NODEMCU_CONSOLE_BIT_RATE_38400
default 57600 if CONSOLE_BIT_RATE_57600 default 57600 if NODEMCU_CONSOLE_BIT_RATE_57600
default 74880 if CONSOLE_BIT_RATE_74880 default 74880 if NODEMCU_CONSOLE_BIT_RATE_74880
default 115200 if CONSOLE_BIT_RATE_115200 default 115200 if NODEMCU_CONSOLE_BIT_RATE_115200
default 230400 if CONSOLE_BIT_RATE_230400 default 230400 if NODEMCU_CONSOLE_BIT_RATE_230400
default 460800 if CONSOLE_BIT_RATE_460800 default 460800 if NODEMCU_CONSOLE_BIT_RATE_460800
default 921600 if CONSOLE_BIT_RATE_921600 default 921600 if NODEMCU_CONSOLE_BIT_RATE_921600
default 1843200 if CONSOLE_BIT_RATE_1843200 default 1843200 if NODEMCU_CONSOLE_BIT_RATE_1843200
default 3683400 if CONSOLE_BIT_RATE_3683400 default 3683400 if NODEMCU_CONSOLE_BIT_RATE_3683400
config CONSOLE_BIT_RATE_AUTO config NODEMCU_CONSOLE_BIT_RATE_AUTO
bool "UART console auto-baud detection" bool "UART console auto-baud detection"
default "y" default "y"
help help
Enables auto-baud detection for the UART console. Enables auto-baud detection for the UART console.
By typing a few characters into the console shortly after boot, By typing a few characters into the console shortly after boot,
NodeMCU can automatically detect your terminal settings and NodeMCU can automatically detect your terminal settings and
adjust accordingly. adjust accordingly.
If you are doing advanced things with the console, you may want If you are doing advanced things with the console, you may want
to disable this feature. to disable this feature.
config NODE_DEBUG config NODEMCU_NODE_DEBUG
bool "Enable NODE_DBG() output" bool "Enable NODE_DBG() output"
default "n" default "n"
help help
Enable debugging output via NODE_DBG(). This is VERY chatty. Enable debugging output via NODE_DBG(). This is VERY chatty.
For development/debugging use only. For development/debugging use only.
config NODE_ERR config NODEMCU_NODE_ERR
bool "Enable NODE_ERR() output" bool "Enable NODE_ERR() output"
default "y" default "y"
help help
Enable error reporting via NODE_ERR(). Enable error reporting via NODE_ERR().
It is recommended to leave this enabled - if it ever produces output, It is recommended to leave this enabled - if it ever produces
something has gone seriously wrong and you probably want to know about output, something has gone seriously wrong and you probably want
it. to know about it.
config FS_OBJ_NAME_LEN config NODEMCU_FS_OBJ_NAME_LEN
int "Make filesystem object name length" int "Make filesystem object name length"
default 31 default 31
help help
Maximum name of filesystem objects (files, directories). Maximum name of filesystem objects (files, directories).
config SPIFFS_MAX_OPEN_FILES config NODEMCU_SPIFFS_MAX_OPEN_FILES
int "Maximum number of open files for SPIFFS" int "Maximum number of open files for SPIFFS"
default 4 default 4
help help
Maximum number of open files for SPIFFS 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 NODEMCU_BUILD_SPIFFS
config BUILD_SPIFFS bool
bool default "y"
default "y" # I don't think we can deal without SPIFFS at this point, so always on for now
config LUA_EMBED_LFS config NODEMCU_BUILD_FATFS
bool "Embed LFS as part of the NodeMCU firmware" bool "Support for FAT filesystems"
default "n" default "n"
help select NODEMCU_CMODULE_SDMMC
The LFS (Lua Flash Store) normally has its own partition entry, and can help
can be replaced at will. Optionally, the LFS can instead be permanently Include support for accessing FAT filesystems on SD cards.
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 config NODEMCU_EMBED_LFS
looked for in a partition of type 0xC2 and subtype 0x01. 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.
To embed LFS data into firmware, use: The default option is to not embed the LFS, in which case LFS is
./tools/embed_lfs.sh /path/to/file1.lua /path/to/file2.lua ... looked for in a partition of type 0xC2 and subtype 0x01.
config LUA_EMBEDDED_FLASH_STORE To embed LFS data into firmware, use:
hex "Embedded LUA Flash Store size" ./tools/embed_lfs.sh /path/to/file1.lua /path/to/file2.lua ...
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 config NODEMCU_EMBEDDED_LFS_SIZE
bool "Support for FAT filesystems" hex "Embedded LUA Flash Store size"
default "n" default 0x0
select NODEMCU_CMODULE_SDMMC depends on NODEMCU_EMBED_LFS
help help
Include support for accessing FAT filesystems on SD cards. Embedded LUA Flash Store size. Set to zero to use an LFS partition
instead of embedding the LFS within the NodeMCU firmware itself.
endmenu endmenu

View File

@ -1,5 +0,0 @@
COMPONENT_ADD_INCLUDEDIRS:=include
# for u8x8
CPPFLAGS+=-DU8X8_USE_PINS -DU8X8_WITH_USER_PTR
# for ucg
CPPFLAGS+=-DUSE_PIN_LIST

View File

@ -7,7 +7,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include "rom/spi_flash.h" #include "esp32/rom/spi_flash.h"
#include "platform_wdt.h" #include "platform_wdt.h"

View File

@ -23,13 +23,13 @@ enum
}; };
#if CONFIG_NODE_DEBUG #if CONFIG_NODEMCU_NODE_DEBUG
# define NODE_DBG printf # define NODE_DBG printf
#else #else
# define NODE_DBG(...) do{}while(0) # define NODE_DBG(...) do{}while(0)
#endif #endif
#if CONFIG_NODE_ERR #if CONFIG_NODEMCU_NODE_ERR
# define NODE_ERR printf # define NODE_ERR printf
#else #else
# define NODE_ERR(...) do{}while(0) # define NODE_ERR(...) do{}while(0)

View File

@ -18,7 +18,7 @@
// vfs_close - close file descriptor and free memory // vfs_close - close file descriptor and free memory
// fd: file descriptor // fd: file descriptor
// Returns: VFS_RES_OK or negative value in case of error // 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; vfs_file *f = (vfs_file *)fd;
return f ? f->fns->close( f ) : VFS_RES_ERR; return f ? f->fns->close( f ) : VFS_RES_ERR;
} }
@ -28,7 +28,7 @@ inline int32_t vfs_close( int fd ) {
// ptr: destination data buffer // ptr: destination data buffer
// len: requested length // len: requested length
// Returns: Number of bytes read, or VFS_RES_ERR in case of error // 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; vfs_file *f = (vfs_file *)fd;
return f ? f->fns->read( f, ptr, len ) : VFS_RES_ERR; 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 // ptr: source data buffer
// len: requested length // len: requested length
// Returns: Number of bytes written, or VFS_RES_ERR in case of error // 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; vfs_file *f = (vfs_file *)fd;
return f ? f->fns->write( f, ptr, len ) : VFS_RES_ERR; 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_CUR - set pointer to current position + off
// VFS_SEEK_END - set pointer to end of file + off // VFS_SEEK_END - set pointer to end of file + off
// Returns: New position, or VFS_RES_ERR in case of error // 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; vfs_file *f = (vfs_file *)fd;
return f ? f->fns->lseek( f, off, whence ) : VFS_RES_ERR; 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 // vfs_eof - test for end-of-file
// fd: file descriptor // fd: file descriptor
// Returns: 0 if not at end, != 0 if end of file // 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; vfs_file *f = (vfs_file *)fd;
return f ? f->fns->eof( f ) : VFS_RES_ERR; 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 // vfs_tell - get read/write position
// fd: file descriptor // fd: file descriptor
// Returns: Current position // Returns: Current position
inline int32_t vfs_tell( int fd ) { static inline int32_t vfs_tell( int fd ) {
vfs_file *f = (vfs_file *)fd; vfs_file *f = (vfs_file *)fd;
return f ? f->fns->tell( f ) : VFS_RES_ERR; 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 // vfs_flush - flush write cache to file
// fd: file descriptor // fd: file descriptor
// Returns: VFS_RES_OK, or VFS_RES_ERR in case of error // 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; vfs_file *f = (vfs_file *)fd;
return f ? f->fns->flush( f ) : VFS_RES_ERR; 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 // vfs_size - get current file size
// fd: file descriptor // fd: file descriptor
// Returns: File size // Returns: File size
inline uint32_t vfs_size( int fd ) { static inline uint32_t vfs_size( int fd ) {
vfs_file *f = (vfs_file *)fd; vfs_file *f = (vfs_file *)fd;
return f ? f->fns->size( f ) : 0; 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 // vfs_closedir - close directory descriptor and free memory
// dd: dir descriptor // dd: dir descriptor
// Returns: VFS_RES_OK, or VFS_RES_ERR in case of error // 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 // vfs_readdir - read next directory item
// dd: dir descriptor // dd: dir descriptor
// buf: pre-allocated stat structure to be filled in // buf: pre-allocated stat structure to be filled in
// Returns: VFS_RES_OK if next item found, otherwise VFS_RES_ERR // 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 // 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 // vfs_umount - unmount logical drive and free memory
// vol: volume object // vol: volume object
// Returns: VFS_RES_OK, or VFS_RES_ERR in case of error // 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 // file system functions

View File

@ -50,7 +50,7 @@ typedef const struct vfs_file vfs_file;
// stat data // stat data
struct vfs_stat { struct vfs_stat {
uint32_t size; uint32_t size;
char name[CONFIG_FS_OBJ_NAME_LEN+1]; char name[CONFIG_NODEMCU_FS_OBJ_NAME_LEN+1];
struct vfs_time tm; struct vfs_time tm;
uint8_t tm_valid; uint8_t tm_valid;
uint8_t is_dir; uint8_t is_dir;

View File

@ -248,10 +248,10 @@ uint32_t platform_uart_setup( unsigned id, uint32_t baud, int databits, int pari
} }
uart_param_config(id, &cfg); uart_param_config(id, &cfg);
uart_set_pin(id, pins->tx_pin, pins->rx_pin, pins->rts_pin, pins->cts_pin); 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) uart_set_line_inverse(id, (pins->tx_inverse? UART_TXD_INV_M : 0)
| (pins->rx_inverse? UART_INVERSE_RXD : UART_INVERSE_DISABLE) | (pins->rx_inverse? UART_RXD_INV_M : 0)
| (pins->rts_inverse? UART_INVERSE_RTS : UART_INVERSE_DISABLE) | (pins->rts_inverse? UART_RTS_INV_M : 0)
| (pins->cts_inverse? UART_INVERSE_CTS : UART_INVERSE_DISABLE) | (pins->cts_inverse? UART_CTS_INV_M : 0)
); );
if(uart_event_task_id == 0) uart_event_task_id = task_get_id( uart_event_task ); if(uart_event_task_id == 0) uart_event_task_id = task_get_id( uart_event_task );

View File

@ -35,7 +35,6 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include "esp_flash_data_types.h"
#include "esp_flash_partitions.h" #include "esp_flash_partitions.h"
#include "esp_spi_flash.h" #include "esp_spi_flash.h"

View File

@ -0,0 +1,3 @@
if(DEFINED ENV{BUILD_DATE})
idf_build_set_property(COMPILE_OPTIONS -DBUILD_DATE="$ENV{BUILD_DATE}" APPEND)
endif()

View File

@ -1,7 +1,7 @@
#include <string.h> #include <string.h>
#include "rom/ets_sys.h" #include "esp32/rom/ets_sys.h"
#include "driver/gpio.h" #include "driver/gpio.h"
#include "driver/i2c.h" #include "driver/i2c.h"

View File

@ -76,13 +76,13 @@ vfs_vol *vfs_mount( const char *name, int num )
const char *normname = normalize_path( name ); const char *normname = normalize_path( name );
char *outname; char *outname;
#ifdef CONFIG_BUILD_SPIFFS #ifdef CONFIG_NODEMCU_BUILD_SPIFFS
if ((fs_fns = myspiffs_realm( normname, &outname, false ))) { if ((fs_fns = myspiffs_realm( normname, &outname, false ))) {
return fs_fns->mount( outname, num ); return fs_fns->mount( outname, num );
} }
#endif #endif
#ifdef CONFIG_BUILD_FATFS #ifdef CONFIG_NODEMCU_BUILD_FATFS
if ((fs_fns = myfatfs_realm( normname, &outname, false ))) { if ((fs_fns = myfatfs_realm( normname, &outname, false ))) {
vfs_vol *r = fs_fns->mount( outname, num ); vfs_vol *r = fs_fns->mount( outname, num );
free( outname ); free( outname );
@ -99,13 +99,13 @@ int vfs_open( const char *name, const char *mode )
const char *normname = normalize_path( name ); const char *normname = normalize_path( name );
char *outname; char *outname;
#ifdef CONFIG_BUILD_SPIFFS #ifdef CONFIG_NODEMCU_BUILD_SPIFFS
if ((fs_fns = myspiffs_realm( normname, &outname, false ))) { if ((fs_fns = myspiffs_realm( normname, &outname, false ))) {
return (int)fs_fns->open( outname, mode ); return (int)fs_fns->open( outname, mode );
} }
#endif #endif
#ifdef CONFIG_BUILD_FATFS #ifdef CONFIG_NODEMCU_BUILD_FATFS
if ((fs_fns = myfatfs_realm( normname, &outname, false ))) { if ((fs_fns = myfatfs_realm( normname, &outname, false ))) {
int r = (int)fs_fns->open( outname, mode ); int r = (int)fs_fns->open( outname, mode );
free( outname ); free( outname );
@ -122,13 +122,13 @@ vfs_dir *vfs_opendir( const char *name )
const char *normname = normalize_path( name ); const char *normname = normalize_path( name );
char *outname; char *outname;
#ifdef CONFIG_BUILD_SPIFFS #ifdef CONFIG_NODEMCU_BUILD_SPIFFS
if ((fs_fns = myspiffs_realm( normname, &outname, false ))) { if ((fs_fns = myspiffs_realm( normname, &outname, false ))) {
return fs_fns->opendir( outname ); return fs_fns->opendir( outname );
} }
#endif #endif
#ifdef CONFIG_BUILD_FATFS #ifdef CONFIG_NODEMCU_BUILD_FATFS
if ((fs_fns = myfatfs_realm( normname, &outname, false ))) { if ((fs_fns = myfatfs_realm( normname, &outname, false ))) {
vfs_dir *r = fs_fns->opendir( outname ); vfs_dir *r = fs_fns->opendir( outname );
free( outname ); free( outname );
@ -145,13 +145,13 @@ int32_t vfs_stat( const char *name, struct vfs_stat *buf )
const char *normname = normalize_path( name ); const char *normname = normalize_path( name );
char *outname; char *outname;
#ifdef CONFIG_BUILD_SPIFFS #ifdef CONFIG_NODEMCU_BUILD_SPIFFS
if ((fs_fns = myspiffs_realm( normname, &outname, false ))) { if ((fs_fns = myspiffs_realm( normname, &outname, false ))) {
return fs_fns->stat( outname, buf ); return fs_fns->stat( outname, buf );
} }
#endif #endif
#ifdef CONFIG_BUILD_FATFS #ifdef CONFIG_NODEMCU_BUILD_FATFS
if ((fs_fns = myfatfs_realm( normname, &outname, false ))) { if ((fs_fns = myfatfs_realm( normname, &outname, false ))) {
int32_t r = fs_fns->stat( outname, buf ); int32_t r = fs_fns->stat( outname, buf );
free( outname ); free( outname );
@ -168,13 +168,13 @@ int32_t vfs_remove( const char *name )
const char *normname = normalize_path( name ); const char *normname = normalize_path( name );
char *outname; char *outname;
#ifdef CONFIG_BUILD_SPIFFS #ifdef CONFIG_NODEMCU_BUILD_SPIFFS
if ((fs_fns = myspiffs_realm( normname, &outname, false ))) { if ((fs_fns = myspiffs_realm( normname, &outname, false ))) {
return fs_fns->remove( outname ); return fs_fns->remove( outname );
} }
#endif #endif
#ifdef CONFIG_BUILD_FATFS #ifdef CONFIG_NODEMCU_BUILD_FATFS
if ((fs_fns = myfatfs_realm( normname, &outname, false ))) { if ((fs_fns = myfatfs_realm( normname, &outname, false ))) {
int32_t r = fs_fns->remove( outname ); int32_t r = fs_fns->remove( outname );
free( outname ); free( outname );
@ -192,7 +192,7 @@ int32_t vfs_rename( const char *oldname, const char *newname )
const char *normnewname = normalize_path( newname ); const char *normnewname = normalize_path( newname );
char *oldoutname, *newoutname; char *oldoutname, *newoutname;
#ifdef CONFIG_BUILD_SPIFFS #ifdef CONFIG_NODEMCU_BUILD_SPIFFS
if (myspiffs_realm( normoldname, &oldoutname, false )) { if (myspiffs_realm( normoldname, &oldoutname, false )) {
if ((fs_fns = myspiffs_realm( normnewname, &newoutname, false ))) { if ((fs_fns = myspiffs_realm( normnewname, &newoutname, false ))) {
return fs_fns->rename( oldoutname, newoutname ); return fs_fns->rename( oldoutname, newoutname );
@ -200,7 +200,7 @@ int32_t vfs_rename( const char *oldname, const char *newname )
} }
#endif #endif
#ifdef CONFIG_BUILD_FATFS #ifdef CONFIG_NODEMCU_BUILD_FATFS
if (myfatfs_realm( normoldname, &oldoutname, false )) { if (myfatfs_realm( normoldname, &oldoutname, false )) {
if ((fs_fns = myfatfs_realm( normnewname, &newoutname, false ))) { if ((fs_fns = myfatfs_realm( normnewname, &newoutname, false ))) {
int32_t r = fs_fns->rename( oldoutname, newoutname ); int32_t r = fs_fns->rename( oldoutname, newoutname );
@ -219,12 +219,12 @@ int32_t vfs_mkdir( const char *name )
{ {
vfs_fs_fns *fs_fns; vfs_fs_fns *fs_fns;
#ifdef CONFIG_BUILD_SPIFFS #ifdef CONFIG_NODEMCU_BUILD_SPIFFS
// not supported // not supported
(void)fs_fns; (void)fs_fns;
#endif #endif
#ifdef CONFIG_BUILD_FATFS #ifdef CONFIG_NODEMCU_BUILD_FATFS
const char *normname = normalize_path( name ); const char *normname = normalize_path( name );
char *outname; char *outname;
if ((fs_fns = myfatfs_realm( normname, &outname, false ))) { 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 ); const char *normname = normalize_path( name );
#ifdef CONFIG_BUILD_SPIFFS #ifdef CONFIG_NODEMCU_BUILD_SPIFFS
if ((fs_fns = myspiffs_realm( normname, &outname, false ))) { if ((fs_fns = myspiffs_realm( normname, &outname, false ))) {
return fs_fns->fsinfo( total, used ); return fs_fns->fsinfo( total, used );
} }
#endif #endif
#ifdef CONFIG_BUILD_FATFS #ifdef CONFIG_NODEMCU_BUILD_FATFS
if ((fs_fns = myfatfs_realm( normname, &outname, false ))) { if ((fs_fns = myfatfs_realm( normname, &outname, false ))) {
free( outname ); free( outname );
return fs_fns->fsinfo( total, used ); 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; vfs_fs_fns *fs_fns;
char *outname; char *outname;
#ifdef CONFIG_BUILD_SPIFFS #ifdef CONFIG_NODEMCU_BUILD_SPIFFS
if ((fs_fns = myspiffs_realm( "/FLASH", &outname, false ))) { if ((fs_fns = myspiffs_realm( "/FLASH", &outname, false ))) {
return fs_fns->fscfg( phys_addr, phys_size ); return fs_fns->fscfg( phys_addr, phys_size );
} }
#endif #endif
#ifdef CONFIG_BUILD_FATFS #ifdef CONFIG_NODEMCU_BUILD_FATFS
// not supported // not supported
#endif #endif
@ -286,13 +286,13 @@ int32_t vfs_format( void )
vfs_fs_fns *fs_fns; vfs_fs_fns *fs_fns;
char *outname; char *outname;
#ifdef CONFIG_BUILD_SPIFFS #ifdef CONFIG_NODEMCU_BUILD_SPIFFS
if ((fs_fns = myspiffs_realm( "/FLASH", &outname, false ))) { if ((fs_fns = myspiffs_realm( "/FLASH", &outname, false ))) {
return fs_fns->format(); return fs_fns->format();
} }
#endif #endif
#ifdef CONFIG_BUILD_FATFS #ifdef CONFIG_NODEMCU_BUILD_FATFS
// not supported // not supported
#endif #endif
@ -326,7 +326,7 @@ int32_t vfs_chdir( const char *path )
} }
#endif #endif
#ifdef CONFIG_BUILD_SPIFFS #ifdef CONFIG_NODEMCU_BUILD_SPIFFS
if ((fs_fns = myspiffs_realm( normpath, &outname, true ))) { if ((fs_fns = myspiffs_realm( normpath, &outname, true ))) {
// our SPIFFS integration doesn't support directories // our SPIFFS integration doesn't support directories
if (strlen( outname ) == 0) { if (strlen( outname ) == 0) {
@ -335,7 +335,7 @@ int32_t vfs_chdir( const char *path )
} }
#endif #endif
#ifdef CONFIG_BUILD_FATFS #ifdef CONFIG_NODEMCU_BUILD_FATFS
if ((fs_fns = myfatfs_realm( normpath, &outname, true ))) { if ((fs_fns = myfatfs_realm( normpath, &outname, true ))) {
if (strchr( outname, ':' )) { if (strchr( outname, ':' )) {
// need to set FatFS' default drive // need to set FatFS' default drive
@ -361,13 +361,13 @@ int32_t vfs_errno( const char *name )
if (!name) name = ""; // current drive if (!name) name = ""; // current drive
#ifdef CONFIG_BUILD_SPIFFS #ifdef CONFIG_NODEMCU_BUILD_SPIFFS
if ((fs_fns = myspiffs_realm( normname, &outname, false ))) { if ((fs_fns = myspiffs_realm( normname, &outname, false ))) {
return fs_fns->ferrno( ); return fs_fns->ferrno( );
} }
#endif #endif
#ifdef CONFIG_BUILD_FATFS #ifdef CONFIG_NODEMCU_BUILD_FATFS
if ((fs_fns = myfatfs_realm( normname, &outname, false ))) { if ((fs_fns = myfatfs_realm( normname, &outname, false ))) {
int32_t r = fs_fns->ferrno( ); int32_t r = fs_fns->ferrno( );
free( outname ); free( outname );
@ -389,13 +389,13 @@ int32_t vfs_ferrno( int fd )
const char *name = ""; // current drive const char *name = ""; // current drive
char *outname; char *outname;
#ifdef CONFIG_BUILD_SPIFFS #ifdef CONFIG_NODEMCU_BUILD_SPIFFS
if ((fs_fns = myspiffs_realm( name, &outname, false ))) { if ((fs_fns = myspiffs_realm( name, &outname, false ))) {
return fs_fns->ferrno( ); return fs_fns->ferrno( );
} }
#endif #endif
#ifdef CONFIG_BUILD_FATFS #ifdef CONFIG_NODEMCU_BUILD_FATFS
if ((fs_fns = myfatfs_realm( name, &outname, false ))) { if ((fs_fns = myfatfs_realm( name, &outname, false ))) {
int32_t r = fs_fns->ferrno( ); int32_t r = fs_fns->ferrno( );
free( outname ); free( outname );
@ -416,13 +416,13 @@ void vfs_clearerr( const char *name )
const char *normname = normalize_path( name ); const char *normname = normalize_path( name );
#ifdef CONFIG_BUILD_SPIFFS #ifdef CONFIG_NODEMCU_BUILD_SPIFFS
if ((fs_fns = myspiffs_realm( normname, &outname, false ))) { if ((fs_fns = myspiffs_realm( normname, &outname, false ))) {
fs_fns->clearerr( ); fs_fns->clearerr( );
} }
#endif #endif
#ifdef CONFIG_BUILD_FATFS #ifdef CONFIG_NODEMCU_BUILD_FATFS
if ((fs_fns = myfatfs_realm( normname, &outname, false ))) { if ((fs_fns = myfatfs_realm( normname, &outname, false ))) {
fs_fns->clearerr( ); fs_fns->clearerr( );
free( outname ); free( outname );

View File

@ -0,0 +1,4 @@
idf_component_register(
SRCS "qrcodegen/c/qrcodegen.c"
INCLUDE_DIRS "qrcodegen/c"
)

View File

@ -1,3 +0,0 @@
COMPONENT_SRCDIRS:=qrcodegen/c
COMPONENT_OBJS:=qrcodegen/c/qrcodegen.o
COMPONENT_ADD_INCLUDEDIRS:=qrcodegen/c

View File

@ -0,0 +1,4 @@
idf_component_register(
SRCS "hexdump.c" "rtos_dbg.c"
INCLUDE_DIRS "include"
)

View File

@ -1 +0,0 @@
COMPONENT_ADD_INCLUDEDIRS:=include

View File

@ -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
)

View File

@ -1,2 +0,0 @@
COMPONENT_ADD_INCLUDEDIRS:=.
CFLAGS+=-imacros json_config.h

View File

@ -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 )

View File

@ -1,4 +0,0 @@
COMPONENT_ADD_INCLUDEDIRS:=.
# TODO: clean up codebase to be sign clean...
EXTRA_CFLAGS+=-Wno-error=pointer-sign

View File

@ -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()

View File

@ -15,7 +15,7 @@ static spiffs fs;
#define MIN_BLOCKS_FS 4 #define MIN_BLOCKS_FS 4
static u8_t spiffs_work_buf[LOG_PAGE_SIZE*2]; 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 #if SPIFFS_CACHE
static u8_t myspiffs_cache[(LOG_PAGE_SIZE+32)*2]; static u8_t myspiffs_cache[(LOG_PAGE_SIZE+32)*2];
#endif #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 ) ); memset( buf, 0, sizeof( struct vfs_stat ) );
// copy entries to item // copy entries to item
// fill in supported stat entries // fill in supported stat entries
strncpy( buf->name, (char *)dirent.name, CONFIG_FS_OBJ_NAME_LEN+1 ); strncpy( buf->name, (char *)dirent.name, CONFIG_NODEMCU_FS_OBJ_NAME_LEN+1 );
buf->name[CONFIG_FS_OBJ_NAME_LEN] = '\0'; buf->name[CONFIG_NODEMCU_FS_OBJ_NAME_LEN] = '\0';
buf->size = dirent.size; buf->size = dirent.size;
return VFS_RES_OK; 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 ) ); memset( buf, 0, sizeof( struct vfs_stat ) );
// fill in supported stat entries // fill in supported stat entries
strncpy( buf->name, (char *)stat.name, CONFIG_FS_OBJ_NAME_LEN+1 ); strncpy( buf->name, (char *)stat.name, CONFIG_NODEMCU_FS_OBJ_NAME_LEN+1 );
buf->name[CONFIG_FS_OBJ_NAME_LEN] = '\0'; buf->name[CONFIG_NODEMCU_FS_OBJ_NAME_LEN] = '\0';
buf->size = stat.size; buf->size = stat.size;
return VFS_RES_OK; return VFS_RES_OK;
} else { } else {

View File

@ -96,7 +96,7 @@
// zero-termination character, meaning maximum string of characters // zero-termination character, meaning maximum string of characters
// can at most be CONFIG_SPIFFS_OBJ_NAME_LEN - 1. // can at most be CONFIG_SPIFFS_OBJ_NAME_LEN - 1.
#ifndef SPIFFS_OBJ_NAME_LEN #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 #endif
// Size of buffer allocated on stack used when copying data. // Size of buffer allocated on stack used when copying data.

View File

@ -0,0 +1,4 @@
idf_component_register(
SRCS "task.c"
INCLUDE_DIRS "include"
)

View File

@ -1,22 +1,22 @@
menu "NodeMCU task slot configuration" menu "NodeMCU task slot configuration"
config NODEMCU_TASK_SLOT_MEMORY config NODEMCU_TASK_SLOT_MEMORY
int "Task slot buffer size" int "Task slot buffer size"
default 2000 default 2000
range 80 16000 range 80 16000
help help
NodeMCU uses a fixed size RTOS queue for messaging between internal 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 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 small, events and data will go missing. On the other hand, if the
queue is too big, some memory will go unused. queue is too big, some memory will go unused.
The default value is chosen to be on the safe side for most use 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 cases. Lowering this value will yield more available RAM for use
in Lua, but at the increased risk of data loss. Conversely, in Lua, but at the increased risk of data loss. Conversely,
increasing this value can help resolve aforementioned data loss increasing this value can help resolve aforementioned data loss
issues, if encountered. issues, if encountered.
The assigned memory size here gets partitioned to the different The assigned memory size here gets partitioned to the different
task priorities; some rounding down may take place as a result. task priorities; some rounding down may take place as a result.
endmenu endmenu

View File

@ -1 +0,0 @@
COMPONENT_ADD_INCLUDEDIRS:=include

View File

@ -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
)

View File

@ -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

View File

@ -1,3 +0,0 @@
COMPONENT_SRCDIRS:=u8g2/src/clib .
COMPONENT_ADD_INCLUDEDIRS:=u8g2/src/clib
CPPFLAGS+=-DU8X8_USE_PINS -DU8X8_WITH_USER_PTR

View File

@ -0,0 +1,6 @@
foreach(def
"-DU8X8_USE_PINS"
"-DU8X8_WITH_USER_PTR"
)
idf_build_set_property(COMPILE_DEFINITIONS ${def} APPEND)
endforeach()

View File

@ -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

View File

@ -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
)

View File

@ -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

View File

@ -1,3 +0,0 @@
COMPONENT_SRCDIRS:=ucg/src/clib .
COMPONENT_ADD_INCLUDEDIRS:=ucg/src/clib
CPPFLAGS+=-DUSE_PIN_LIST

View File

@ -0,0 +1 @@
idf_build_set_property(COMPILE_OPTIONS "-DUSE_PIN_LIST" APPEND)

View File

@ -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

View File

@ -0,0 +1,4 @@
idf_component_register(
SRCS "crc32.c" "uzlib_deflate.c" "uzlib_inflate.c"
INCLUDE_DIRS "."
)

View File

@ -1,2 +0,0 @@
-include $(PROJECT_PATH)/build/include/config/auto.conf

View File

@ -1 +0,0 @@
COMPONENT_ADD_INCLUDEDIRS:=.

View File

@ -274,19 +274,8 @@ none
## net.socket:hold() ## 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. This call is no longer available, as the underlying functionality was
removed upstream.
#### Syntax
`hold()`
#### Parameters
none
#### Returns
`nil`
#### See also
[`net.socket:unhold()`](#netsocketunhold)
## net.socket:on() ## net.socket:on()
@ -337,13 +326,11 @@ srv:on("receive", function(sck, c)
buffer = buffer .. c buffer = buffer .. c
end end
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 -- example: https://github.com/nodemcu/nodemcu-firmware/blob/master/lua_examples/pcm/play_network.lua#L83
``` ```
#### See also #### See also
- [`net.createServer()`](#netcreateserver) - [`net.createServer()`](#netcreateserver)
- [`net.socket:hold()`](#netsockethold)
## net.socket:send() ## net.socket:send()
@ -418,19 +405,8 @@ end)
## net.socket:unhold() ## net.socket:unhold()
Unblock TCP receiving data by revocation of a preceding `hold()`. This call is no longer available as the underlying functionality was
removed upstream.
#### Syntax
`unhold()`
#### Parameters
none
#### Returns
`nil`
#### See also
[`net.socket:hold()`](#netsockethold)
# net.udpsocket Module # net.udpsocket Module

20
install.sh Executable file
View File

@ -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

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
ziglang>=0.8.0

@ -1 +1 @@
Subproject commit b64b3752342a23469ada0188d4838a4fb96fe172 Subproject commit 8e3e65a47b7d9b5dc4f52eb56660a748fda1884e

View File

@ -1,18 +1,32 @@
# set custom partition table for 1.5MB firmware
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 # Default to 4MB for builds
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
# Don't warn about undefined variables # Set custom partition table for 1.5MB firmware
CONFIG_MAKE_WARN_UNDEFINED_VARIABLES=n CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="components/platform/partitions.csv"
CONFIG_PARTITION_TABLE_SINGLE_APP=n
CONFIG_PARTITION_TABLE_TWO_OTA=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. # 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 panic handler for task wdt to reset the firmware upon wdt timeout
CONFIG_ESP_TASK_WDT_PANIC=y
# 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_DANGEROUS_WRITE_ALLOWED=y
# Enable address reuse for sockets in TIME_WAIT # Enable address reuse for sockets in TIME_WAIT
# see https://github.com/nodemcu/nodemcu-firmware/pull/1838 # see https://github.com/nodemcu/nodemcu-firmware/pull/1838
@ -22,24 +36,6 @@ CONFIG_LWIP_SO_REUSE=y
# see https://github.com/nodemcu/nodemcu-firmware/issues/1836 # see https://github.com/nodemcu/nodemcu-firmware/issues/1836
CONFIG_TCP_MSL=5000 CONFIG_TCP_MSL=5000
# 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
# Enable panic handler for task wdt to reset the firmware upon wdt timeout
CONFIG_TASK_WDT_PANIC=y
# Disable advanced features by default
CONFIG_MQTT_TRANSPORT_SSL=n
CONFIG_MQTT_TRANSPORT_WEBSOCKET=n
CONFIG_MQTT_USE_CUSTOM_CONFIG=n
# Disable esp-idf's bluetooth component by default. # Disable esp-idf's bluetooth component by default.
# The bthci module is also disabled and will enable bt when selected # The bthci module is also disabled and will enable bt when selected
CONFIG_BT_ENABLED=n CONFIG_BT_ENABLED=n
# Set "Release" code optimization level for -Os
CONFIG_OPTIMIZATION_LEVEL_RELEASE=y

View File

@ -2,7 +2,7 @@
LUA_APP_SRC="$@" LUA_APP_SRC="$@"
MAP_FILE=build/NodeMCU.map MAP_FILE=build/nodemcu.map
LUAC_OUTPUT=build/luac.out LUAC_OUTPUT=build/luac.out
LUAC_CROSS=build/luac_cross/luac.cross LUAC_CROSS=build/luac_cross/luac.cross
@ -15,18 +15,19 @@ if [ ! -f "${LUAC_CROSS}" ]; then
exit 1 exit 1
fi 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 if [ -z "${LFS_ADDR_SIZE}" ]; then
echo "Error: LFS segment not found. Use 'make clean; make' perhaps?" echo "Error: LFS segment not found. Use 'make clean; make' perhaps?"
exit 1 exit 1
fi 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 if [ -z "${LFS_ADDR}" ]; then
echo "Error: LFS segment address not found" echo "Error: LFS segment address not found"
exit 1 exit 1
fi 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 if [ -z "${LFS_SIZE}" ]; then
echo "Error: LFS segment size not found" echo "Error: LFS segment size not found"
exit 1 exit 1
@ -39,5 +40,7 @@ if [ $? != 0 ]; then
echo "Error: luac.cross failed" echo "Error: luac.cross failed"
exit 1 exit 1
fi fi
# cmake depencies don't seem to pick up the change to luac.out?
rm -f build/lua.flash.store.reserved
make make