Skip to content

Commit

Permalink
Kconfig: rename LUA_MODULE_* to NODEMCU_CMODULE_* (#3135)
Browse files Browse the repository at this point in the history
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 #3130
  • Loading branch information
nwf authored Aug 23, 2020
1 parent 572f731 commit dd3b217
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 70 deletions.
10 changes: 5 additions & 5 deletions components/base_nodemcu/include/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,20 @@
#define LOCK_IN_SECTION(s) __attribute__((used,unused,section(".lua_" #s)))
#endif
/* For the ROM table, we name the variable according to ( | denotes concat):
* cfgname | _module_selected | CONFIG_LUA_MODULE_##cfgname
* where the CONFIG_LUA_MODULE_XYZ macro is first expanded to yield either
* cfgname | _module_selected | CONFIG_NODEMCU_CMODULE_##cfgname
* 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
* 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,
* 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
* to be linked in.
*/
#define NODEMCU_MODULE(cfgname, luaname, map, initfunc) \
const LOCK_IN_SECTION(libs) \
luaR_entry MODULE_PASTE_(lua_lib_,cfgname) = { luaname, LRO_FUNCVAL(initfunc) }; \
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)}
#endif

Expand Down
72 changes: 36 additions & 36 deletions components/modules/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -47,225 +47,225 @@ depends on LUA_BUILTIN_DEBUG
endmenu


config LUA_MODULE_ADC
config NODEMCU_CMODULE_ADC
bool "ADC module"
default "n"
help
Includes the adc module. This module provides access to the
adc1 hardware.

config LUA_MODULE_BIT
config NODEMCU_CMODULE_BIT
bool "Bit module"
default "n"
help
Includes the bit module. This module provide bit manipulation functions
on Lua numbers.

config LUA_MODULE_BTHCI
config NODEMCU_CMODULE_BTHCI
bool "BlueTooth HCI interface module"
default "n"
select BT_ENABLED
help
Includes the simple BlueTooth HCI module.

config LUA_MODULE_CAN
config NODEMCU_CMODULE_CAN
bool "CAN module"
default "n"
help
Includes the can module.

config LUA_MODULE_CRYPTO
config NODEMCU_CMODULE_CRYPTO
bool "Crypto module"
default "n"
help
Includes the crypto module.

config LUA_MODULE_DAC
config NODEMCU_CMODULE_DAC
bool "DAC module"
default "n"
help
Includes the dac module.

config LUA_MODULE_DHT
config NODEMCU_CMODULE_DHT
bool "DHT11/21/22/AM2301/AM2302 module"
default "n"
help
Includes the dht module.

config LUA_MODULE_ENCODER
config NODEMCU_CMODULE_ENCODER
bool "Encoder module"
default "n"
help
Includes the encoder module. This provides hex and base64 encoding and
decoding functionality.

config LUA_MODULE_ETH
config NODEMCU_CMODULE_ETH
bool "Ethernet module"
default "n"
help
Includes the ethernet module.

config LUA_MODULE_FILE
config NODEMCU_CMODULE_FILE
bool "File module"
default "y"
help
Includes the file module (recommended).

config LUA_MODULE_GPIO
config NODEMCU_CMODULE_GPIO
bool "GPIO module"
default "y"
help
Includes the GPIO module (recommended).

config LUA_MODULE_HTTP
config NODEMCU_CMODULE_HTTP
bool "HTTP module"
default "y"
help
Includes the HTTP module (recommended).

config LUA_MODULE_I2C
config NODEMCU_CMODULE_I2C
bool "I2C module"
default "y"
help
Includes the I2C module (recommended).

config LUA_MODULE_I2S
config NODEMCU_CMODULE_I2S
bool "I2S module"
default "n"
help
Includes the I2S module.

config LUA_MODULE_LEDC
config NODEMCU_CMODULE_LEDC
bool "LEDC module"
default "n"
help
Includes the LEDC module.

config LUA_MODULE_MQTT
config NODEMCU_CMODULE_MQTT
bool "MQTT module"
default "n"
help
Includes the MQTT module.

config LUA_MODULE_NET
config NODEMCU_CMODULE_NET
bool "Net module"
default "y"
help
Includes the net module (recommended).

config LUA_MODULE_NODE
config NODEMCU_CMODULE_NODE
bool "Node module"
default "y"
help
Includes the node module (recommended).

config LUA_MODULE_OW
config NODEMCU_CMODULE_OW
bool "1-Wire module"
default "y"
help
Includes the 1-Wire (ow) module (recommended).

config LUA_MODULE_OTAUPGRADE
config NODEMCU_CMODULE_OTAUPGRADE
bool "Over-The-Air upgrade module"
default "n"
help
Includes the over-the-air firmware upgrade module. Use of this requires
a partition table with at least two OTA partitions, plus the OTA data
partition. See the IDF documentation for details.

config LUA_MODULE_PULSECNT
config NODEMCU_CMODULE_PULSECNT
bool "Pulse counter module"
default "n"
help
Includes the pulse counter module to use ESP32's built-in pulse counting hardware.

config LUA_MODULE_QRCODEGEN
config NODEMCU_CMODULE_QRCODEGEN
bool "QR Code Generator module"
default "n"
help
Includes the QR Code Generator from
https://www.nayuki.io/page/qr-code-generator-library

config LUA_MODULE_SDMMC
config NODEMCU_CMODULE_SDMMC
bool "SD-MMC module"
default "n"
help
Includes the sdmmc module.

