Build and toolchain
Requirements
The GNU toolchain for
mipsel-elf: GCC and binutils. The default is GCC 16.2.0 with binutils 2.42 in/opt/rgxcross; another one is selected withmake CROSS=<prefix> GCC=<gcc>. C23 needs GCC 14 or later.python3(tools/mkfw.py,tools/gen_sfids.py)No libc or libgcc: the firmware is freestanding (
memset,memcpy,__udivdi3and__umoddi3live insrc/util.c).
Build commands
make -C src # -> build/free_rogue_36.29.52.182_v1.1.fw
make -C src FWIF=1.1 # FWIF ABI version (default 1.1): name and .fw header
make -C src BVNC=36.29.52.182 # the same: the GPU core is selectable
make -C src -B EXP="-DEXP_NO_RENDER" # retire geometry/fragment commands unrun
make -C src sfid SFH=<path>/pvr_rogue_fwif_sf.h # regenerate src/include/sfid.h
make -C src clean
make -C src CROSS=/usr/bin/mipsel-elf- GCC=/usr/bin/mipsel-elf-gcc
# another GCC (14 or later)
Outputs in build/ (git-ignored):
Artifact |
Description |
|---|---|
|
Compiled object files |
|
Linked firmware ELF32 (four |
|
microMIPS disassembly ( |
|
Packed firmware container ( |
The build is deterministic: identical sources produce a byte-identical
.fw file.
Per-GPU constants
Everything that depends on the GPU core is in one directory,
src/bvnc/<b.v.n.c>/, selected with make BVNC=<b.v.n.c> (default
36.29.52.182, the BXE-2-32 of the K1; bvnc/36.29.52.182/bvnc.h — Per-GPU constants (BXE-2-32, K1)).
Each GPU has the same three kinds of file there, and each cites only the
docsClean of its own GPU:
bvnc.h, the values (bvnc/36.29.52.182/bvnc.h — Per-GPU constants (BXE-2-32, K1)): the BVNC that names the.fw(free_rogue_<b.v.n.c>_v<FWIF>.fw), the container’s device information (BVNC_FEAT_*,BVNC_QUIRKS,BVNC_ERNS, read bytools/mkfw.py --bvnc), the register tables of the unit initialisation, the tiles-in-flight cap, and the wired TLB layout of the assembly;boot.Sandvectors.S, the reset and exception code (boot.S and vectors.S — Assembly);seq.c, the hardware sequences whose order or structure differs between GPUs (bvnc/<bvnc>/seq.c — Per-GPU sequences), behind the interface ofinclude/bvnc_seq.h: the GPU-unit initialisation, the dust power request, the HWR soft reset, the per-job cache flush, the TQ_3D launch, the multicore compute control, the end-of-render sync and the PM steps of the first geometry kick.
How a difference between GPUs is handled:
a different value goes to
bvnc.h;a different order or structure goes to
seq.c: each GPU writes its whole sequence, even when it repeats most of another GPU’s, and the shared code only calls it;a hardware feature declared in the device information stays an
#ifdef BVNC_FEAT_*in the shared code (for example0x1858 = tpu_tag_cdm_ctrlwithTPU_DM_GLOBAL_REGISTERS), as the mainline driver does with features.
There are no defaults. A BVNC without a directory does not build, a header
that lacks a value fails to compile, and a seq.c that lacks a function
does not link: another GPU never inherits this one’s constants or
sequences.
The BXM-4-64 (36.56.104.183): its boot.S and vectors.S follow its
execution-environment.md (Config.K0 = 3 with the I-cache and D-cache
initialised by index, Status = 0x1C00, Compare = 0xFFFFFFFF, every
remap entry cleared, one 4 MiB TLB entry for the register and broadcast banks,
Wired = 4). The reset vector tells an NMI from a cold reset
(Status.NMI): an NMI writes struct rogue_mips_state to the NMI shared
area of the boot-data page (pvr_rogue_mips.h: offset 0x100) and
returns; the general exception handler writes the same dump before stopping.
Only KSEG0 (the exception code) is cached: the heap stays mapped uncached and
the boot-data page is reached through KSEG1, so the C code needs no D-cache
maintenance.
Its seq.c follows its own specification in:
the dust power request (
power-management.md2.3): soft-reset assert, mask, one timer tick, trigger,POWER_COMPLETE/POWER_ABORTpoll, release, retry on abort; clock gating forced on when the host setsDISABLE_CLKGATING_EN;the unit initialisation (MMU cache invalidation, SLC bypass from the size in
0x3970, ORed writes, core indices) and the host’s register overrides (reg_cfg,PWR_ONgroup);the HWR reset: per core, up to 3 attempts, bus quiesce, soft reset (
0xFFEFFFF8F3FFFC1Dplus the extra bits), unit initialisation, post-HWR TPU reset and SLC flush; a failure asks the host for a GPU restart (FWCCB REQUEST_GPU_RESTART);the per-job flush (per-core
0x0688and SLC polls, the 3D-only0x1470/0x1478, the wrapper barrier for every data master), theMMUCACHEorder (SLC0x10, MMU caches,0x1348, each polled; a timeout returnsPOLL_FAILURE),POW_OFF(dusts down, SLC drained);the kick admission test (
scheduler.md5:DISABLE_DM_OVERLAP, strict priority,PREVENT_CDM_OVERLAP,PREVENT_ALL_OVERLAP);the TQ_3D launch order (
0x0F00beforeISP_RENDER), theISP_ZLS_ENDwait,USC_TRIGGERforwarded to the host, the multicore compute control, and no0x0258at the first geometry kick.
It builds; nothing of it has run on a K3 yet. Not resolved (open points at the
end of its bvnc.h): the unit bits of the power request (the
specification does not give the number of units: BVNC_POWER_UNITS_MASK
is 0), the overalloc controls (0x4050, 0x06D8: no source for their
values), and two places where its specification contradicts itself. Still
single-core in the shared code (one core on the K3): the BIF catalogue
index, the occlusion-query base and the compute resume are written for core
0 only.
For the BXE-2-32, moving the constants to bvnc.h left the firmware
byte-identical. Moving the sequences to seq.c changes the image only by
the calls between files: every object other than gpu_init.o,
kick.o, hwr.o and geom.o is byte-identical, and the moved
functions are the same source (the flush minus the BXM-only steps).
Note
Always pass -B when changing EXP=…, because make does not
track macro changes. Verify that the build succeeded and that the .fw
SHA-256 changed before deploying — a failed build leaves the previous
.fw on disk (E023).
Compiler flags
-EL -march=mips32r2 -mmicromips -mabi=32 -msoft-float
-std=gnu23 -O2 -g -ffreestanding -fno-builtin -fno-pic -mno-abicalls -G0
-mlong-calls -fno-common -fno-stack-protector -fno-jump-tables
-fno-delete-null-pointer-checks -mno-check-zero-division
-Wall -Wextra -Werror -Wno-unused-parameter
Flag |
Reason |
|---|---|
|
Target ISA of the MIPS wrapper core; |
|
Code spans three distant regions ( |
|
Disables |
|
Prevents |
|
The microcontroller has no FPU. |
|
GNU C23: ISO C23 ( |
|
Without it, GCC at |
|
Without it, GCC follows every division with a |
The GNU toolchain since November 2026
Until November 2026 the firmware was built with clang and ld.lld. Moving
to GCC and binutils removed two LLVM workarounds:
LLVM’s assembler accepts microMIPS
mfc0/mtc0only for R6, socp0asm.hencoded them by hand as.hwordpairs. GNUasaccepts them, andboot.S,vectors.Sandmips.hnow use the real instructions (the encodings are identical).ld.lldrange-checked microMIPSJ/JALrelocations above0x80000000as if they were PC-relative, so the link needed--noinhibit-execandtools/ld-wrap.shto filter the false errors. GNUldlinks without warnings.
The code GCC 16 generates is about 25 % smaller (.text 27 KiB instead of
36 KiB).
Compile-time experiment knobs (EXP=)
Passed via make -C src -B EXP="-DNAME[=value]":
Knob |
Effect |
|---|---|
|
Disable timer polling of |
|
Flush and invalidate SLC before every |
|
Run the full DM 3 cache flush before every |
|
Override the TQ tiles-in-flight register value (E022) |
|
Use SLC-only completion flush instead of per-DM flush (E023) |
|
Retire |
|
Dump host |
|
Shared free lists between the PM contexts ( |
|
Full PM-MMU invalidation (SLC, BIF, PM TLB) in the restart after a
partial render, as the spec reads; it hung the board in
E043, so the default writes |
The knobs of the PM bring-up (E028–E040: EXP_TA,
EXP_CANARY, EXP_HS_MODE, EXP_PM_*, EXP_CLK_ON, EXP_SP32,
EXP_20F8_EDGE, EXP_0388, EXP_RESUME (E042), EXP_TOP_FIRST, EXP_F320,
EXP_UNIT_EXTRA, EXP_IDX_AFTER, EXP_NO_FL_LOAD, EXP_*_SP_CMD*,
EXP_FLAGS_AFTER_SP, EXP_FRAG_*, EXP_MTILE_STRIDE,
EXP_FRAG_DUMP) were removed in E041, when the working sequence
became the code. The experiment pages describe what each one did.
Test harness
tools/deploy.sh testGpuFwVulkan builds the testGpuFwVulkan Vulkan harness (repository
../testGpuFwVulkan) on the board; see Test harness: testGpuFwVulkan.
Build-time checks
tools/check-trace-args.pyruns before every link: eachTRACE(SFID_x, …)must pass the argument count of its format string (thecr_poll32trace bug of E037).tools/fw-preflight.pychecks the.fwcontainer (board-testing-oraclesection 2);tools/deploy.sh fwrefuses to copy a file that fails it.
Trace ID generation
src/include/sfid.h is generated by tools/gen_sfids.py from the public
Linux header pvr_rogue_fwif_sf.h. Each entry becomes
#define SFID_<GROUP>_<id> 0x7nngiiii, under a documentation comment that
holds its format string and parameter count, allowing
mainline pvr_fw_trace.c to decode this firmware’s traces without changes.