Espressif8266 OOM docs wrong

未关闭
#225 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
55/100
Issue 类型
文档
描述清晰度
描述清楚
活跃度
停滞

调研方向

打开 Espressif8266 文档页面的 Debug Level 部分,并将其中的 build_flags 示例与链接的 PlatformIO 报告进行比较。如有需要,复现所示的 platformio.ini 配置,然后更新说明,使 out-of-memory detector 的指导不会导致汇编编译错误;验证文档中的示例仍然可用。

由索引模型根据 Issue 内容生成。

描述

enhancement

As per https://community.platformio.org/t/esp8266-error-unknown-opcode-or-format-name-when-compiling-with-include-umm-malloc-umm-malloc-cfg-h/14709.

https://docs.platformio.org/en/latest/platforms/espressif8266.html#debug-level says to basically add

build_flags =
   -DDEBUG_ESP_PORT=Serial
   -DDEBUG_ESP_OOM
   -include "umm_malloc/umm_malloc_cfg.h"

to the platformio.ini of a Arduino-ESP8266 project to enable the out-of-memory detection system in the core.

However, the -include flags leads to a multitude of compile errors the moment an assembly file (cont.S) is compiled. Full platformio.ini of

[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino
monitor_speed = 74880
build_flags =
   -DDEBUG_ESP_PORT=Serial
   -DDEBUG_ESP_OOM
   -include "umm_malloc/umm_malloc_cfg.h"

Results in

Compiling .pio\build\nodemcuv2\FrameworkArduino\cont.S.o
c:\users\max\.platformio\packages\[email protected]\xtensa-lx106-elf\include\machine\_default_types.h: Assembler messages:
c:\users\max\.platformio\packages\[email protected]\xtensa-lx106-elf\include\machine\_default_types.h:22: Error: unknown opcode or format name 'typedef'
c:\users\max\.platformio\packages\[email protected]\xtensa-lx106-elf\include\machine\_default_types.h:23: Error: unknown opcode or format name 'typedef'
c:\users\max\.platformio\packages\[email protected]\xtensa-lx106-elf\include\machine\_default_types.h:26: Error: unknown opcode or format name 'typedef'
c:\users\max\.platformio\packages\[email protected]\xtensa-lx106-elf\include\machine\_default_types.h:27: Error: unknown opcode or format name 'typedef'
c:\users\max\.platformio\packages\[email protected]\xtensa-lx106-elf\include\machine\_default_types.h:30: Error: unknown opcode or format name 'typedef'
c:\users\max\.platformio\packages\[email protected]\xtensa-lx106-elf\include\machine\_default_types.h:31: Error: unknown opcode or format name 'typedef'
c:\users\max\.platformio\packages\[email protected]\xtensa-lx106-elf\include\machine\_default_types.h:34: Error: unknown opcode or format name 'typedef'
c:\users\max\.platformio\packages\[email protected]\xtensa-lx106-elf\include\machine\_default_types.h:35: Error: unknown opcode or format name 'typedef'
c:\users\max\.platformio\packages\[email protected]\xtensa-lx106-elf\include\machine\_default_types.h:38: Error: unknown opcode or format name 'typedef'
c:\users\max\.platformio\packages\[email protected]\xtensa-lx106-elf\include\machine\_default_types.h:39: Error: unknown opcode or format name 'typedef'
c:\users\max\.platformio\packages\[email protected]\xtensa-lx106-elf\include\machine\_default_types.h:42: Error: unknown opcode or format name 'typedef'
c:\users\max\.platformio\packages\[email protected]\xtensa-lx106-elf\include\machine\_default_types.h:43: Error: unknown opcode or format name 'typedef'
c:\users\max\.platformio\packages\[email protected]\xtensa-lx106-elf\include\machine\_default_types.h:46: Error: unknown opcode or format name 'typedef'
c:\users\max\.platformio\packages\[email protected]\xtensa-lx106-elf\include\machine\_default_types.h:47: Error: unknown opcode or format name 'typedef'

This header file is not assembly-file safe.

Removing the -include instruction allows for succesful compilation, and seemingly working OOM detection in a minimal example code

#include <Arduino.h>

void setup() {
  delay(1000);
  Serial.begin(74880);
  Serial.println("Testing out-of-memory...");
}

void loop() {
   Serial.println("Mallocing 5K.."); Serial.flush();
   void* ptr = malloc(5 * 1024);
   Serial.print("Alloced ptr "); Serial.println((unsigned int) ptr, HEX);
   Serial.print("Now free: " );
   Serial.println(ESP.getFreeHeap());
   if(ptr == nullptr) {
        Serial.println("malloc() returned NULL!! Ran out of memory");
        delay(10000); //"halt"
   }
}

with the last few lines of the output being

Now free: 712
Mallocing 5K..
:oom(5120)@main.cpp:11
Alloced ptr 0

which does not come from the sketch code but from the OOM detector.

The documentation should be corrected in regards for activating the out-of-memory detector, or any other features that can be enabled through umm_malloc_cfg.h.

主要语言
Python
星标
288
派生
361
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

platformio/platformio-docs 的其他 Issue

查看 platformio/platformio-docs 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。