user_config.h 14 KB

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