使用大量模块编译 NodeMCU 是否会影响内存使用?
Does compiling NodeMCU with lots of modules have an impact on the memory usage?
使用 cloud compiling website 我创建了一个包含很多模块的自定义 NodeMCU 固件。如此之多以至于固件本身的大小将近 700KB。我通常只在一个项目中使用最多 5 个模块,所以我想知道在固件中包含所有其他模块是否会对 RAM 使用产生明显的负面影响。
在 https://www.kickstarter.com/projects/214379695/micropython-on-the-esp8266-beautifully-easy-iot/posts/1501224 上对 ESP8266 内存映射(以及其他有趣的位)有很好的解释。此外,您在评论中得到了很好的回答。
烘焙到二进制文件中的每个模块仅消耗 "being there" 的内存。如果您想测量单个模块对可用堆的影响,您必须构建两个二进制文件,一个包含该模块,一个不包含该模块。您将同时闪烁并在开始后立即计算 运行 node.heap()
的增量。
Does compiling NodeMCU with lots of modules have an impact on the memory usage?
是的,确实如您所见。
I usually only use up to 5 modules for a single project
这就是为什么我们建议为每个项目使用不同的模块集(阅读 "minimal set")。 NodeMCU 固件的美妙之处在于您只需执行一次,这与例如 NodeMCU 固件相反。 Arduino,之后交换脚本甚至单个函数的速度非常快。
我建议你也看看https://nodemcu.readthedocs.io/en/dev/en/lua-developer-faq/#techniques-for-reducing-ram-and-spiffs-footprint. A major overhaul is in the making at https://github.com/nodemcu/nodemcu-firmware/pull/1899。
使用 cloud compiling website 我创建了一个包含很多模块的自定义 NodeMCU 固件。如此之多以至于固件本身的大小将近 700KB。我通常只在一个项目中使用最多 5 个模块,所以我想知道在固件中包含所有其他模块是否会对 RAM 使用产生明显的负面影响。
在 https://www.kickstarter.com/projects/214379695/micropython-on-the-esp8266-beautifully-easy-iot/posts/1501224 上对 ESP8266 内存映射(以及其他有趣的位)有很好的解释。此外,您在评论中得到了很好的回答。
烘焙到二进制文件中的每个模块仅消耗 "being there" 的内存。如果您想测量单个模块对可用堆的影响,您必须构建两个二进制文件,一个包含该模块,一个不包含该模块。您将同时闪烁并在开始后立即计算 运行 node.heap()
的增量。
Does compiling NodeMCU with lots of modules have an impact on the memory usage?
是的,确实如您所见。
I usually only use up to 5 modules for a single project
这就是为什么我们建议为每个项目使用不同的模块集(阅读 "minimal set")。 NodeMCU 固件的美妙之处在于您只需执行一次,这与例如 NodeMCU 固件相反。 Arduino,之后交换脚本甚至单个函数的速度非常快。
我建议你也看看https://nodemcu.readthedocs.io/en/dev/en/lua-developer-faq/#techniques-for-reducing-ram-and-spiffs-footprint. A major overhaul is in the making at https://github.com/nodemcu/nodemcu-firmware/pull/1899。