Report watchdog restarts and which loop step stalled

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

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
76/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
c
領域
embedded-iot

調査の方向性

Read src/utils/watchdog.cpp and src/hello_robot.cpp, especially run() and crash_report(), then compare how teensy4/CrashReport.cpp reads SRC_SRSR and how teensy4/imxrt.h defines its watchdog bit. Trace the main loop steps and watchdog callback; test on a bare Teensy with a temporary forced hang, removing it before opening a PR. Done means a watchdog restart logs its cause and last loop step, while normal power-on logs no watchdog message.

索引モデルが issue の本文から書いたものです。

説明

good first issue not started

When the main loop stalls, the watchdog restarts the Teensy, but nothing tells us it was the watchdog or which part of the loop hung. See the TODO in src/utils/watchdog.cpp ("Read and print a flag to identify the cause of stall").

Good first task. Needs a bare Teensy, no robot.

Files

  • src/utils/watchdog.cpp, src/utils/watchdog.hpp
  • src/hello_robot.cpp (run() and crash_report())
  • teensy4/CrashReport.cpp (reference, reads SRC_SRSR around line 160)
  • teensy4/imxrt.h (SRC_SRSR_* bits)

Steps

  1. Our watchdog is WDT_T4<WDT1>, which sets the SRC_SRSR_WDOG_RST_B bit in SRC_SRSR on reset. CrashReport.breadcrumb(n, value) stores a value that survives a restart.
  2. In HelloRobot::run(), before each main step (sensors, controls, comms, ...), record a step number with CrashReport.breadcrumb(1, step). Use a small enum for the steps.
  3. At boot, before crash_report(), read SRC_SRSR. If the watchdog bit is set, log "Restarted by watchdog" and the last step via SystemLog.
  4. Don't clear SRC_SRSR yourself; CrashReport reads it too. Check CrashReport.cpp before writing to the register.
  5. Fill in the TODO in watchdog_callback() by printing the current step there as well.
  6. Test on a bare Teensy with a temporary forced hang (while (true) {} inside one step). Remove it before opening the PR.

Done when

  • After a forced hang, the next boot says the watchdog caused the restart and names the step.
  • A normal power-on prints no watchdog message.

Related: #211 (safety asserts currently end in a watchdog reset).

主要言語
C
スター
11
フォーク
2
平均マージ
18日 3時間
マージ済み PR(30日)
3

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

CU-Robotics/firmware のほかの issue

CU-Robotics/firmware の issue をすべて見る

似ている issue

C の issue をもっと見る

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

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