Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions .github/membrowse-targets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
[
{
"target_name": "stm32-nucleo-f103rb",
"board_config": "nucleo-f103rb:nsh",
"elf": "nuttx",
"ld": "boards/arm/stm32/nucleo-f103rb/scripts/ld.script",
"map_file": "nuttx.map",
"linker_vars": "",
"config_overrides": ""
},
{
"target_name": "arduino-mega2560",
"board_config": "arduino-mega2560:nsh",
"elf": "nuttx.elf",
"ld": "boards/avr/atmega/arduino-mega2560/scripts/flash.ld",
"map_file": "nuttx.map",
"linker_vars": "",
"config_overrides": ""
},
{
"target_name": "qemu-armv8a",
"board_config": "qemu-armv8a:nsh",
"elf": "nuttx",
"ld": "",
"map_file": "nuttx.map",
"linker_vars": "",
"config_overrides": ""
},
{
"target_name": "mirtoo",
"board_config": "mirtoo:nsh",
"elf": "nuttx",
"ld": "boards/mips/pic32mx/mirtoo/scripts/pinguino-debug.ld",
"map_file": "nuttx.map",
"linker_vars": "",
"config_overrides": "-d MIPS32_TOOLCHAIN_GNU_ELF -e MIPS32_TOOLCHAIN_PINGUINOL"
},
{
"target_name": "hifive1-revb",
"board_config": "hifive1-revb:nsh",
"elf": "nuttx",
"ld": "boards/risc-v/fe310/hifive1-revb/scripts/ld.script",
"map_file": "nuttx.map",
"linker_vars": "",
"config_overrides": ""
},
{
"target_name": "rx65n-rsk2mb",
"board_config": "rx65n-rsk2mb:nsh",
"elf": "nuttx",
"ld": "boards/renesas/rx65n/rx65n-rsk2mb/scripts/linker_script.ld",
"map_file": "",
"linker_vars": "",
"config_overrides": ""
},
{
"target_name": "s698pm-dkit",
"board_config": "s698pm-dkit:nsh",
"elf": "nuttx",
"ld": "",
"map_file": "",
"linker_vars": "",
"config_overrides": ""
},
{
"target_name": "qemu-intel64",
"board_config": "qemu-intel64:nsh",
"elf": "nuttx",
"ld": "",
"map_file": "nuttx.map",
"linker_vars": "",
"config_overrides": ""
},
{
"target_name": "esp32-devkitc",
"board_config": "esp32-devkitc:nsh",
"elf": "nuttx",
"ld": "boards/xtensa/esp32/common/scripts/flat_memory.ld.tmp boards/xtensa/esp32/common/scripts/esp32_sections.ld.tmp",
"map_file": "nuttx.map",
"linker_vars": "",
"config_overrides": ""
}
]
30 changes: 30 additions & 0 deletions .github/workflows/membrowse-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: MemBrowse PR Comment

on:
workflow_run:
workflows: [MemBrowse Memory Report]
types:
- completed

jobs:
comment:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion != 'cancelled'
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Post combined PR comment
if: ${{ env.MEMBROWSE_API_KEY != '' }}
uses: membrowse/membrowse-action/comment-action@v1
with:
api_key: ${{ secrets.MEMBROWSE_API_KEY }}
commit: ${{ github.event.workflow_run.head_sha }}
env:
MEMBROWSE_API_KEY: ${{ secrets.MEMBROWSE_API_KEY }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70 changes: 70 additions & 0 deletions .github/workflows/membrowse-onboard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Onboard to MemBrowse

on:
workflow_dispatch:
inputs:
num_commits:
description: 'Number of commits to process'
required: true
default: '100'
type: string

jobs:
load-targets:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v6
- id: set-matrix
run: echo "matrix=$(jq -c '.' .github/membrowse-targets.json)" >> $GITHUB_OUTPUT

onboard:
needs: load-targets
runs-on: ubuntu-latest
container:
image: ghcr.io/apache/nuttx/apache-nuttx-ci-linux
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.load-targets.outputs.matrix) }}

steps:
- name: Checkout nuttx
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Clone nuttx-apps
run: |
git config --global --add safe.directory '*'
git clone --depth=1 https://github.com/apache/nuttx-apps.git ../apps

- name: Run MemBrowse Onboard Action
uses: membrowse/membrowse-action/onboard-action@v1
with:
target_name: ${{ matrix.target_name }}
num_commits: ${{ github.event.inputs.num_commits }}
build_script: |
./tools/configure.sh -l ${{ matrix.board_config }}
echo CONFIG_DEBUG_SYMBOLS=y >> .config
echo CONFIG_DEBUG_LINK_MAP=y >> .config
if [ -n "${{ matrix.config_overrides }}" ]; then
kconfig-tweak ${{ matrix.config_overrides }}
fi
make olddefconfig
# Preserve preprocessed linker scripts (.ld.tmp). The patch dirties
# tracked files; revert on exit so onboard's next git checkout works.
find arch -name Makefile -exec sed -i '/DELFILE, $(addsuffix .tmp,$(ARCHSCRIPT))/d' {} +
trap 'git checkout -- arch/' EXIT
make -j$(nproc)
elf: ${{ matrix.elf }}
ld: ${{ matrix.ld }}
map_file: ${{ matrix.map_file }}
linker_vars: ${{ matrix.linker_vars }}
binary_search: 'true'
api_key: ${{ secrets.MEMBROWSE_API_KEY }}
api_url: ${{ vars.MEMBROWSE_API_URL }}
167 changes: 167 additions & 0 deletions .github/workflows/membrowse-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
name: MemBrowse Memory Report