config LUA_MODULE_SIGMA_DELTA
config NODEMCU_CMODULE_SIGMA_DELTA
bool "Sigma-Delta module"
default "n"
help
Includes the sigma_delta module. This module provides access to the
sigma-delta hardware.

config LUA_MODULE_SJSON
config NODEMCU_CMODULE_SJSON
bool "SJSON module"
default "n"
help
Includes the sjson module.

config LUA_MODULE_SODIUM
config NODEMCU_CMODULE_SODIUM
bool "Sodium module"
default "n"
help
Includes the libsodium crypto module.

config LUA_MODULE_SPI
config NODEMCU_CMODULE_SPI
bool "SPI module"
default "n"
help
Includes the spi module.

config LUA_MODULE_STRUCT
config NODEMCU_CMODULE_STRUCT
bool "Struct module"
default "n"
help
Includes the struct module. This module provides [un]packing of raw
byte strings into Lua values and vice versa.

config LUA_MODULE_TMR
config NODEMCU_CMODULE_TMR
bool "Timer module"
default "y"
help
Includes the timer module (recommended).

config LUA_MODULE_TOUCH
config NODEMCU_CMODULE_TOUCH
bool "Touch module"
default "n"
help
Includes the touch module to use ESP32's built-in touch sensor hardware.

config LUA_MODULE_U8G2
config NODEMCU_CMODULE_U8G2
bool "U8G2 module"
default "n"
help
Includes the u8g2 module.

source "$PROJECT_PATH/components/u8g2/u8g2.kconfig"

config LUA_MODULE_UCG
config NODEMCU_CMODULE_UCG
bool "UCG module"
default "n"
select LUA_MODULE_SPI
select NODEMCU_CMODULE_SPI
help
Includes the ucg module.

source "$PROJECT_PATH/components/ucg/ucg.kconfig"

config LUA_MODULE_WIFI
config NODEMCU_CMODULE_WIFI
bool "WiFi module"
default "y"
help
Includes the WiFi module (recommended).

config LUA_MODULE_WS2812
config NODEMCU_CMODULE_WS2812
bool "WS2812 module"
default "n"
help
Includes the ws2812 module.

config LUA_MODULE_TIME
config NODEMCU_CMODULE_TIME
bool "Time module"
default "n"
help
Expand Down
2 changes: 1 addition & 1 deletion components/modules/bthci.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/

#include "sdkconfig.h"
#ifdef CONFIG_LUA_MODULE_BTHCI
#ifdef CONFIG_NODEMCU_CMODULE_BTHCI

#include "module.h"
#include "lauxlib.h"
Expand Down
6 changes: 3 additions & 3 deletions components/modules/component.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 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
# the module. See components/core/include/module.h for further details on
# how this works.
Expand All @@ -13,8 +13,8 @@ ifneq (4.0, $(firstword $(sort $(MAKE_VERSION) 4.0)))
endif

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))
COMPONENT_ADD_LDFLAGS=$(FORCE_LINK) -lmodules $(if $(CONFIG_LUA_MODULE_BTHCI),-lbtdm_app)
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 += \
Expand Down
2 changes: 1 addition & 1 deletion components/modules/u8g2.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "sdkconfig.h"
#endif

#ifndef CONFIG_LUA_MODULE_U8G2
#ifndef CONFIG_NODEMCU_CMODULE_U8G2
// ignore unused functions if u8g2 module will be skipped anyhow
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
Expand Down
2 changes: 1 addition & 1 deletion components/modules/ucg.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "sdkconfig.h"
#endif

#ifndef CONFIG_LUA_MODULE_UCG
#ifndef CONFIG_NODEMCU_CMODULE_UCG
// ignore unused functions if ucg module will be skipped anyhow
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
Expand Down
2 changes: 1 addition & 1 deletion components/platform/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ config LUA_EMBEDDED_FLASH_STORE
config BUILD_FATFS
bool "Support for FAT filesystems"
default "n"
select LUA_MODULE_SDMMC
select NODEMCU_CMODULE_SDMMC
help
Include support for accessing FAT filesystems on SD cards.

Expand Down
4 changes: 2 additions & 2 deletions components/platform/include/user_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#define NODE_VERSION_REVISION 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
#define BUILD_DATE "unspecified"
#define BUILD_DATE "created on 2020-05-30 18:01\n"
#endif

#define SDK_VERSION "IDF"
Expand Down
10 changes: 5 additions & 5 deletions components/u8g2/u8g2.kconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
menu "Displays"
depends on LUA_MODULE_U8G2
depends on NODEMCU_CMODULE_U8G2

menuconfig U8G2_COMM_I2C
bool "I2C"
select LUA_MODULE_I2C
select NODEMCU_CMODULE_I2C
default "y"

config U8G2_I2C_LD7032_60X32
Expand Down Expand Up @@ -204,7 +204,7 @@ config U8G2_I2C_UC1611_EW50850

menuconfig U8G2_COMM_SPI
bool "SPI"
select LUA_MODULE_SPI
select NODEMCU_CMODULE_SPI
default "y"

config U8G2_SPI_HX1230_96X68
Expand Down Expand Up @@ -625,10 +625,10 @@ config U8G2_SPI_UC1701_MINI12864
endmenu

menu "Fonts"
depends on LUA_MODULE_U8G2
depends on NODEMCU_CMODULE_U8G2

config U8G2_FONT_SELECTION
depends on LUA_MODULE_U8G2
depends on NODEMCU_CMODULE_U8G2
string "Font list"
default "font_6x10_tf,font_unifont_t_symbols"
help
Expand Down
Loading

0 comments on commit dd3b217

Please sign in to comment.