NodeMCU文档中文翻译 5 上传代码

时间:2024-03-06 11:21:38

一、译文 

与烧写一样,这里有好几种方法来从计算机上传代码到设备当中。
注意NodeMCU串口接口在启动时使用115200波特率,为了在启动后改变速率,可以使用uart.setup(0,9600,8,0,1,1)。ESPlorer在改变下拉列表框里的波特率时会自动地执行uart.setup语句。在任何时候,设备故障和复位,错误信息都会以115200的波特率发送到串口。

1、ESPlorer

由luatool作者为ESP8266开发者设计的必要跨平台工具,包括LUA for NodeMCU和MicroPython。另外,支持所有的AT指令。
需要安装Java运行环境(标准版- SE 7及以上版本)。

支持平台:OS X、Linux、Windows等任何能运行Java的平台

2、nodemcu-uploader.py

一个简单的工具,能上传文件到NodeMCU开发板上ESP8266中的文件系统,还有一些有用的命令。
支持平台:OS X、Linux、Windows等任何能运行Python的平台

3、NodeMCU Studio

这是一个非常、非常、非常、非常早期的版本!
支持平台:Windows

4、luatool

能够简单地把基于Lua的脚本上传到NodeMCU开发板上ESP8266闪存当中。
支持平台:OS X、Linux、Windows等任何能运行Python的平台

5、用电脑编译待上传的Lua脚本

如果你在电脑上安装了Lua开发环境,那么在下载Lua脚本到ESP8266模块前,你可以使用标准的Lua编译器来对任何的Lua源码进行语法检测。然而,NodeMCU编译器使用不同的数据格式进行输出(例如,它支持ROMtables),所以编译后的输出不能运行在ESP8266上。
在一个平台上编译源码却在另一平台上使用(比如说在Intel x38 Window上编译,在ESP8266平台上运行)被称为交叉编译。NodeMCU固件支持具备Lua5.1(Lua文件系统模块lfs)和必要GCC工具的*nix平台上的luac.cross编译脚本。简单地改变目录到固件根目录并且运行以下命令:
lua tools/cross-lua.lua
这将会摘你的根目录产生一个可执行的luac.cross文件,它在开发平台上用于编译和语法检测,在ESP8266平台上用于执行。


As with flashing there are several ways to upload code from your computer to the device.

Note that the NodeMCU serial interface uses 115200bps at boot time. To change the speed after booting, issue uart.setup(0,9600,8,0,1,1). ESPlorer will do this automatically when changing the speed in the dropdown list. If the device panics and resets at any time, errors will be written to the serial interface at 115200 bps.

ESPlorer

The essential multiplatforms tools for any ESP8266 developer from luatool author’s, including Lua for NodeMCU and MicroPython. Also, all AT commands are supported. Requires Java (Standard Edition - SE ver 7 and above) installed.

ESPlorer

Source: https://github.com/4refr0nt/ESPlorer

Supported platforms: OS X, Linux, Windows, anything that runs Java

nodemcu-uploader.py

A simple tool for uploading files to the filesystem of an ESP8266 running NodeMCU as well as some other useful commands.

Source: https://github.com/kmpm/nodemcu-uploader

Supported platforms: OS X, Linux, Windows, anything that runs Python

NodeMCU Studio

THIS TOOL IS IN REALLY REALLY REALLY REALLY EARLY STAGE!!!!!!!!!!!!!!!!!!!!!!!!!!!

Source: https://github.com/nodemcu/nodemcu-studio-csharp

Supported platforms: Windows

luatool

Allow easy uploading of any Lua-based script into the ESP8266 flash memory with NodeMcu firmware

Source: https://github.com/4refr0nt/luatool

Supported platforms: OS X, Linux, Windows, anything that runs Python

Compiling Lua on your PC for Uploading

If you install lua on your development PC or Laptop then you can use the standard Lua compiler to syntax check any Lua source before downloading it to the ESP8266 module. However, the nodemcu compiler output uses different data types (e.g. it supports ROMtables) so the compiled output cannot run on the ESP8266.

Compiling source on one platform for use on another (e.g. Intel x38 Window to ESP8266) is known as cross-compilation and the nodemcu firmware supports the compilation of luac.cross on *nix patforms which have Lua 5.1, the Lua filesystem module (lfs), and the essential GCC tools. Simply change directory to the firmware root directoy and run the command:

lua tools/cross-lua.lua

This will generate a luac.cross executable in your root directory which can be used to compile and to syntax-check Lua source on the Development machine for execution under nodemcu lua on the ESP8266.

相关文章