Report watchdog restarts and which loop step stalled

Aperta
#256 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
76/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
c
Ambito
embedded-iot

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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).

Lingua principale
C
Stelle
11
Fork
2
Merge medio
18g 3h
PR unite (30g)
3

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di CU-Robotics/firmware

Tutte le issue di CU-Robotics/firmware

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.