我猜我在与Arduino IDE和/或Visual micro(用于MS Visual Studio)一起使用时,对nodemcu / ESP8266有一个基本的理解问题。
每次我上传一个程序/草图,在这种情况下显然用C编写,它正在编译和上传大约280kb的二进制文件,即使它只是一个简单的“闪烁”示例。
是否每次都上传某种固件,或者它只是ESP与Arduino IDE一起工作所需的庞大库?
如果是固件,在使用Arduino IDE时,您通常会将固件“更新”到更新的版本吗?使用nodemcu LUA固件时,会定期更新。
谢谢!
答案 0 :(得分:3)
基本上,你构建固件,这是您自己的代码和许多其他代码/库的组合。 所有其他部分都是Arduino ESP8266核心的一部分,它确实得到了更新(它存在于此:https://github.com/esp8266/Arduino)。它本身包含Espressif SDK,它也获得更新(https://github.com/esp8266/Arduino/tree/master/tools/sdk)。 与NodeMCU一样,您可以获得定期更新,但它们是核心,将它们放入固件的唯一方法是重新编译草图。
答案 1 :(得分:1)
This is completely normal - When writing code for an interpreted language like Lua for the ESP/NodeMCU, you're just uploading what is a relatively small text file(s), as the code needed to run it is already on the chip, and doesn't change.
However, when you start working with compiled languages like C (With the Espressif SDK only, for example), or C++ with the Arduino IDE, you are replacing the entire firmware each time your code changes. This includes the TCP/IP stack, WiFi management, the logic controlling the PHY/MAC interface, the mini OS, and a host of other bits to make your ESP8266 work. Even if your code appears to be just a simple "blink" sequence, there's a lot of code running behind the scenes to make it possible, leading to the large sketch size.
Generally, every change to your sketch code will produce a complete copy of everything needed to create a bootable, runnable binary for the ESP8266. This is what is causing the 280KiB file. Since each copy of your code includes the newest (Or at least whatever is in your IDE at the time) copy of the system level code, there is no separate update process - Each time you upload your sketch, the system code is updated too.
Additionally, there is some extra overhead from the Arduino abstraction on the Espressif SDK, leading to a larger resulting binary size.