[DO NOT MERGE] SSM fin notify ,fin wait example test case - #7485
Open
anjana348 wants to merge 1 commit into
Open
[DO NOT MERGE] SSM fin notify ,fin wait example test case#7485anjana348 wants to merge 1 commit into
anjana348 wants to merge 1 commit into
Conversation
Demonstrates the `/dev/crashrpt` driver. At startup it builds diagnostic data in memory (500 nodes × 48 bytes + 50 nodes × 64 bytes, each with a message up to 255 bytes). It spawns a high-priority "reporter" thread that registers with the kernel and parks in `fin_wait()`. When an assert fires, the kernel (at the top of `up_assert()`) wakes the reporter, which writes the diagnostics to a file (`/tmp/crashrpt_r<N>.bin`) before the board reboots. The file is written to a temp path and `rename()`'d only after flush+close, so readers never see a partial report. **Sub-commands (run from TASH shell):** | Command | Action | | `crashrpt_test init` | Build the diagnostic data + start & register the reporter thread | | `crashrpt_test status` | Show what's registered and the max report size | | `crashrpt_test crash` | Raise `ASSERT(0)` to exercise the full capture path → reporter writes file → reboot | **Configs to enable:** | Config | Purpose | Default | | `CONFIG_CRASH_REPORT=y` | **Required** — enables the kernel driver (`os/drivers/crashrpt.c`), the `/dev/crashrpt` device, and the `up_assert()` hook | n | | `CONFIG_CRASH_REPORT_DEADLINE_MS=3000` | Max ms the asserter blocks waiting for the reporter | 3000 | | `CONFIG_EXAMPLES_CRASHRPT_TEST=y` | Builds this example app | n | | `CONFIG_EXAMPLES_CRASHRPT_TEST_DIR="/tmp"` | Directory where the report file is written | "/tmp" | | `CONFIG_EXAMPLES_CRASHRPT_TEST_PRIORITY=254` | Reporter thread priority (must be high — `SCHED_PRIORITY_MAX-1`) | SCHED_PRIORITY_MAX-1 | | `CONFIG_EXAMPLES_CRASHRPT_TEST_STACKSIZE=8192` | Reporter thread stack size | 8192 | TASH>> crashrpt_test init # builds data, registers reporter TASH>> crashrpt_test status # (optional) check state TASH>> crashrpt_test crash # triggers ASSERT(0) → reporter writes /tmp/crashrpt_r0.bin → reboot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Demonstrates the
/dev/crashrptdriver. At startup it builds diagnostic data in memory (500 nodes × 48 bytes + 50 nodes × 64 bytes, each with a message up to 255 bytes). It spawns a high-priority "reporter" thread that registers with the kernel and parks infin_wait(). When an assert fires, the kernel (at the top ofup_assert()) wakes the reporter, which writes the diagnostics to a file (/tmp/crashrpt_r<N>.bin) before the board reboots. The file is written to a temp path andrename()'d only after flush+close, so readers never see a partial report.Sub-commands (run from TASH shell):
| Command | Action |
|
crashrpt_test init| Build the diagnostic data + start & register the reporter thread | |crashrpt_test status| Show what's registered and the max report size | |crashrpt_test crash| RaiseASSERT(0)to exercise the full capture path → reporter writes file → reboot |Configs to enable:
| Config | Purpose | Default |
|
CONFIG_CRASH_REPORT=y| Required — enables the kernel driver (os/drivers/crashrpt.c), the/dev/crashrptdevice, and theup_assert()hook | n | |CONFIG_CRASH_REPORT_DEADLINE_MS=3000| Max ms the asserter blocks waiting for the reporter | 3000 | |CONFIG_EXAMPLES_CRASHRPT_TEST=y| Builds this example app | n | |CONFIG_EXAMPLES_CRASHRPT_TEST_DIR="/tmp"| Directory where the report file is written | "/tmp" | |CONFIG_EXAMPLES_CRASHRPT_TEST_PRIORITY=254| Reporter thread priority (must be high —SCHED_PRIORITY_MAX-1) | SCHED_PRIORITY_MAX-1 | |CONFIG_EXAMPLES_CRASHRPT_TEST_STACKSIZE=8192| Reporter thread stack size | 8192 |TASH>> crashrpt_test init # builds data, registers reporter
TASH>> crashrpt_test status # (optional) check state
TASH>> crashrpt_test crash # triggers ASSERT(0) → reporter writes /tmp/crashrpt_r0.bin → reboot