Nodemcu программа для прошивки
This Tutorial shows you how to flash the new nodeMCU firmware into a ESP8266. This is also useful to get back to the LUA interface if you were uploading C/C++sketches using the Arduino IDE - which overwrites nodeMCU lua data.
This tutorial shows you how download and flash the latest version - since Feb 2019 some older library code has been deprecated - especially timer operation so its best to get going with the new code rather than learn outdated methods.
This information allows you to switch between Lua scripting and Arduino IDE programming easily - just by reprogramming the ESP8266.
installing Lua on an ESP8266 will allow you to use the LUA scripting language in an interactive terminal. This means code upload is far faster than the Arduino IDE compile-link-upload process.
Although scripting languages are slower the processor is fast (which compensates for scripting speed) and you don't wait around for an upload as you do with the ESP8266 Arduino IDE - and Arduino IDE uploading takes about a minute so making small frequent changes is a pain.
With scripting - upload is a few seconds and you're done. The only disadvantage is that its not C so you're going to have to learn something a bit different. The main difference is that in Lua you use event driven programming.
Breakout Board Used
The board used for experiments here is the Lolin NodeMCU V3 which has a very convenient USB interface that allows you to plug it into a PC - power is supplied from the USB port - but you will need up to 300mA~400mA (depending on the WiFi activity!) so don't use a hub (unless it has a good power source), use a PC USB port or you might need an external power source.
NodeMCU firmware Update program
This is the easy-to use ESP8266 breakout board
Lolin nodeMCU V3 Board
Note: Other boards such as the ESP-01 and those without a USB interface require you to keep GPIO0 low for programming. The Lolin nodeMCU board however has this pin controlled using outputs from the USB serial chip - so its all automatic - just plug in and flash the firmware.
External Power Source
You can add an external power source to the Vin connection on the board with voltage >5V. Also connect ground labelled 'G' to complete the circuit.
Find out the NodeMCU serial port in use
You can find out which port your nodeMCU is attached to by starting Control panel and navigating to hardware and "Device Manager" to find the following screen:
Says the following:
flash-mode is qio for most ESP8266 ESP-01/07 (512 kByte modules) and dio for most ESP32 and ESP8266 ESP-12 (>=4 MByte modules). ESP8285 requires dout.
This method of flashing the ESP8266 to install the latest nodeMCU firmware uses the latest tool - which is also very easy to use, however you need to go and get a binary file for it to program into the chip - not too difficult.
Download pyflasher to install nodeMCU firmware
Download the following tool:
This will download the pyflasher that is python based but you won't need to install other files just double click and go.
The downloaded filename is : NodeMCU-PyFlasher-4.0-x64.exe
It looks like this:
Get a nodeMCU firmware Cloud Built Binary
Before you can use pyflasher go and get a binary sent to your email account (for the default settings this takes ~2 minutes). It sounds a bit intimidating but the steps are easy - there's only a few and its not that hard.
Visit this page.
. and keep the default options - at the moment only the ESP8266 is supported and that's what's in the nodeMCU board so that's fine. Enter your email, click the "Start Your Build" button and wait for the binary. Here's what the options look like:
Note: You can see the functions available for each module by clicking on the book symbols next to each check box.
The idea is to include those you need since space is limited on the ESP8266.
Programming the ESP8266 using pyflasher
Again don't forget to close the ESP8266 serial port you may have been using!
Download the float version of your binary - this is recommended even though it uses more memory but is up to you.
- Keep the serial speed at 115200.
- Choose the serial port or use auto detect.
- Choose DIO for ESP-12E
- Choose Erase Flash - just to make sure!
Click "Flash NodeMCU":
Note: When you start the serial terminal this Lua interface uses 115200 baud not the 9600 as the previous version used.
Warning: The ESP8266 does not start immediately - When you first start it it will format the ESP8266 file system - takes about 40 seconds.
This is the output you will see - not just one line as for the 2015 version of nodeMCU:
The above screen is from the ESPlorer terminal.
Type a command into the lua interface (Serial terminal):
it will respond with:
Note: this is all interactive - there was no compiling a C source file and waiting for upload.
NodeMCU 0.9.5 build 20150318 powered by Lua 5.1.4
lua: cannot open init.lua
> print("Hello World")
Hello World
>
Controlling a GPIO pin using LUA
LED Current calculation
If you don't want to add an external LED use pin 4. Current schematics don't show it but I found it by accident. LED operation is inverted, for this pin, since it is pulled high so digital write low sets the LED on.
Note: Some people do not use a resistor in series with the LED but that is relying on the max current from the nodeMCU as 12mA - other boards will allow more current out (and blow up the LED) so it is best practice to use a resistor - when you forget which board you are using!
I use a 1k since you can see the LED even with that high value. For this case current = (3.3-2)/1k = 1.3mA - you can se it so it is good enough for testing
The usual case is to use a 330R resistor in a 5 volt system. In that case you get (5-2)/330=10mA.
LEDs can usually take 20mA so choosing 10mA for a 3V system gives R= (3.3-2)/10e-3 129R so 120R would do.
LED Connection
Connect an LED and resistor on a breadboard to D0.
LED Round side to D0
LED flat side (look closely) to resistor
other end of resistor to Ground (G).
Type the following commands:
> gpio.mode(0,gpio.OUTPUT)
> gpio.write(0,gpio.HIGH)
> print(gpio.read(0))
1
> gpio.write(0,gpio.LOW)
> print(gpio.read(00))
0
>
You can see the LED turning on and off using the interactive Lua script interface.
NEXT: Now you have updated the Firmware and Lua is working on your ESP module. The next thing to do is to install a Lua uploader/Editor. This makes it easy to upload files to the device, and program it over the serial connection. One popular uploader is ESPlorer.
NodeMCU — это платформа на основе модуля ESP8266. П лата предназначена для удобного управления различными схемами на расстоянии посредством передачи сигнала в локальную сеть или интернет через Wi-Fi. Возможности применения этой платы ограничивается лишь вашей фантазией. К примеру, на базе Node MCU можно создать «умный дом», настроив управление светом или вентиляцией через телефон, регистрацию показаний датчиков и многое другое.
Купить NodeMCU (ESP8266) у проверенного продовца
1 шаг. Прошивка
В некоторых случаях приходит нам просто болванка. И появляется надобность прошивки NodeMCU (ESP8266). Да и без того вам придется его прошивать на различные проекты. Так как NodeMCU (ESP8266) имеет кучу прошивок.
Для прошивки надо скачать программу
Для ESP8266 есть такая программа как NodeMCU Flasher, которая изначально предназначена для прошивки загрузчика NodeMCU. Но как оказалось, она отлично прошивает и другие прошивки.
Я прикреплю к статье архив с данной программой и прошивкой для удобства, но тут всегда можно скачать новую версию NodeMCU Flasher.
В папке «nodemcu-flasher-master» есть 2 папки Win64 и Win32 и в зависимости от того какая разрядность у вашей ОС выбираем нужную. Дальше в папке Release запускаем «ESP8266Flasher.exe» и видим интерфейс программы:
Выбираем нужный COM порт и идём во вкладку «Config», убираем хрестик около «INTERNAL://NODEMCU» и ставим его на один пункт ниже, как на скрине:
(Если захотите прошить загрузчик NodeMCU — убираете хрестик там где его не было, и ставите — где он был, то есть около «INTERNAL://NODEMCU»).
Потом жмём по шестеренке и выбираем где лежит наша прошивка, прошивка как правило в формате *.bin(в прикреплённом архиве это «v0.9.5.2 AT Firmware.bin» которая лежит в основной папке), и так же выбираем «0x00000» как и выше.
Дальше идём во вкладку «Advanced» и меняем там скорость на 115200, именно эта скорость будет основная и модуль будет отзываться по ней на AT-команды в случае соответствующей прошивки.
Возвращаемся опять на вкладку «Operation» переводим модуль в режим программирования и жмём «Flash»:
Всё, модуль начал прошиваться, после перепрошивки не забываем перезагрузить модуль и вуаля, он прошит нужной нам прошивкой.
Подключение NodeMCU
Подключаем плату NodeMCU к компьютеру с помощью USB кабеля:
- заходим в раздел «инструменты» -> «плата» -> «менеджер плат», где выбираем «esp8266» и скачиваем последнюю версию,
- заходим в раздел «инструменты» -> «плата» и находим Node MCU,
- необходимо в том же разделе зайти в раздел «порт» и выбрать тот, в который подключена плата,
- установить в разделе инструменты: Upload speed (115200 bouad).
NodeMCU: мигающий светодиод
The basic process to get started with NodeMCU consists of the following three steps.
-
with the modules you need to the chip to the device.
You will typically do steps 1 and 2 only once, but then repeat step 3 as you develop your application. If your application outgrows the limited on-chip RAM then you can use the Lua Flash Store (LFS) to move your Lua code into flash memory, freeing a lot more RAM for variable data. This is why it is a good idea to enable LFS for step 1 if you are developing a larger application. As documented below there is a different approach to uploading Lua code.
For each of the tasks you have a number of choices with regards to tooling and depending on the OS you are on. The colored boxes represent an opinionated path to start your journey - the quickest way to success so to speak. Feel free to follow the links above to get more detailed information.
Task and OS selector¶
How to read this
Use case: you're just starting with NodeMCU and your OS of choice is Windows (and you are not using LFS), then the blue boxes in the 'Windows' column are your guideline. You:
- build the firmware on the cloud builder
- download and run the NodeMCU PyFlasher to transfer the firmware to the device
- download and run ESPlorer, which requires Java, to transfer Lua files from your system to the device
Missing tools?
The below chapters are not meant to be followed one-by-one. Pick a task from the matrix above and it will take you to the relevant chapter.
Cloud Builder¶
- one for NodeMCU with floating support
- one for NodeMCU without floating support i.e. an integer-only binary
We recommend using the floating point build, even though the integer variant uses less RAM for storing variables, as there is little runtime difference between the two variants. Furthermore, the floating point variant handles non-integer values properly and this greatly simplifies numeric calculations.
For everything else the cloud builder GUI is self-explanatory. Hence, no need for further explanations here.
For LFS¶
- Expand the "LFS options" panel
- Select an LFS size, 64KB is likely going to be large enough
- Select other options and build
Note that this service is not maintained by the NodeMCU team. It's run by a NodeMCU team member as an individual, though.
NodeMCU PyFlasher¶
Self-contained NodeMCU flasher with GUI based on Python, esptool.py (see below) and wxPython. A runnable .exe is available for Windows and a .dmg for macOS.
No installation required on Windows and macOS! Instructions how to run it on other platforms are available on the project site.
-
. Which driver you need depends on the ESP8266 module or USB-to-serial converter you use.
- Connect USB cable to device and computer. then start PyFlasher
- Select serial port, browse for firmware binary and set the flash options.
Note that this tool is not an official NodeMCU offering. It's maintained by a NodeMCU team member as an individual, though.
esptool.py¶
esptool.py was started as a ESP8266 community effort but has since been adopted by Espressif. It's their officially recommended way to flash firmware to ESPxxx chips.
-
. Which driver you need depends on the ESP8266 module or USB-to-serial converter you use.
- Install either Python 2.7 or Python >=3.4 on your system if it's not available yet.
- Connect USB cable to device and computer.
- $ pip install esptool (also installs pySerial)
- $ esptool.py --port --baud write_flash -fm 0x00000 .bin
flash-mode is qio for most ESP8266 ESP-01/07 (512 kByte modules) and dio for most ESP32 and ESP8266 ESP-12 (>=4 MByte modules). ESP8285 requires dout .
The default baud rate is 115200. Most hardware configurations should work with 230400 dependent on OS, driver, and module. NodeMCU and WeMos modules are usually ok with 921600.
More details available on esptool.py GitHub repo.
ESPlorer¶
NodeMCU-Tool¶
Arguably NodeMCU-Tool, which requires Node.js, is the better code upload & execution tool than ESPlorer. Also, in contrast to the former it is very well maintained. However, we also understand that Windows users in general prefer GUI over command line.
The list of features is quite long but essentially NodeMCU-Tool offers:
- upload (Lua) files from your host system to the device
- manage the device file system (delete, up-/download, etc.)
- run files on NodeMCU and display the output over UART/serial
-
if not available yet
- Install NodeMCU-Tool globally $ npm install nodemcu-tool -g
- Verify installation by runnin $ nodemcu-tool --version
- Upload a Lua file $ nodemcu-tool upload --port=/dev/ttyUSB0 helloworld.lua
- Run it $ nodemcu-tool run helloworld.lua
Note that you may need to use the sudo prefix to install the tool at step 2, and also possibly add the –unsafe-perm flag after the install command.
Docker¶
The Docker NodeMCU build image is the easiest method to build NodeMCU related components locally on your preferred platform.
- build NodeMCU firmware based on locally cloned sources and configuration
- cross-compile Lua files into LFS image locally
Detailed instructions available in the image's README. As for available config options check the documentation and study the comments in app/include/user_config.h .
For LFS¶
Note that this Docker image is not an official NodeMCU offering. It's maintained by a NodeMCU team member as an individual, though.
Build luac.cross ¶
A local copy of luac.cross is only needed if you want to compile the Lua files into an LFS image yourself and you are not using Docker.
Windows¶
Windows users can compile a local copy of the luac.cross executable for use on a development PC. To this you need:
Linux¶
- Ensure that you have a "build essential" GCC toolchain installed.
- Download the current NodeMCU sources (this dev ZIP file or release ZIP file) and unpack into a local folder; choose the master / dev versions to match the firmware version that you want to use. If you want an Integer buld then edit the app/includes/user_config.h file to select this.
- Change directory to the app/lua/luac_cross sub-folder
- Run make to build the executable.
- Once you have a built luac.cross executable, then you can use this to compile Lua code into an LFS image. You might wish to move this out of the nodemcu-firmware hierarchy, since this folder hierarchy is no longer required and can be trashed.
macOS¶
Compile Lua into LFS image¶
Select Lua files to be run from LFS¶
The easiest approach is to maintain all the Lua files for your project in a single directory on your host. (These files will be compiled by luac.cross to build the LFS image in next step.)
For example to run the Telnet and FTP servers from LFS, put the following files in your project directory:
-
. LFS helper routines and functions. . Moving common strings into LFS. . A simple telnet server (example 1). . A simple telnet server (example 2). . A simple FTP server.
You should always include the first two modules, but the remaining files would normally be replaced by your own project files. Also remember that these are examples and that you are entirely free to modify or to replace them for your own application needs.
You will need to grab a luac.cross compiler that matches your configuration regarding float/integer, Lua 5.1/5.3 and possibly the release.
Terry's LFS Lua Cross-Compile Web Service¶
Note: read up on selecting Lua files first
Upload a ZIP file with all your Lua files ready for LFS. The webservice will cross-compile them into a .img ready to be uploaded to the device. It supports LFS images for both floating point and integer firmware variants.
Further details available on the service site.
Note that this service is not maintained by the NodeMCU team. It's run by a NodeMCU team member as an individual, though.
Docker¶
Note: read up on selecting Lua files first
The same Docker image you used to build the NodeMCU firmware can be used to compile Lua files into an LFS image.
- $ cd
- $ docker run --rm -ti -v pwd :/opt/nodemcu-firmware -v :/opt/lua marcelstoer/nodemcu-build lfs-image
Native on OS¶
Note: read up on selecting Lua files first
For Windows if you built with WSL / Cygwin you will do this from within the respective command window, both of which use the bash shell. If you used Visual Studio just use the windows cmd window.
You will need to adjust the img and lua paths according to their location, and ensure that luac.cross is in your $PATH search list. For example if you are using WSL and your project files are in D:\myproject then the Lua path would be /mnt/d/myproject/*.lua (For cygwin replace mnt by cygwin ). This will create the lfs.img file if there are no Lua compile errors (again specify an explicit directory path if needed).
You might also want to add a simple one-line script file to your ~/bin directory to wrap this command up.
Upload LFS image¶
Once the LFS image file is on SPIFFS, you can execute the node.flashreload() command and the loader will then load it into flash and immediately restart the ESP module with the new LFS loaded, if the image file is valid. However, the call will return with an error if the file is found to be invalid, so your reflash code should include logic to handle such an error return.
Edit your init.lua file¶
init.lua is the file that is first executed by the NodeMCU firmware. Usually it setups the WiFi connection and executes the main Lua application. Assuming that you have included the _init file discussed above, then executing this will add a simple API for LFS module access:
- Individual functions can be executed directly, e.g. LFS.myfunc(a,b)
- LFS is now in the require path, so require 'myModule' works as expected.
Do a protected call of this _init code: pcall(node.LFS._init()) and check the error status. See Programming Techniques and Approachs in the LFS whitepaper for a more detailed description.
Minimal LFS example¶
Below is a brief overview of building and running the simplest LFS-based system possible.
To use LFS, start with a version of the NodeMCU firmware with LFS enabled. See the matrix section "Build LFS enabled firmware" for how to do that. Load it on the ESP8266 in the usual way (whatever that is for your set up).
Then build an LFS file system. This can be done in several ways, as discussed above; one of the easiest is to use luac.cross -o lfs.img -f *lua on the host machine. Make sure to include a file named hello_world.lua with the following one line content: print("Hello ESP8266 world!") The file lua_examples/lfs/_init.lua should definitely be included in the image, since it's the easiest way to integrate the LFS system. The lfs.img file can then be downloaded to the ESP8266 just like any other file.
The next step is to tell the ESP8266 that the LFS exists. This is done with node.LFS.reload("lfs.img"), which will trigger a reset, followed by node.LFS._init() to better integrate LFS; logging into the esp8266 and running the following commands gives an overview of the command sequence.
Note that no error correction has been used, since the commands are intended to be entered at a terminal, and errors will become obvious.
Then you should set up the ESP8266 boot process to check for the existence of an LFS image and run whichever module is required. Once the LFS module table has been registered by running lua_examples/lfs/_init.lua, running an LFS module is simply a matter of eg: LFS.hello_world() .
node.LFS.reload() need only be rerun if the LFS image is updated; after it has loaded the LFS image into flash memory the original file (in SPIFFS) is no longer used, and can be deleted.
Once LFS is known to work, then modules such as lua_examples/lfs/dummy_strings.lua can usefully be added, together of course with effective error checking.
Below you'll find all necessary information to flash a NodeMCU firmware binary to ESP8266 or ESP8285. Note that this is a reference documentation and not a tutorial with fancy screen shots. Turn to the respective tool documentation for those.
Keep in mind that the ESP8266 needs to be put into flash mode before you can flash a new firmware!
When switching between NodeMCU versions, see the notes about Upgrading Firmware.
Tool overview¶
esptool.py¶
A Python-based, open source, platform independent, utility to communicate with the ROM bootloader in Espressif ESP8266.
Supported platforms: OS X, Linux, Windows, anything that runs Python
Running esptool.py
Run the following command to flash an aggregated binary as is produced for example by the cloud build service or the Docker image.
flash-mode is qio for most ESP8266 ESP-01/07 (512 kByte modules) and dio for most ESP32 and ESP8266 ESP-12 (>=4 MByte modules). ESP8285 requires dout .
Gotchas
- See below if you don't know or are uncertain about the capacity of the flash chip on your device. It might help to double check as e.g. some ESP-01 modules come with 512kB while others are equipped with 1MB.
- esptool.py is under heavy development. It's advised you run the latest version (check with esptool.py version ). Since this documentation may not have been able to keep up refer to the esptool flash modes documentation for current options and parameters.
- The firmware image file contains default settings dio for flash mode and 40m for flash frequency.
- In some uncommon cases, the SDK init data may be invalid and NodeMCU may fail to boot. The easiest solution is to fully erase the chip before flashing: esptool.py --port erase_flash
NodeMCU PyFlasher¶
Supported platforms: anything that runs Python, runnable .exe available for Windows and .dmg for macOS
Disclaimer: the availability of NodeMCU PyFlasher was announced on the NodeMCU Facebook page but it is not an official offering of the current NodeMCU firmware team.
Putting Device Into Flash Mode¶
To enable ESP8266 firmware flashing GPIO0 pin must be pulled low before the device is reset. Conversely, for a normal boot, GPIO0 must be pulled high or floating.
If you have a NodeMCU dev kit then you don't need to do anything, as the USB connection can pull GPIO0 low by asserting DTR and reset your board by asserting RTS.
If you have an ESP-01 or other device without built-in USB, you will need to enable flashing yourself by pulling GPIO0 low or pressing a "flash" switch, while powering up or resetting the module.
Which Files To Flash¶
If you build your firmware with the cloud builder or the Docker image, or any other method that produces a combined binary, then you can flash that file directly to address 0x00000.
Otherwise, if you built your own firmware from source code:
- bin/0x00000.bin to 0x00000
- bin/0x10000.bin to 0x10000
Upgrading Firmware¶
There are three potential issues that arise from upgrading (or downgrading!) firmware from one NodeMCU version to another:
Lua scripts written for one NodeMCU version (like 0.9.x) may not work error-free on a more recent firmware. For example, Espressif changed the socket:send operation to be asynchronous i.e. non-blocking. See API documentation for details.
The NodeMCU flash file system may need to be reformatted, particularly if its address has changed because the new firmware is different in size from the old firmware. If it is not automatically formatted then it should be valid and have the same contents as before the flash operation. You can still run file.format() manually to re-format your flash file system. You will know if you need to do this if your flash files exist but seem empty, or if data cannot be written to new files. However, this should be an exceptional case. Formatting a file system on a large flash device (e.g. the 16MB parts) can take some time. So, on the first boot, you shouldn't get worried if nothing appears to happen for a minute. There's a message printed to console to make you aware of this.
The Espressif SDK Init Data may change between each NodeMCU firmware version, and may need to be erased or reflashed. See SDK Init Data for details. Fully erasing the module before upgrading firmware will avoid this issue.
SDK Init Data¶
NodeMCU versions are compiled against specific versions of the Espressif SDK. The SDK reserves space in flash that is used to store calibration and other data. Espressif refers to this area as "System Param" and it occupies four 4 Kb sectors of flash. A fifth 4 Kb sector is also reserved for RF calibration. - With SDK version 2.x builds, these 5 sectors are located in the last pages at in the Flash memory. - With SDK version 3.x builds, these 5 sectors are located in the otherwise unused pages at Flash offset 0x0B000-0x0FFFF, between the bin/0x00000.bin segment at 0x00000 and the bin/0x10000.bin to 0x10000.
If this data gets corrupted or you are upgrading major SDK versions, then the firmware may not boot correctly. Symptoms include messages like rf_cal[0] !=0x05,is 0xFF , or endless reboot loops and/or fast blinking module LEDs. If you are seeing one or several of the above symptoms, ensure that your chip is fully erased before flashing, for example by using esptool.py . The SDK version 3.x firmware builds detect if the RF calibration sector has been erased or corrupted, and will automatically initialise it with the correct content before restarting the processor. This works for all SDK supported flash sizes.
Determine flash size¶
The easiest way to determine the flash capacity is to load the firmware and then print(node.info'hw'.flash_size) which reports the flash size in Kb. Alternatively, if you want to determine the capacity of the flash chip before a firmware is installed then you can run the following command. This will return a 2 hex digit Manufacturer ID and a 4 digit Device ID and the detected flash size.
Tools¶
Cloud Build Service¶
NodeMCU "application developers" just need a ready-made firmware. There's a cloud build service with a nice UI and configuration options for them.
Docker Image¶
Occasional NodeMCU firmware hackers don't need full control over the complete tool chain. They might not want to setup a Linux VM with the build environment. Docker to the rescue. Give Docker NodeMCU build a try.
Linux Build Environment¶
NodeMCU firmware developers commit or contribute to the project on GitHub and might want to build their own full fledged build environment with the complete tool chain. The NodeMCU project embeds a ready-made tool chain for Linux/x86-64 by default. After working through the Build Options below, simply start the build process with
The default build setup reduces output verbosity to a minimum. The verbosity level can be increased by setting the V environment variable to 1, as below. See the root Makefile for other available options.
Building the tool chain from scratch is out of NodeMCU's scope. Refer to ESP toolchains for related information.
If you decide to build with either the Docker image or the native environment then use Git to clone the firmware sources instead of downloading the ZIP file from GitHub. Only cloning with Git will retrieve the referenced submodules:
Omitting the optional -b will clone release.
Build Options¶
The following sections explain some of the options you have if you want to build your own NodeMCU firmware.
Select Modules¶
Disable modules you won't be using to reduce firmware size and free up some RAM. The ESP8266 is quite limited in available RAM and running out of memory can cause a system panic. The default configuration is designed to run on all ESP modules including the 512 KB modules like ESP-01 and only includes general purpose interface modules which require at most two GPIO pins.
TLS/SSL Support¶
To enable TLS support edit app/include/user_config.h and uncomment the following flag:
The complete configuration is stored in app/include/user_mbedtls.h . This is the file to edit if you build your own firmware and want to change mbed TLS behavior. See the tls documentation for details.
Debugging¶
To enable runtime debug messages to serial console edit app/include/user_config.h
LFS is turned off by default. See the LFS documentation for supported config options (e.g. how to enable it).
Set UART Bit Rate¶
The initial baud rate at boot time is 115200bps. You can change this by editing BIT_RATE_DEFAULT in app/include/user_config.h :
Note that, by default, the firmware runs an auto-baudrate detection algorithm so that typing a few characters at boot time will cause the firmware to lock onto that baud rate (between 1200 and 230400).
Double build (Lua 5.3 only)¶
By default a build will be generated supporting floating point variables (floats) and integers. To increase the precision of the floating point variables, a double build can be created. This is also the default in the Lua 5.1 builds. The downside is that more memory is consumed when storing variables. You can change this either by uncommenting LUA_NUMBER_64BITS in app/include/user_config.h :
OR by overriding this with the make command
Integer build (Lua 5.1 only)¶
By default a build will be generated supporting floating-point variables (doubles). To reduce memory size an integer build can be created. You can change this either by uncommenting LUA_NUMBER_INTEGRAL in app/include/user_config.h :
OR by overriding this with the make command as it's done during the CI build:
Tag Your Build¶
Identify your firmware builds by setting the environment variable USER_PROLOG . You may also edit app/include/user_version.h . The variable USER_PROLOG will be included in NODE_VERSION_LONG .
u8g2 Module Configuration¶
Display drivers and embedded fonts are compiled into the firmware image based on the settings in app/include/u8g2_displays.h and app/include/u8g2_fonts.h . See the u8g2 documentation for details.
ucg Module Configuration¶
Display drivers and embedded fonts are compiled into the firmware image based on the settings in app/include/ucg_config.h . See the ucg documentation for details.
Читайте также: