diff --git a/tools/Kconfig b/tools/Kconfig index 5f11dd57df..1284631db8 100644 --- a/tools/Kconfig +++ b/tools/Kconfig @@ -58,4 +58,5 @@ source "$PKGS_DIR/packages/tools/uORB/Kconfig" source "$PKGS_DIR/packages/tools/RT-Tunnel/Kconfig" source "$PKGS_DIR/packages/tools/Virtual-Terminal/Kconfig" source "$PKGS_DIR/packages/tools/fee/Kconfig" +source "$PKGS_DIR/packages/tools/MRamTrace/Kconfig" endmenu diff --git a/tools/MRamTrace/Kconfig b/tools/MRamTrace/Kconfig new file mode 100644 index 0000000000..dcb4ad547c --- /dev/null +++ b/tools/MRamTrace/Kconfig @@ -0,0 +1,30 @@ +menuconfig PKG_USING_MRAMTRACE + bool "MRamTrace: low-overhead RAM-based function tracing" + default n + help + MRamTrace is a lightweight, RAM-resident function tracer for + microcontrollers. It uses GCC/Clang -finstrument-functions to capture + function enter/exit events into a ring buffer, then exports them for + offline call-graph / flamegraph analysis (Perfetto, Speedscope, + KCachegrind, FlameGraph). + +if PKG_USING_MRAMTRACE + + config PKG_MRAMTRACE_USING_DEMO + bool "Enable the RT-Thread demo" + default y + help + Builds a demo that runs a signal-processing workload (compiled with + -finstrument-functions), captures a trace window, and exports the + events to the console via the `ram_trace_demo` shell command. + + config PKG_MRAMTRACE_DEMO_CPU_HZ + int "Demo timestamp frequency (CPU clock Hz)" + default 168000000 + depends on PKG_MRAMTRACE_USING_DEMO + help + CPU clock frequency in Hz, used to convert the Cortex-M DWT cycle + counter timestamps into wall-clock time. Set this to the actual + core clock of your target. + +endif diff --git a/tools/MRamTrace/package.json b/tools/MRamTrace/package.json new file mode 100644 index 0000000000..9166cd094f --- /dev/null +++ b/tools/MRamTrace/package.json @@ -0,0 +1,33 @@ +{ + "name": "MRamTrace", + "description": "MRamTrace is a lightweight RAM-backed function tracing and offline visualization tool for MCU firmware. It captures function enter/exit events via GCC/Clang -finstrument-functions into a ring buffer, then exports them (UART, log, file, Bluetooth, or custom backend) for offline call-graph, flamegraph, Perfetto, Speedscope and KCachegrind analysis.", + "description_zh": "MRamTrace 是一款轻量级基于 RAM 的 MCU 函数追踪与离线可视化工具,通过 GCC/Clang 的 -finstrument-functions 将函数进入/退出事件写入环形缓冲区,冻结后通过 UART、日志、文件、蓝牙或自定义后端导出,结合 ELF 生成调用图、火焰图、Perfetto、Speedscope 和 KCachegrind 等离线分析数据。", + "enable": "PKG_USING_MRAMTRACE", + "keywords": [ + "trace", + "profiling", + "flamegraph", + "callgraph", + "perf", + "instrument" + ], + "category": "tools", + "author": { + "name": "hanzhijian", + "email": "hanzhijian1991@gmail.com", + "github": "Zepp-Hanzj" + }, + "license": "MIT", + "repository": "https://github.com/Zepp-Hanzj/MRamTrace", + "homepage": "https://github.com/Zepp-Hanzj/MRamTrace#readme", + "doc": "https://github.com/Zepp-Hanzj/MRamTrace/blob/main/README.md", + "readme": "MRamTrace is a lightweight RAM-backed function tracing and offline visualization tool for MCU firmware. It captures function enter/exit events via GCC/Clang -finstrument-functions into a ring buffer, then exports them for offline call-graph, flamegraph, Perfetto, Speedscope and KCachegrind analysis.", + "site": [ + { + "version": "latest", + "URL": "https://github.com/Zepp-Hanzj/MRamTrace.git", + "filename": "MRamTrace.zip", + "VER_SHA": "81c2e76605c87eb387b06c98b8ab1162a655e888" + } + ] +}