Metadata-Version: 2.3
Name: szuncover
Version: 0.1.1
Summary: Uncover stack-usages for your threads
Author: Paul Würtz
Author-email: Paul Würtz <paulwuertz@posteo.de>
Requires-Dist: pydantic>=2.13.5
Requires-Python: >=3.12
Description-Content-Type: text/markdown


# szuncover

Uncover your threads stack usage. Working only with GCC, using the .ci files generated by the `-callgraph-info=cu,da` options to construct a callgraph with stack-usages.

## Installation and Usage

Install with pip:

```bash
pip install szuncover
```

Create a config listing your thread entry functions:

```json
{ "threads": [
    {
        "thread_entry_name": "bg_thread_main",
        "stack_size": 1024
    },
    {
        "thread_entry_name": "gs_usb_tx_thread",
        "stack_size": 1024
    },
    {
        "thread_entry_name": "gs_usb_rx_thread",
        "stack_size": 1024
    },
    {
        "thread_entry_name": "log_process_thread_func",
        "stack_size": 768
    }
]}
```

then build your firmware with `-callgraph-info=cu,da` and run `szuncover --build_dir ./build/ --config_file config.json` for some basic output:

```md
┌──────────────────────────────────────────────────────────────────────────────┐
│ bg_thread_main                 - ( 68.0%)    696/  1024 │█████████████-------│
│ gs_usb_tx_thread               - ( 68.8%)    704/  1024 │█████████████-------│
│ gs_usb_rx_thread               - ( 60.2%)    616/  1024 │████████████--------│
│ log_process_thread_func        - ( 34.4%)    264/   768 │██████--------------│
└──────────────────────────────────────────────────────────────────────────────┘
WARNING: Given calltree info may limit this analysis:

* number of functions with unresolved calls in thread:
        * bg_thread_main: 22 resulting in 34 missing calls in the calltree
        * gs_usb_tx_thread: 4 resulting in 5 missing calls in the calltree
        * gs_usb_rx_thread: 2 resulting in 2 missing calls in the calltree
        * log_process_thread_func: 3 resulting in 4 missing calls in the calltree

* number of functions with missing stacksize in calltree:
        *  bg_thread_main :  29
        *  gs_usb_tx_thread :  4
        *  gs_usb_rx_thread :  0
        *  log_process_thread_func :  2
```

## Running Tests

python -m unittest
