Kconfig: rename LUA_MODULE_* to NODEMCU_CMODULE_* (#3135)

Using the NODEMCU_ namespace prefix makes it obvious that these are not
part of Lua proper (contrast, e.g., LUA_BUILTIN_STRING).  Using
"CMODULE" gives us room to differentiate between modules whose
implementation is in C and whose implemenation is in Lua ("LMODULE").

The ESP8266 branch can adopt the same convention when it moves to
Kconfig; see https://github.com/nodemcu/nodemcu-firmware/issues/3130
This commit is contained in:
Nathaniel Wesley Filardo 2020-08-23 21:49:18 +01:00 committed by GitHub
parent 572f731b61
commit dd3b217df2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 70 additions and 70 deletions

View File

@ -54,12 +54,12 @@
#define LOCK_IN_SECTION(s) __attribute__((used,unused,section(".lua_" #s))) #define LOCK_IN_SECTION(s) __attribute__((used,unused,section(".lua_" #s)))
#endif #endif
/* For the ROM table, we name the variable according to ( | denotes concat): /* For the ROM table, we name the variable according to ( | denotes concat):
* cfgname | _module_selected | CONFIG_LUA_MODULE_##cfgname * cfgname | _module_selected | CONFIG_NODEMCU_CMODULE_##cfgname
* where the CONFIG_LUA_MODULE_XYZ macro is first expanded to yield either * where the CONFIG_NODEMCU_CMODULE_XYZ macro is first expanded to yield either
* an empty string (or 1) if the module has been enabled, or the literal * an empty string (or 1) if the module has been enabled, or the literal
* CONFIG_LUA_MODULE_XYZ in the case it hasn't. Thus, the name of the variable * CONFIG_NODEMCU_CMODULE_XYZ in the case it hasn't. Thus, the name of the variable
* ends up looking either like XYZ_module_enabled, or if not enabled, * ends up looking either like XYZ_module_enabled, or if not enabled,
* XYZ_module_enabledCONFIG_LUA_MODULE_XYZ. This forms the basis for * XYZ_module_enabledCONFIG_NODEMCU_CMODULE_XYZ. This forms the basis for
* letting the build system detect automatically (via nm) which modules need * letting the build system detect automatically (via nm) which modules need
* to be linked in. * to be linked in.
*/ */
@ -67,7 +67,7 @@
const LOCK_IN_SECTION(libs) \ const LOCK_IN_SECTION(libs) \
luaR_entry MODULE_PASTE_(lua_lib_,cfgname) = { luaname, LRO_FUNCVAL(initfunc) }; \ luaR_entry MODULE_PASTE_(lua_lib_,cfgname) = { luaname, LRO_FUNCVAL(initfunc) }; \
const LOCK_IN_SECTION(rotable) \ const LOCK_IN_SECTION(rotable) \
luaR_entry MODULE_EXPAND_PASTE_(cfgname,MODULE_EXPAND_PASTE_(_module_selected,MODULE_PASTE_(CONFIG_LUA_MODULE_,cfgname))) \ luaR_entry MODULE_EXPAND_PASTE_(cfgname,MODULE_EXPAND_PASTE_(_module_selected,MODULE_PASTE_(CONFIG_NODEMCU_CMODULE_,cfgname))) \
= {luaname, LRO_ROVAL(map ## _map)} = {luaname, LRO_ROVAL(map ## _map)}
#endif #endif

View File

@ -47,125 +47,125 @@ depends on LUA_BUILTIN_DEBUG
endmenu endmenu
config LUA_MODULE_ADC config NODEMCU_CMODULE_ADC
bool "ADC module" bool "ADC module"
default "n" default "n"
help help
Includes the adc module. This module provides access to the Includes the adc module. This module provides access to the
adc1 hardware. adc1 hardware.
config LUA_MODULE_BIT config NODEMCU_CMODULE_BIT
bool "Bit module" bool "Bit module"
default "n" default "n"
help help
Includes the bit module. This module provide bit manipulation functions Includes the bit module. This module provide bit manipulation functions
on Lua numbers. on Lua numbers.
config LUA_MODULE_BTHCI config NODEMCU_CMODULE_BTHCI
bool "BlueTooth HCI interface module" bool "BlueTooth HCI interface module"
default "n" default "n"
select BT_ENABLED select BT_ENABLED
help help
Includes the simple BlueTooth HCI module. Includes the simple BlueTooth HCI module.
config LUA_MODULE_CAN config NODEMCU_CMODULE_CAN
bool "CAN module" bool "CAN module"
default "n" default "n"
help help
Includes the can module. Includes the can module.
config LUA_MODULE_CRYPTO config NODEMCU_CMODULE_CRYPTO
bool "Crypto module" bool "Crypto module"
default "n" default "n"
help help
Includes the crypto module. Includes the crypto module.
config LUA_MODULE_DAC config NODEMCU_CMODULE_DAC
bool "DAC module" bool "DAC module"
default "n" default "n"
help help
Includes the dac module. Includes the dac module.
config LUA_MODULE_DHT config NODEMCU_CMODULE_DHT
bool "DHT11/21/22/AM2301/AM2302 module" bool "DHT11/21/22/AM2301/AM2302 module"
default "n" default "n"
help help
Includes the dht module. Includes the dht module.
config LUA_MODULE_ENCODER config NODEMCU_CMODULE_ENCODER
bool "Encoder module" bool "Encoder module"
default "n" default "n"
help help
Includes the encoder module. This provides hex and base64 encoding and Includes the encoder module. This provides hex and base64 encoding and
decoding functionality. decoding functionality.
config LUA_MODULE_ETH config NODEMCU_CMODULE_ETH
bool "Ethernet module" bool "Ethernet module"
default "n" default "n"
help help
Includes the ethernet module. Includes the ethernet module.
config LUA_MODULE_FILE config NODEMCU_CMODULE_FILE
bool "File module" bool "File module"
default "y" default "y"
help help
Includes the file module (recommended). Includes the file module (recommended).
config LUA_MODULE_GPIO config NODEMCU_CMODULE_GPIO
bool "GPIO module" bool "GPIO module"
default "y" default "y"
help help
Includes the GPIO module (recommended). Includes the GPIO module (recommended).
config LUA_MODULE_HTTP config NODEMCU_CMODULE_HTTP
bool "HTTP module" bool "HTTP module"
default "y" default "y"
help help
Includes the HTTP module (recommended). Includes the HTTP module (recommended).
config LUA_MODULE_I2C config NODEMCU_CMODULE_I2C
bool "I2C module" bool "I2C module"
default "y" default "y"
help help
Includes the I2C module (recommended). Includes the I2C module (recommended).
config LUA_MODULE_I2S config NODEMCU_CMODULE_I2S
bool "I2S module" bool "I2S module"
default "n" default "n"
help help
Includes the I2S module. Includes the I2S module.
config LUA_MODULE_LEDC config NODEMCU_CMODULE_LEDC
bool "LEDC module" bool "LEDC module"
default "n" default "n"
help help
Includes the LEDC module. Includes the LEDC module.
config LUA_MODULE_MQTT config NODEMCU_CMODULE_MQTT
bool "MQTT module" bool "MQTT module"
default "n" default "n"
help help
Includes the MQTT module. Includes the MQTT module.
config LUA_MODULE_NET config NODEMCU_CMODULE_NET
bool "Net module" bool "Net module"
default "y" default "y"
help help
Includes the net module (recommended). Includes the net module (recommended).
config LUA_MODULE_NODE config NODEMCU_CMODULE_NODE
bool "Node module" bool "Node module"
default "y" default "y"
help help
Includes the node module (recommended). Includes the node module (recommended).
config LUA_MODULE_OW config NODEMCU_CMODULE_OW
bool "1-Wire module" bool "1-Wire module"
default "y" default "y"
help help
Includes the 1-Wire (ow) module (recommended). Includes the 1-Wire (ow) module (recommended).
config LUA_MODULE_OTAUPGRADE config NODEMCU_CMODULE_OTAUPGRADE
bool "Over-The-Air upgrade module" bool "Over-The-Air upgrade module"
default "n" default "n"
help help
@ -173,70 +173,70 @@ config LUA_MODULE_OTAUPGRADE
a partition table with at least two OTA partitions, plus the OTA data a partition table with at least two OTA partitions, plus the OTA data
partition. See the IDF documentation for details. partition. See the IDF documentation for details.
config LUA_MODULE_PULSECNT config NODEMCU_CMODULE_PULSECNT
bool "Pulse counter module" bool "Pulse counter module"
default "n" default "n"
help help
Includes the pulse counter module to use ESP32's built-in pulse counting hardware. Includes the pulse counter module to use ESP32's built-in pulse counting hardware.
config LUA_MODULE_QRCODEGEN config NODEMCU_CMODULE_QRCODEGEN
bool "QR Code Generator module" bool "QR Code Generator module"
default "n" default "n"
help help
Includes the QR Code Generator from Includes the QR Code Generator from
https://www.nayuki.io/page/qr-code-generator-library https://www.nayuki.io/page/qr-code-generator-library
config LUA_MODULE_SDMMC config NODEMCU_CMODULE_SDMMC
bool "SD-MMC module" bool "SD-MMC module"
default "n" default "n"
help help
Includes the sdmmc module. Includes the sdmmc module.
config LUA_MODULE_SIGMA_DELTA config NODEMCU_CMODULE_SIGMA_DELTA
bool "Sigma-Delta module" bool "Sigma-Delta module"
default "n" default "n"
help help
Includes the sigma_delta module. This module provides access to the Includes the sigma_delta module. This module provides access to the
sigma-delta hardware. sigma-delta hardware.
config LUA_MODULE_SJSON config NODEMCU_CMODULE_SJSON
bool "SJSON module" bool "SJSON module"
default "n" default "n"
help help
Includes the sjson module. Includes the sjson module.
config LUA_MODULE_SODIUM config NODEMCU_CMODULE_SODIUM
bool "Sodium module" bool "Sodium module"
default "n" default "n"
help help
Includes the libsodium crypto module. Includes the libsodium crypto module.
config LUA_MODULE_SPI config NODEMCU_CMODULE_SPI
bool "SPI module" bool "SPI module"
default "n" default "n"
help help
Includes the spi module. Includes the spi module.
config LUA_MODULE_STRUCT config NODEMCU_CMODULE_STRUCT
bool "Struct module" bool "Struct module"
default "n" default "n"
help help
Includes the struct module. This module provides [un]packing of raw Includes the struct module. This module provides [un]packing of raw
byte strings into Lua values and vice versa. byte strings into Lua values and vice versa.
config LUA_MODULE_TMR config NODEMCU_CMODULE_TMR
bool "Timer module" bool "Timer module"
default "y" default "y"
help help
Includes the timer module (recommended). Includes the timer module (recommended).
config LUA_MODULE_TOUCH config NODEMCU_CMODULE_TOUCH
bool "Touch module" bool "Touch module"
default "n" default "n"
help help
Includes the touch module to use ESP32's built-in touch sensor hardware. Includes the touch module to use ESP32's built-in touch sensor hardware.
config LUA_MODULE_U8G2 config NODEMCU_CMODULE_U8G2
bool "U8G2 module" bool "U8G2 module"
default "n" default "n"
help help
@ -244,28 +244,28 @@ config LUA_MODULE_U8G2
source "$PROJECT_PATH/components/u8g2/u8g2.kconfig" source "$PROJECT_PATH/components/u8g2/u8g2.kconfig"
config LUA_MODULE_UCG config NODEMCU_CMODULE_UCG
bool "UCG module" bool "UCG module"
default "n" default "n"
select LUA_MODULE_SPI select NODEMCU_CMODULE_SPI
help help
Includes the ucg module. Includes the ucg module.
source "$PROJECT_PATH/components/ucg/ucg.kconfig" source "$PROJECT_PATH/components/ucg/ucg.kconfig"
config LUA_MODULE_WIFI config NODEMCU_CMODULE_WIFI
bool "WiFi module" bool "WiFi module"
default "y" default "y"
help help
Includes the WiFi module (recommended). Includes the WiFi module (recommended).
config LUA_MODULE_WS2812 config NODEMCU_CMODULE_WS2812
bool "WS2812 module" bool "WS2812 module"
default "n" default "n"
help help
Includes the ws2812 module. Includes the ws2812 module.
config LUA_MODULE_TIME config NODEMCU_CMODULE_TIME
bool "Time module" bool "Time module"
default "n" default "n"
help help

View File

@ -32,7 +32,7 @@
*/ */
#include "sdkconfig.h" #include "sdkconfig.h"
#ifdef CONFIG_LUA_MODULE_BTHCI #ifdef CONFIG_NODEMCU_CMODULE_BTHCI
#include "module.h" #include "module.h"
#include "lauxlib.h" #include "lauxlib.h"

View File

@ -1,5 +1,5 @@
# Match up all the module source files with their corresponding Kconfig # Match up all the module source files with their corresponding Kconfig
# option in the form LUA_MODULE_<modname> and if enabled, add a # option in the form NODEMCU_CMODULE_<modname> and if enabled, add a
# "-u <modname>_module_selected1" option to force the linker to include # "-u <modname>_module_selected1" option to force the linker to include
# the module. See components/core/include/module.h for further details on # the module. See components/core/include/module.h for further details on
# how this works. # how this works.
@ -13,8 +13,8 @@ ifneq (4.0, $(firstword $(sort $(MAKE_VERSION) 4.0)))
endif endif
MODULE_NAMES:=$(call uppercase,$(patsubst $(COMPONENT_PATH)/%.c,%,$(wildcard $(COMPONENT_PATH)/*.c))) MODULE_NAMES:=$(call uppercase,$(patsubst $(COMPONENT_PATH)/%.c,%,$(wildcard $(COMPONENT_PATH)/*.c)))
FORCE_LINK:=$(foreach mod,$(MODULE_NAMES),$(if $(CONFIG_LUA_MODULE_$(mod)), -u $(mod)_module_selected1)) FORCE_LINK:=$(foreach mod,$(MODULE_NAMES),$(if $(CONFIG_NODEMCU_CMODULE_$(mod)), -u $(mod)_module_selected1))
COMPONENT_ADD_LDFLAGS=$(FORCE_LINK) -lmodules $(if $(CONFIG_LUA_MODULE_BTHCI),-lbtdm_app) 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 # These are disabled by default in the IDF, so switch them back on
CFLAGS += \ CFLAGS += \

View File

@ -19,7 +19,7 @@
#include "sdkconfig.h" #include "sdkconfig.h"
#endif #endif
#ifndef CONFIG_LUA_MODULE_U8G2 #ifndef CONFIG_NODEMCU_CMODULE_U8G2
// ignore unused functions if u8g2 module will be skipped anyhow // ignore unused functions if u8g2 module will be skipped anyhow
#pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-function"
#endif #endif

View File

@ -19,7 +19,7 @@
#include "sdkconfig.h" #include "sdkconfig.h"
#endif #endif
#ifndef CONFIG_LUA_MODULE_UCG #ifndef CONFIG_NODEMCU_CMODULE_UCG
// ignore unused functions if ucg module will be skipped anyhow // ignore unused functions if ucg module will be skipped anyhow
#pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-function"
#endif #endif

View File

@ -137,7 +137,7 @@ config LUA_EMBEDDED_FLASH_STORE
config BUILD_FATFS config BUILD_FATFS
bool "Support for FAT filesystems" bool "Support for FAT filesystems"
default "n" default "n"
select LUA_MODULE_SDMMC select NODEMCU_CMODULE_SDMMC
help help
Include support for accessing FAT filesystems on SD cards. Include support for accessing FAT filesystems on SD cards.

View File

@ -6,9 +6,9 @@
#define NODE_VERSION_REVISION 0U #define NODE_VERSION_REVISION 0U
#define NODE_VERSION_INTERNAL 0U #define NODE_VERSION_INTERNAL 0U
#define NODE_VERSION "NodeMCU ESP32" #define NODE_VERSION "NodeMCU ESP32" " built with Docker provided by frightanic.com\n\tbranch: dev-esp32\n\tcommit: f4887bf134235c05e6c9b2efad370e6d5018f91a\n\tSSL: true\n\tmodules: -\n"
#ifndef BUILD_DATE #ifndef BUILD_DATE
#define BUILD_DATE "unspecified" #define BUILD_DATE "created on 2020-05-30 18:01\n"
#endif #endif
#define SDK_VERSION "IDF" #define SDK_VERSION "IDF"

View File

@ -1,9 +1,9 @@
menu "Displays" menu "Displays"
depends on LUA_MODULE_U8G2 depends on NODEMCU_CMODULE_U8G2
menuconfig U8G2_COMM_I2C menuconfig U8G2_COMM_I2C
bool "I2C" bool "I2C"
select LUA_MODULE_I2C select NODEMCU_CMODULE_I2C
default "y" default "y"
config U8G2_I2C_LD7032_60X32 config U8G2_I2C_LD7032_60X32
@ -204,7 +204,7 @@ config U8G2_I2C_UC1611_EW50850
menuconfig U8G2_COMM_SPI menuconfig U8G2_COMM_SPI
bool "SPI" bool "SPI"
select LUA_MODULE_SPI select NODEMCU_CMODULE_SPI
default "y" default "y"
config U8G2_SPI_HX1230_96X68 config U8G2_SPI_HX1230_96X68
@ -625,10 +625,10 @@ config U8G2_SPI_UC1701_MINI12864
endmenu endmenu
menu "Fonts" menu "Fonts"
depends on LUA_MODULE_U8G2 depends on NODEMCU_CMODULE_U8G2
config U8G2_FONT_SELECTION config U8G2_FONT_SELECTION
depends on LUA_MODULE_U8G2 depends on NODEMCU_CMODULE_U8G2
string "Font list" string "Font list"
default "font_6x10_tf,font_unifont_t_symbols" default "font_6x10_tf,font_unifont_t_symbols"
help help

View File

@ -1,63 +1,63 @@
menu "Displays" menu "Displays"
depends on LUA_MODULE_UCG depends on NODEMCU_CMODULE_UCG
config UCG_DISPLAY_HX8352C_18X240X400 config UCG_DISPLAY_HX8352C_18X240X400
depends on LUA_MODULE_SPI depends on NODEMCU_CMODULE_SPI
bool "hx8352c_18x240x400_hw_spi" bool "hx8352c_18x240x400_hw_spi"
default "n" default "n"
config UCG_DISPLAY_ILI9163_18X128X128 config UCG_DISPLAY_ILI9163_18X128X128
depends on LUA_MODULE_SPI depends on NODEMCU_CMODULE_SPI
bool "ili9163_18x128x128_hw_spi" bool "ili9163_18x128x128_hw_spi"
default "n" default "n"
config UCG_DISPLAY_ILI9341_18X240X320 config UCG_DISPLAY_ILI9341_18X240X320
depends on LUA_MODULE_SPI depends on NODEMCU_CMODULE_SPI
bool "ili9341_18x240x320_hw_spi" bool "ili9341_18x240x320_hw_spi"
default "y" default "y"
config UCG_DISPLAY_ILI9486_18X320X480 config UCG_DISPLAY_ILI9486_18X320X480
depends on LUA_MODULE_SPI depends on NODEMCU_CMODULE_SPI
bool "ili9486_18x320x480_hw_spi" bool "ili9486_18x320x480_hw_spi"
default "n" default "n"
config UCG_DISPLAY_PCF8833_16X132X132 config UCG_DISPLAY_PCF8833_16X132X132
depends on LUA_MODULE_SPI depends on NODEMCU_CMODULE_SPI
bool "pcf8833_16x132x132_hw_spi" bool "pcf8833_16x132x132_hw_spi"
default "n" default "n"
config UCG_DISPLAY_SEPS225_16X128X128_UNIVISION config UCG_DISPLAY_SEPS225_16X128X128_UNIVISION
depends on LUA_MODULE_SPI depends on NODEMCU_CMODULE_SPI
bool "seps225_16x128x128_uvis_hw_spi" bool "seps225_16x128x128_uvis_hw_spi"
default "n" default "n"
config UCG_DISPLAY_SSD1351_18X128X128_ILSOFT config UCG_DISPLAY_SSD1351_18X128X128_ILSOFT
depends on LUA_MODULE_SPI depends on NODEMCU_CMODULE_SPI
bool "ssd1351_18x128x128_hw_spi" bool "ssd1351_18x128x128_hw_spi"
default "n" default "n"
config UCG_DISPLAY_SSD1351_18X128X128_FT config UCG_DISPLAY_SSD1351_18X128X128_FT
depends on LUA_MODULE_SPI depends on NODEMCU_CMODULE_SPI
bool "ssd1351_18x128x128_ft_hw_spi" bool "ssd1351_18x128x128_ft_hw_spi"
default "n" default "n"
config UCG_DISPLAY_SSD1331_18X96X64_UNIVISION config UCG_DISPLAY_SSD1331_18X96X64_UNIVISION
depends on LUA_MODULE_SPI depends on NODEMCU_CMODULE_SPI
bool "ssd1331_18x96x64_uvis_hw_spi" bool "ssd1331_18x96x64_uvis_hw_spi"
default "n" default "n"
config UCG_DISPLAY_ST7735_18X128X160 config UCG_DISPLAY_ST7735_18X128X160
depends on LUA_MODULE_SPI depends on NODEMCU_CMODULE_SPI
bool "st7735_18x128x160_hw_spi" bool "st7735_18x128x160_hw_spi"
default "y" default "y"
endmenu endmenu
menu "Fonts" menu "Fonts"
depends on LUA_MODULE_UCG depends on NODEMCU_CMODULE_UCG
config UCG_FONT_SELECTION config UCG_FONT_SELECTION
depends on LUA_MODULE_UCG depends on NODEMCU_CMODULE_UCG
string "Font list" 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" 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 help

View File

@ -29,10 +29,10 @@ This is a non-exhaustive list, obviously, but some key points are:
- **`user_modules.h` is also gone**. Module selection is now done - **`user_modules.h` is also gone**. Module selection is now done
via Kconfig. Rather than adding a #define to `user_modules.h`, via Kconfig. Rather than adding a #define to `user_modules.h`,
add an option in `components/modules/Kconfig` of the form add an option in `components/modules/Kconfig` of the form
`LUA_MODULE_XYZ`, and the existing `NODEMCU_MODULE()` macros `NODEMCU_CMODULE_XYZ`, and the existing `NODEMCU_MODULE()` macros
will take care of the rest. Example Kconfig entry: will take care of the rest. Example Kconfig entry:
``` ```
config LUA_MODULE_XYZ config NODEMCU_CMODULE_XYZ
bool "Xyz module" bool "Xyz module"
default "y" default "y"
help help