Espressif8266 OOM docs wrong

オープン
#225 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
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. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

platformio/platformio-docs のほかの issue

platformio/platformio-docs の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。