user_config.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. #ifndef __USER_CONFIG_H__
  2. #define __USER_CONFIG_H__
  3. // The firmware supports a range of Flash sizes, though 4 Mbyte seems to be
  4. // the most common currently. NodeMCU builds include a discovery function
  5. // which is enabled by FLASH_AUTOSIZE, but you can override this by commenting
  6. // this out and enabling the explicitly size, e.g. FLASH_4M. Valid sizes are
  7. // FLASH_512K, FLASH_1M, FLASH_2M, FLASH_4M, FLASH_8M, FLASH_16M.
  8. //#define FLASH_AUTOSIZE
  9. #define FLASH_4M
  10. // The firmware now selects a baudrate of 115,200 by default, but the driver
  11. // also includes automatic baud rate detection at start-up. If you want to change
  12. // the default rate then vaild rates are 300, 600, 1200, 2400, 4800, 9600, 19200,
  13. // 31250, 38400, 57600, 74880, 115200, 230400, 256000, 460800 [, 921600, 1843200,
  14. // 368640]. Note that the last 3 rates are not recommended as these might be
  15. // unreliable, but 460800 seems to work well for most USB-serial devices.
  16. #define BIT_RATE_DEFAULT BIT_RATE_115200
  17. //#define BIT_RATE_AUTOBAUD
  18. // At start-up firmware details like:
  19. //
  20. // NodeMCU 3.0.1.0
  21. // branch:
  22. // commit:
  23. // release:
  24. // release DTS:
  25. // SSL: false
  26. // build type: integer
  27. // LFS: 0x0
  28. // modules: file,gpio,net,node,rtctime,sntp,tmr,uart,wifi
  29. // build 2020-01-27 17:39 powered by Lua 5.1.4 on SDK 3.0.2(824dc80)
  30. //
  31. // will be printed to serial console. While it's mandatory for bug reports
  32. // and good for development, it may be unwanted for non-interactive serial
  33. // devices.
  34. //#define DISABLE_STARTUP_BANNER
  35. // Three separate build variants are now supported. The main difference is in the
  36. // processing of numeric data types. If LUA_NUMBER_INTEGRAL is defined, then
  37. // all numeric calculations are done in integer, with divide being an integer
  38. // operations, and decimal fraction constants are illegal. Otherwise all
  39. // numeric operations use floating point, though they are exact for integer
  40. // expressions < 2^53.
  41. // The main advantage of INTEGRAL builds is that the basic internal storage unit,
  42. // the TValue, is 8 bytes long. We have now reduced the size of FP TValues to
  43. // 12 bytes rather than the previous 16 as this gives a material RAM saving with
  44. // no performance loss. However, you can define LUA_DWORD_ALIGNED_TVALUES and
  45. // this will force 16 byte TValues on FP builds.
  46. //#define LUA_NUMBER_INTEGRAL
  47. //#define LUA_DWORD_ALIGNED_TVALUES
  48. // The Lua Flash Store (LFS) allows you to store Lua code in Flash memory and
  49. // the Lua VMS will execute this code directly from flash without needing any
  50. // RAM overhead. You can now configure LFS directly in the System Partition
  51. // Table insted of at compile time. However for backwards compatibility setting
  52. // LUA_FLASH_STORE defines the default partition size if the NodeMCU partition
  53. // tool is not used.
  54. //#define LUA_FLASH_STORE 0x10000
  55. // By default Lua executes the file init.lua at start up. The following
  56. // define allows you to replace this with an alternative startup. Warning:
  57. // you must protect this execution otherwise you will enter a panic loop;
  58. // the simplest way is to wrap the action in a function invoked by a pcall.
  59. // The example provided executes the LFS module "_init" at startup or fails
  60. // through to the interactive prompt.
  61. //#define LUA_INIT_STRING "pcall(function() node.flashindex'_init'() end)"
  62. // NodeMCU supports two file systems: SPIFFS and FATFS, the first is available
  63. // on all ESP8266 modules. The latter requires extra H/W so it is less common.
  64. // If you use SPIFFS then there are a number of options which impact the
  65. // RAM overhead and performance of the file system.
  66. // If you use the spiffsimg tool to create your own FS images on your dev PC
  67. // then we recommend that you fix the location and size of the FS, allowing
  68. // some headroom for rebuilding flash images and LFS. As an alternative to
  69. // fixing the size of the FS, you can force the SPIFFS file system to end on
  70. // the next 1Mb boundary. This is useful for certain OTA scenarios. In
  71. // general, limiting the size of the FS only to what your application needs
  72. // gives the fastest start-up and imaging times.
  73. // You can now configure SPIFFS size and position directly in the System
  74. // Partition Table. However backwards compatibility SPIFFS_MAX_FILESYSTEM_SIZE
  75. // can be set and this defines the default SPIFFS partition size if the NodeMCU
  76. // partition tool is not used. The value (~0x0) means the maximum size remaining.
  77. #define BUILD_SPIFFS
  78. #define SPIFFS_CACHE 1 // Enable if you use you SPIFFS in R/W mode
  79. //#define SPIFFS_MAX_FILESYSTEM_SIZE 0x20000
  80. #define SPIFFS_MAX_OPEN_FILES 4 // maximum number of open files for SPIFFS
  81. #define FS_OBJ_NAME_LEN 31 // maximum length of a filename
  82. //#define BUILD_FATFS
  83. // The HTTPS stack requires client SSL to be enabled. The SSL buffer size is
  84. // used only for espconn-layer secure connections, and is ignored otherwise.
  85. // Some HTTPS applications require a larger buffer size to work. See
  86. // https://github.com/nodemcu/nodemcu-firmware/issues/1457 for details.
  87. // The SHA2 and MD2 libraries are also optionally used by the crypto functions.
  88. // The SHA1 and MD5 function are implemented in the ROM BIOS. The MD2 and SHA2
  89. // are by firmware code, and can be enabled if you need this functionality.
  90. //#define CLIENT_SSL_ENABLE
  91. #define SHA2_ENABLE
  92. #define SSL_BUFFER_SIZE 4096
  93. #define SSL_MAX_FRAGMENT_LENGTH_CODE MBEDTLS_SSL_MAX_FRAG_LEN_4096
  94. // GPIO_INTERRUPT_ENABLE needs to be defined if your application uses the
  95. // gpio.trig() or related GPIO interrupt service routine code. Likewise the
  96. // GPIO interrupt hook is required for a few modules such as rotary. If you
  97. // don't require this functionality, then commenting out these options
  98. // will remove any associated runtime overhead.
  99. #define GPIO_INTERRUPT_ENABLE
  100. #define GPIO_INTERRUPT_HOOK_ENABLE
  101. // If your application uses the light sleep functions and you wish the
  102. // firmware to manage timer rescheduling over sleeps (the CPU clock is
  103. // suspended so timers get out of sync) then enable the following options
  104. //#define TIMER_SUSPEND_ENABLE
  105. //#define PMSLEEP_ENABLE
  106. // The net module optionally offers net info functionnality. Uncomment the following
  107. // to enable the functionnality.
  108. #define NET_PING_ENABLE
  109. // The WiFi module optionally offers an enhanced level of WiFi connection
  110. // management, using internal timer callbacks. Whilst many Lua developers
  111. // prefer to implement equivalent features in Lua, others will prefer the
  112. // Wifi module to do this for them. Uncomment the following to enable
  113. // this functionality. See the relevant WiFi module documentation for
  114. // further details, as the scope of these changes is not obvious.
  115. // Enable the wifi.startsmart() and wifi.stopsmart()
  116. //#define WIFI_SMART_ENABLE
  117. // Enable wifi.sta.config() event callbacks
  118. #define WIFI_SDK_EVENT_MONITOR_ENABLE
  119. // Enable creation on the wifi.eventmon.reason table
  120. #define WIFI_EVENT_MONITOR_DISCONNECT_REASON_LIST_ENABLE
  121. // Whilst the DNS client details can be configured through the WiFi API,
  122. // the defaults can be exposed temporarily during start-up. The following
  123. // WIFI_STA options allow you to configure this in the firmware. If the
  124. // WIFI_STA_HOSTNAME is not defined then the hostname will default to
  125. // to the last 3 octets (6 hexadecimal digits) of MAC address with the
  126. // prefix "NODE-". If it is defined then the hostname must only contain
  127. // alphanumeric characters. If you are imaging multiple modules with this
  128. // firmware then you must also define WIFI_STA_HOSTNAME_APPEND_MAC to
  129. // append the last 3 octets of the MAC address. Note that the total
  130. // Hostname MUST be 32 chars or less.
  131. //#define WIFI_STA_HOSTNAME "NodeMCU"
  132. //#define WIFI_STA_HOSTNAME_APPEND_MAC
  133. // If you use the enduser_setup module, then you can also set the default
  134. // SSID when this module is running in AP mode.
  135. #define ENDUSER_SETUP_AP_SSID "NodeMCU"
  136. // I2C software driver partially supports use of GPIO16 (D0) pin for SCL line.
  137. // GPIO16 does not support open-drain mode and works in push-pull mode,
  138. // so clock stretching will not be possible, because circuit in slave device that
  139. // supposed to drive SCL low during stretching will not be capable to hold SCL low.
  140. // Also I2C speed will be limited to no more than 400000 Hz (FAST mode).
  141. // This define is does not have an effect on an old driver (see I2C_MASTER_OLD_VERSION).
  142. //#define I2C_MASTER_GPIO16_ENABLE
  143. // For compatibility reasons you can switch to old version of I2C software driver.
  144. // It does not support changing speed, have only one bus id = 0, does not support GPIO16
  145. // and works only in Standard(slow) mode with clock speed around 50kHz.
  146. #define I2C_MASTER_OLD_VERSION
  147. // The following sections are only relevant for those developers who are
  148. // developing modules or core Lua changes and configure how extra diagnostics
  149. // are enabled in the firmware. These should only be configured if you are
  150. // building your own custom firmware and have full access to the firmware
  151. // source code.
  152. // Enabling DEVELOPMENT_TOOLS adds the asserts in LUA and also some useful
  153. // extras to the node module. These are silent in normal operation and so can
  154. // be enabled without any harm (except for the code size increase and slight
  155. // slowdown). If you want to use the remote GDB to handle breaks and failed
  156. // assertions then enable the DEVELOPMENT_USE GDB option. A supplimentary
  157. // define DEVELOPMENT_BREAK_ON_STARTUP_PIN allows you to define a GPIO pin,
  158. // which if pulled low at start-up will immediately initiate a GDB session.
  159. // The DEVELOP_VERSION option enables lots of debug output, and is normally
  160. // only used by hardcore developers.
  161. // These options can be enabled globally here or you can alternatively use
  162. // the DEFINES variable in the relevant Makefile to set these on a per
  163. // directory basis. If you do this then you can also set the corresponding
  164. // compile options (-O0 -ggdb) on a per directory as well.
  165. //#define DEVELOPMENT_TOOLS
  166. //#define DEVELOPMENT_USE_GDB
  167. //#define DEVELOPMENT_BREAK_ON_STARTUP_PIN 1
  168. //#define DEVELOP_VERSION
  169. // *** Heareafter, there be demons ***
  170. // The remaining options are advanced configuration options and you should only
  171. // change this if you have tracked the implications through the Firmware sources
  172. // and understand the these.
  173. #define NODEMCU_EAGLEROM_PARTITION 1
  174. #define NODEMCU_IROM0TEXT_PARTITION 2
  175. #define NODEMCU_LFS0_PARTITION 3
  176. #define NODEMCU_LFS1_PARTITION 4
  177. #define NODEMCU_TLSCERT_PARTITION 5
  178. #define NODEMCU_SPIFFS0_PARTITION 6
  179. #define NODEMCU_SPIFFS1_PARTITION 7
  180. #ifndef LUA_FLASH_STORE
  181. # define LUA_FLASH_STORE 0x0
  182. #endif
  183. #ifndef SPIFFS_FIXED_LOCATION
  184. #define SPIFFS_FIXED_LOCATION 0x0
  185. // You'll rarely need to customize this, because nowadays
  186. // it's usually overruled by the partition table anyway.
  187. #endif
  188. #ifndef SPIFFS_MAX_FILESYSTEM_SIZE
  189. # define SPIFFS_MAX_FILESYSTEM_SIZE 0xFFFFFFFF
  190. #endif
  191. //#define SPIFFS_SIZE_1M_BOUNDARY
  192. // The following define enables recording of the number of CPU cycles at certain
  193. // points in the startup process. It can be used to see where the time is being
  194. // consumed. It enables a nice node.startupcounts() function to get the results.
  195. //#define PLATFORM_STARTUP_COUNT
  196. #define LUA_TASK_PRIO USER_TASK_PRIO_0
  197. #define LUA_PROCESS_LINE_SIG 2
  198. // LUAI_OPTIMIZE_DEBUG 0 = Keep all debug; 1 = keep line number info; 2 = remove all debug
  199. #define LUAI_OPTIMIZE_DEBUG 1
  200. #define READLINE_INTERVAL 80
  201. #define STRBUF_DEFAULT_INCREMENT 3
  202. #define LUA_USE_BUILTIN_DEBUG_MINIMAL // for debug.getregistry() and debug.traceback()
  203. #if defined(DEVELOPMENT_TOOLS) && defined(DEVELOPMENT_USE_GDB)
  204. extern void LUA_DEBUG_HOOK (void);
  205. #define lua_assert(x) ((x) ? (void) 0 : LUA_DEBUG_HOOK ())
  206. #elif defined(DEVELOPMENT_TOOLS) && defined(LUA_CROSS_COMPILER)
  207. extern void luaL_assertfail(const char *file, int line, const char *message);
  208. #define lua_assert(x) ((x) ? (void) 0 : luaL_assertfail(__FILE__, __LINE__, #x))
  209. #else
  210. #define lua_assert(x) ((void) (x))
  211. #endif
  212. #if !defined(LUA_NUMBER_INTEGRAL) && !defined (LUA_DWORD_ALIGNED_TVALUES)
  213. #define LUA_PACK_TVALUES
  214. #else
  215. #undef LUA_PACK_TVALUES
  216. #endif
  217. #ifdef DEVELOP_VERSION
  218. #define NODE_DEBUG
  219. #define COAP_DEBUG
  220. #endif /* DEVELOP_VERSION */
  221. #if !defined(LUA_CROSS_COMPILER) && !defined(dbg_printf)
  222. extern void dbg_printf(const char *fmt, ...);
  223. #endif
  224. #ifdef NODE_DEBUG
  225. #define NODE_DBG dbg_printf
  226. #else
  227. #define NODE_DBG( ... )
  228. #endif /* NODE_DEBUG */
  229. #define NODE_ERROR
  230. #ifdef NODE_ERROR
  231. #define NODE_ERR dbg_printf
  232. #else
  233. #define NODE_ERR( ... )
  234. #endif /* NODE_ERROR */
  235. // #define GPIO_SAFE_NO_INTR_ENABLE
  236. #define ICACHE_STORE_TYPEDEF_ATTR __attribute__((aligned(4),packed))
  237. #define ICACHE_STORE_ATTR __attribute__((aligned(4)))
  238. #define ICACHE_STRING(x) ICACHE_STRING2(x)
  239. #define ICACHE_STRING2(x) #x
  240. #define ICACHE_RAM_ATTR __attribute__((section(".iram0.text." __FILE__ "." ICACHE_STRING(__LINE__))))
  241. #ifdef GPIO_SAFE_NO_INTR_ENABLE
  242. #define NO_INTR_CODE ICACHE_RAM_ATTR __attribute__ ((noinline))
  243. #else
  244. #define NO_INTR_CODE inline
  245. #endif
  246. #endif /* __USER_CONFIG_H__ */