on:
pull_request:
push:
branches:
- master
- "releases/*"
tags:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
# Detect whether any source files (i.e. non-doc/CODEOWNERS) changed.
# When only docs/CODEOWNERS change we skip the build and post an "identical"
# MemBrowse report instead.
changes-filter:
runs-on: ubuntu-latest
outputs:
source: ${{ steps.filter.outputs.source }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
source:
- '**'
- '!AUTHORS'
- '!CONTRIBUTING.md'
- '!**/CODEOWNERS'
- '!Documentation/**'
- '!tools/ci/docker/linux/**'
- '!tools/codeowners/*'

load-targets:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v6
- id: set-matrix
run: echo "matrix=$(jq -c '.' .github/membrowse-targets.json)" >> $GITHUB_OUTPUT

# Post an "identical" MemBrowse report when only docs/CODEOWNERS changed.
# Only runs on push events (master/releases/tags) to keep the baseline
# complete; PR events don't produce identical markers.
identical:
needs: [changes-filter, load-targets]
if: needs.changes-filter.outputs.source == 'false' && github.event_name == 'push'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.load-targets.outputs.matrix) }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 2
- name: Upload identical - ${{ matrix.target_name }}
uses: membrowse/membrowse-action@v1
with:
target_name: ${{ matrix.target_name }}
identical: true
api_key: ${{ secrets.MEMBROWSE_API_KEY }}
api_url: ${{ vars.MEMBROWSE_API_URL }}

# Build target with debug symbols + linker map, then upload MemBrowse report.
# Uses the NuttX CI Docker image so toolchains, kconfig-frontends, etc. are
# already installed.
analyze:
needs: [changes-filter, load-targets]
if: needs.changes-filter.outputs.source == 'true'
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: 1
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.load-targets.outputs.matrix) }}
steps:
- name: Checkout nuttx repo
uses: actions/checkout@v6
with:
path: sources/nuttx
fetch-depth: 2

- name: Checkout nuttx-apps repo
uses: actions/checkout@v6
with:
repository: apache/nuttx-apps
path: sources/apps
fetch-depth: 1

- name: Docker Login
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker Pull
run: docker pull ghcr.io/apache/nuttx/apache-nuttx-ci-linux

- name: Build ${{ matrix.target_name }}
uses: ./sources/nuttx/.github/actions/ci-container
with:
run: |
git config --global --add safe.directory /github/workspace/sources/nuttx
git config --global --add safe.directory /github/workspace/sources/apps
cd /github/workspace/sources/nuttx
./tools/configure.sh -l ${{ matrix.board_config }}
echo CONFIG_DEBUG_SYMBOLS=y >> .config
echo CONFIG_DEBUG_LINK_MAP=y >> .config
if [ -n "${{ matrix.config_overrides }}" ]; then
kconfig-tweak ${{ matrix.config_overrides }}
fi
make olddefconfig
# Preserve preprocessed linker scripts (.ld.tmp) so MemBrowse can
# read them. Arch Makefiles delete these immediately after linking.
find arch -name Makefile -exec sed -i '/DELFILE, $(addsuffix .tmp,$(ARCHSCRIPT))/d' {} +
make -j$(nproc)

# MemBrowse action runs from $GITHUB_WORKSPACE and discovers git via CWD,
# but nuttx is checked out to sources/nuttx/ (so apps can sit beside it).
# Expose the repo's .git at the workspace root so git metadata resolves.
- name: Expose nuttx .git to workspace root
run: ln -sfn sources/nuttx/.git .git

- name: Prefix linker script paths
id: ld
run: |
prefixed=""
for p in ${{ matrix.ld }}; do
prefixed="$prefixed sources/nuttx/$p"
done
paths=$(echo $prefixed | xargs)
echo "paths=$paths" >> "$GITHUB_OUTPUT"
echo "Resolved ld paths: [$paths]"
for p in $paths; do
if [ -e "$p" ]; then
echo " OK $p ($(stat -c '%s bytes, owner=%U:%G' "$p" 2>/dev/null))"
else
echo " MISS $p"
echo " ls dir:"
ls -la "$(dirname "$p")" 2>&1 | head -30
fi
done

- name: MemBrowse analysis - ${{ matrix.target_name }}
uses: membrowse/membrowse-action@v1
with:
target_name: ${{ matrix.target_name }}
elf: sources/nuttx/${{ matrix.elf }}
ld: ${{ steps.ld.outputs.paths }}
map_file: ${{ matrix.map_file != '' && format('sources/nuttx/{0}', matrix.map_file) || '' }}
linker_vars: ${{ matrix.linker_vars }}
api_key: ${{ secrets.MEMBROWSE_API_KEY }}
api_url: ${{ vars.MEMBROWSE_API_URL }}
verbose: INFO
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
[![Contributors](https://img.shields.io/github/contributors/apache/nuttx)](https://github.com/apache/nuttx/graphs/contributors)
[![GitHub Build Badge](https://github.com/apache/nuttx/workflows/Build/badge.svg)](https://github.com/apache/nuttx/actions/workflows/build.yml)
[![Documentation Badge](https://github.com/apache/nuttx/workflows/Build%20Documentation/badge.svg)](https://nuttx.apache.org/docs/latest/index.html)
[![MemBrowse](https://membrowse.com/badge.svg)](https://membrowse.com/public/apache/nuttx)

Apache NuttX is a real-time operating system (RTOS) with an emphasis on
standards compliance and small footprint. Scalable from 8-bit to 64-bit
Expand Down
Loading