Multiple Targets
Track memory across different boards, build types, or feature variants. Each target maintains its own independent history in the MemBrowse Portal.
Examples of targets:
- Different boards:
stm32f4,nrf52840,esp32 - Build types:
debug,release - Feature variants:
with-bluetooth,minimal
Targets Configuration
Create .github/membrowse-targets.json to define your build targets:
{
"targets": [
{
"name": "stm32f4",
"elf": "build/stm32f4/firmware.elf",
"ld": "boards/stm32f4/linker.ld",
"build_script": "make TARGET=stm32f4"
},
{
"name": "nrf52840",
"elf": "build/nrf52840/firmware.elf",
"ld": "boards/nrf52840/linker.ld boards/nrf52840/memory.ld",
"build_script": "make TARGET=nrf52840"
}
]
}
Target Properties
| Property | Required | Description |
|---|---|---|
name | Yes | Unique identifier for this target |
elf | Yes | Path to the ELF file after building |
ld | No | Path to linker script(s), space-separated if multiple. If omitted, MemBrowse uses default Code/Data regions based on ELF section flags. |
build_script | Yes | Command to build this target |
def | No | Linker script variable definitions (e.g., "__flash_size__=4096K __ram_size__=256K") |
map_file | No | Path to the linker map file, for archive and object attribution |
Multiple Linker Scripts
If your project uses multiple linker scripts, list them space-separated:
{
"name": "my-target",
"elf": "build/firmware.elf",
"ld": "memory.ld sections.ld board.ld"
}
MemBrowse will parse all scripts to understand your complete memory layout.
Linker Variable Definitions
Use the def property to pass variable definitions to the linker script parser. This is useful when your linker scripts use variables for memory sizes:
{
"name": "stm32f4",
"elf": "build/firmware.elf",
"ld": "linker.ld",
"build_script": "make all",
"def": "__flash_size__=512K __ram_size__=128K"
}
In the workflow, pass this to the action:
- name: Analyze memory
uses: membrowse/membrowse-action@v1
with:
elf: ${{ matrix.target.elf }}
ld: ${{ matrix.target.ld }}
target_name: ${{ matrix.target.name }}
api_key: ${{ secrets.MEMBROWSE_API_KEY }}
linker_vars: ${{ matrix.target.def }}
map_file: ${{ matrix.target.map_file }}
The other analysis options can be passed from the matrix in the same way.
Full Workflow with Matrix Builds
With multiple targets, each target runs as a separate matrix job and uploads its own report. Unlike the single-target setup where the comment step runs inline, here a separate comment job runs after all the matrix jobs have finished. It fetches the summary for the commit, which includes every target, and posts a single PR comment:
comment:
needs: analyze
runs-on: ubuntu-latest
if: ${{ !cancelled() && github.event_name == 'pull_request' }}
steps:
- name: Post PR comment
continue-on-error: true
uses: membrowse/membrowse-action/comment-action@v1
with:
api_key: ${{ secrets.MEMBROWSE_API_KEY }}
commit: ${{ github.event.pull_request.head.sha }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Complete workflow
Here's the full workflow. Create .github/workflows/membrowse.yml:
name: MemBrowse Memory Report
on:
pull_request:
push:
branches:
- main
permissions:
contents: read
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
setup:
runs-on: ubuntu-latest
outputs:
targets: ${{ steps.read-targets.outputs.targets }}
steps:
- uses: actions/checkout@v5
- name: Read targets configuration
id: read-targets
run: echo "targets=$(jq -c '.targets' .github/membrowse-targets.json)" >> $GITHUB_OUTPUT
analyze:
needs: setup
runs-on: ubuntu-latest
strategy:
matrix:
target: ${{ fromJson(needs.setup.outputs.targets) }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 2
# Add your build tool setup here (e.g., arm-none-eabi-gcc)
- name: Build ${{ matrix.target.name }}
run: ${{ matrix.target.build_script }}
- name: Analyze memory
continue-on-error: true
uses: membrowse/membrowse-action@v1
with:
elf: ${{ matrix.target.elf }}
ld: ${{ matrix.target.ld }}
target_name: ${{ matrix.target.name }}
api_key: ${{ secrets.MEMBROWSE_API_KEY }}
linker_vars: ${{ matrix.target.def }}
map_file: ${{ matrix.target.map_file }}
comment:
needs: analyze
runs-on: ubuntu-latest
if: ${{ !cancelled() && github.event_name == 'pull_request' }}
steps:
- name: Post PR comment
continue-on-error: true
uses: membrowse/membrowse-action/comment-action@v1
with:
api_key: ${{ secrets.MEMBROWSE_API_KEY }}
commit: ${{ github.event.pull_request.head.sha }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
For multiple targets, all results appear in a single PR comment.
To make exceeded budgets fail CI, remove continue-on-error: true from the analysis step. See Failing CI on Budget Alerts.
Action Reference
For all inputs and outputs, see the Action Reference.