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