Skip to content

Commit 8f55261

Browse files
committed
ci: add worst-case stack usage report to RAM memory view
Add a puncover-based stack usage page (`ram_memory_view.html`) linked from the RAM badge. Enables `CONFIG_STACK_USAGE` in `prj.conf` so the build emits `.su` files for puncover to analyze. The new `generate_ram_memory_view.py` script resolves Kconfig stack entries to their thread entry points, runs puncover, and renders an HTML table showing worst-case static stack depth vs. allocation. `update_memory_badges.sh` now accepts the app ELF and build dir as optional args and generates the stack report when available. Falls back to the RAM sunburst if puncover fails. Remove the `pr-size-diff.sh` script and its CI steps; the RAM badge now links to the richer stack view instead. Signed-off-by: Simen S. Røstad <simen.rostad@nordicsemi.no>
1 parent d2a3438 commit 8f55261

8 files changed

Lines changed: 493 additions & 145 deletions

File tree

.github/workflows/build.yml

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -161,18 +161,17 @@ jobs:
161161
env:
162162
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
163163
run: |
164-
# Install required packages
165-
pip install pandas plotly --break-system-packages
164+
pip install pandas plotly puncover --break-system-packages
166165
167-
# Generate sunburst charts first
168166
python3 scripts/sunburst_from_mem_report.py ../artifacts/rom_report_thingy91x.json
169167
python3 scripts/sunburst_from_mem_report.py ../artifacts/ram_report_thingy91x.json
170168
171-
# Generate badges, history plots, and push everything to gh-pages
172169
./tests/on_target/scripts/update_memory_badges.sh \
173170
../artifacts/build_output_thingy91x.log \
174171
../artifacts/rom_report_thingy91x.html \
175-
../artifacts/ram_report_thingy91x.html
172+
../artifacts/ram_report_thingy91x.html \
173+
app/build/app/zephyr/zephyr.elf \
174+
app/build/app
176175
177176
- name: Build nrf9151dk firmware
178177
if: ${{ env.build_type == 'minimal' || env.build_type == 'release' || env.build_type == 'all' }}
@@ -256,25 +255,6 @@ jobs:
256255
version: ${{ env.VERSION }}-ext-gnss
257256
path: asset-tracker-template/app
258257

259-
- name: Generate PR app-size diff for thing91x image
260-
if: github.event_name == 'pull_request'
261-
env:
262-
BASE_SHA: ${{ github.event.pull_request.base.sha }}
263-
BOARD: thingy91x/nrf9151/ns
264-
PR_HEAD_ELF: artifacts/asset-tracker-template-${{ env.VERSION }}-thingy91x-nrf91.elf
265-
PR_HEAD_BUILD_LOG: artifacts/build_output_thingy91x.log
266-
SIZE_COMMENT_PATH: ${{ github.workspace }}/size-comment.md
267-
CI_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
268-
run: |
269-
bash asset-tracker-template/scripts/ci/pr-size-diff.sh
270-
271-
- name: Post PR app-size sticky comment for thingy91x image
272-
if: github.event_name == 'pull_request'
273-
uses: marocchino/sticky-pull-request-comment@0ea0beb66eb9baf113663a64ec522f60e49231c0 # v3.0.4
274-
with:
275-
header: app-size-report
276-
path: ${{ github.workspace }}/size-comment.md
277-
278258
- name: Upload artifacts
279259
uses: actions/upload-artifact@v4
280260
with:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![On-commit](https://img.shields.io/github/actions/workflow/status/nrfconnect/Asset-Tracker-Template/build-and-target-test.yml?event=push&branch=main&label=on-commit)](https://github.com/nrfconnect/Asset-Tracker-Template/actions/workflows/build-and-target-test.yml?query=branch%3Amain+event%3Apush)
77
[![Nightly](https://img.shields.io/github/actions/workflow/status/nrfconnect/Asset-Tracker-Template/build-and-target-test.yml?event=schedule&branch=main&label=nightly)](https://github.com/nrfconnect/Asset-Tracker-Template/actions/workflows/build-and-target-test.yml?query=branch%3Amain+event%3Aschedule)
88
[![PSM Current](https://img.shields.io/endpoint?url=https://nrfconnect.github.io/Asset-Tracker-Template/power_badge.json)](https://nrfconnect.github.io/Asset-Tracker-Template/power_measurements_plot.html)
9-
[![RAM Usage thingy91x](https://img.shields.io/endpoint?url=https://nrfconnect.github.io/Asset-Tracker-Template/ram_badge.json)](https://nrfconnect.github.io/Asset-Tracker-Template/ram_memory_view.html)
9+
[![RAM+stacks thingy91x](https://img.shields.io/endpoint?url=https://nrfconnect.github.io/Asset-Tracker-Template/ram_badge.json)](https://nrfconnect.github.io/Asset-Tracker-Template/ram_memory_view.html)
1010
[![FLASH Usage thingy91x](https://img.shields.io/endpoint?url=https://nrfconnect.github.io/Asset-Tracker-Template/flash_badge.json)](https://nrfconnect.github.io/Asset-Tracker-Template/flash_memory_view.html)
1111

1212
## Overview

app/prj.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
CONFIG_NCS_APPLICATION_BOOT_BANNER_STRING="Asset Tracker Template"
88
CONFIG_NCS_SAMPLES_DEFAULTS=y
9+
CONFIG_STACK_USAGE=y
910
CONFIG_RESET_ON_FATAL_ERROR=y
1011
CONFIG_LOG_MODE_DEFERRED=y
1112
CONFIG_LOG_BUFFER_SIZE=2048

docs/common/test_and_ci_setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ The documentation sync workflow ([.github/workflows/doc-sync.yml](https://github
7979
1. **Create documentation bundle**: Uses [create-doc-bundle.yml](https://github.com/nrfconnect/Asset-Tracker-Template/blob/main/.github/workflows/create-doc-bundle.yml) to package documentation for external publishing.
8080
2. **Publish documentation**: Uploads the documentation bundle to the prod and dev documentation hosting platforms.
8181

82-
The `gh-pages` branch is kept in sync with main by the build workflow ([.github/workflows/build.yml](https://github.com/nrfconnect/Asset-Tracker-Template/blob/main/.github/workflows/build.yml)), which merges main into `gh-pages` before updating badge JSON files and interactive HTML reports (memory usage, power measurements) for the [GitHub Pages site](https://nrfconnect.github.io/Asset-Tracker-Template/).
82+
The `gh-pages` branch is updated by the nightly build workflow ([.github/workflows/build.yml](https://github.com/nrfconnect/Asset-Tracker-Template/blob/main/.github/workflows/build.yml)) with badge JSON files and interactive HTML reports (memory usage, worst-case stack usage via puncover, power measurements) for the [GitHub Pages site](https://nrfconnect.github.io/Asset-Tracker-Template/). The RAM badge links to `ram_memory_view.html`, a single page with the thread stack table (puncover) and the RAM sunburst chart side by side.
8383

8484
### Key Features
8585

scripts/ci/pr-size-diff.sh

Lines changed: 0 additions & 114 deletions
This file was deleted.

0 commit comments

Comments
 (0)