Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

k3: fit am62p/am62-lp R5 SPL into SRAM (GCC 13 + per-SoC size handling), fix tispl rename & u-boot artifact hashing - #10237

#10237
Open
igorpecovnik wants to merge 2 commits into
mainarmbian/build:mainfrom
k3-am62-lpsk-r5-spl-sizearmbian/build:k3-am62-lpsk-r5-spl-sizeCopy head branch name to clipboard
Open

k3: fit am62p/am62-lp R5 SPL into SRAM (GCC 13 + per-SoC size handling), fix tispl rename & u-boot artifact hashing#10237
igorpecovnik wants to merge 2 commits into
mainarmbian/build:mainfrom
k3-am62-lpsk-r5-spl-sizearmbian/build:k3-am62-lpsk-r5-spl-sizeCopy head branch name to clipboard

Conversation

@igorpecovnik

@igorpecovnik igorpecovnik commented Jul 19, 2026

Copy link
Copy Markdown
Member

Fixes the K3 am62p / am62-lp u-boot builds that were failing across all vendor branches (vendor, vendor-rt, vendor-edge) plus mainline edge — the R5 first-stage SPL overflowing its SRAM size limit, and the tispl/u-boot rename breaking on newer u-boot. Touches two files: config/sources/families/include/k3_common.inc and lib/functions/artifacts/artifact-uboot.sh. The R5 stage builds with soft-float gcc-13-arm-linux-gnueabi, already present in the framework image (armbian/docker-armbian-build#37, merged).

1. R5 SPL overruns its SRAM size limit → GCC 13 + per-SoC size handling

The R5 first-stage SPL (tiboot3) for am62p and am62-lp overruns CONFIG_SPL_SIZE_LIMIT:

spl/u-boot-spl.bin exceeds file size limit

Two forces push it over: GCC 14 (the Trixie default) produces larger SPL code than TI validated, and the newer TI vendor trees (ti-u-boot-2026.01, TI SDK 12.00.00.07) grew the SPL. GCC 13 is necessary but not sufficient on its own, so compile_k3_bootgen combines it with a size remedy chosen per SoC.

Compiler: the R5 stage is built with CC=arm-linux-gnueabi-gcc-13 (u-boot Kbuild honours a command-line CC; CROSS_COMPILE stays for binutils). Passing CC explicitly means no silent fallback — an early -dumpversion check asserts the major version is 13 and fails loudly otherwise, rather than reverting to gcc-14 and reintroducing the overflow. Only the R5 first stage changes compiler; the A53 SPL and u-boot proper are untouched.

The two SoCs need different size remedies because their MCU SRAM layout differs:

Board Stack ptr BSS SPL_SIZE_LIMIT Headroom Remedy
am62p (AM62P5) base+0x4a7f0 base+0x4b000 0x3C000 ~0xE7f0 free raise limit + -Os
am62-lp (AM625) base+0x3a7f0 base+0x3b000 0x3A7F0 none (limit is the stack ptr) strip unused boot stacks + -Os
  • am62p — there is ~58 KB of unused MCU SRAM above the limit, so raise SPL_SIZE_LIMIT 0x3C0000x40000 and SPL_MAX_SIZE 0x3B0000x3F000 (both stay well below the stack pointer) and build for size (-Os). No boot paths are removed — SPI-NOR and SPI-NAND stay intact.
  • am62-lp — the limit already sits exactly at the stack pointer with BSS immediately above, so there is nowhere to raise into; the image must shrink instead. Armbian boots tiboot3 from SD/eMMC-FAT only, so drop the unused SPI-NOR and SPI-NAND/MTD boot stacks that am62x_lpsk adds over am62x_evm (SPL_SPI_FLASH*, DM_SPI_FLASH, SPI_FLASH_*, SPL_MTD*, SPL_NAND_SPI_SUPPORT, MTD_SPI_NAND, DM_MTD, SPL_YMODEM_SUPPORT) and build for size (-Os). olddefconfig cascades the dependencies.

Note

The am62-lp change removes SPI-NAND/SPI-NOR boot support from that board's tiboot3 — dead weight for Armbian's SD/eMMC images, but a capability change. @jonaswood01 (board maintainer): flag if you need am62-lp to boot from SPI-NAND.

2. tispl/u-boot rename breaks on newer u-boot (beagleplay & other GP boards)

post_uboot_custom_postprocess__update_uboot_names copied a board's override image (TISPL_FILE/UBOOT_FILE) onto tispl.bin/u-boot.img. Newer u-boot broke this two ways, each tripping Armbian's ERR trap:

  • renamed outputs — mainline 2026.07 / recent TI SDK renamed the GP outputs to ti-spl_unsigned.fit.*; the old *_unsigned files no longer exist, so cp <absent> failed (broke beagleplay-{edge,vendor,vendor-rt}, sk-tda4vm, beaglebone-ai64);
  • same file — on GP parts binman can make the *_unsigned image and tispl.bin the same file, so cp src dst errors "are the same file".

Fix: guard each copy on the file existing (an if, since [[ -f x ]] && cp returns 1 when absent and would itself trap) and keep || true so a same-file copy is tolerated. When skipped, binman's standard tispl.bin/u-boot.img is left in place. (nounset is off, so this is not an unbound-var issue.)

3. u-boot artifact hash now tracks the K3 recipe

The u-boot artifact version hashes specific hook/function bodies, but compile_k3_bootgen/compile_k3_optee weren't among them — the hashed pre_config_uboot_target hook only calls them. So changing the R5 recipe (e.g. the GCC 13 switch and size handling above) didn't change the artifact hash and a stale cached u-boot was reused. Add both to calculate_hash_for_function_bodies; it skips functions that don't exist, so non-K3 families are unaffected (K3 boards rebuild once, then track correctly).


Testing

All affected u-boot artifacts compile once the gcc-13 image is live; the size remedies were verified against CI run 30202614279 (the pre-fix R5 overflow of 0x1c8a0x1dfe on am62p and 0xe880xfe0 on am62-lp).

A card boot smoke test is still needed before merge — to confirm the raised-limit am62p R5 SPL boots, and that am62-lp boots from SD/eMMC with the SPI-NOR/SPI-NAND stacks stripped.

@github-actions github-actions Bot added size/medium PR with more then 50 and less then 250 lines 08 Milestone: Third quarter release labels Jul 19, 2026
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Updates K3 boot generation with R5 tiboot3 configuration fixups for selected AM62x targets and guards optional tispl.bin and u-boot.img copies against missing source files.

Changes

K3 boot build handling

Layer / File(s) Summary
R5 SPL configuration fixups
config/sources/families/include/k3_common.inc
compile_k3_bootgen adjusts selected R5 tiboot3 configuration options and runs olddefconfig when changes are applied.
Conditional boot artifact copies
config/sources/families/include/k3_common.inc
Post-processing copies tispl.bin and u-boot.img only when their corresponding source files exist, then returns successfully.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: glneo, grippy98, jonaswood01

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main changes: per-SoC R5 SPL size fixes and safer TISPL/u-boot artifact handling.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch k3-am62-lpsk-r5-spl-size

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... labels Jul 19, 2026
@igorpecovnik igorpecovnik added Work in progress Unfinished / work in progress and removed Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... labels Jul 19, 2026
@github-actions github-actions Bot added Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... labels Jul 20, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@config/sources/families/include/k3_common.inc`:
- Around line 141-143: Update the artifact-copy logic in the surrounding hook so
missing TISPL_FILE or UBOOT_FILE sources remain successful, but failures from cp
for existing sources propagate to the caller. Remove the unconditional success
behavior from the hook’s final return path and ensure both copy commands
preserve their nonzero status.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 71c326bc-5d81-4af4-9272-131aaa71afb4

📥 Commits

Reviewing files that changed from the base of the PR and between 417c258 and 7ed9428.

📒 Files selected for processing (1)
  • config/sources/families/include/k3_common.inc

Comment thread config/sources/families/include/k3_common.inc Outdated
@igorpecovnik
igorpecovnik force-pushed the k3-am62-lpsk-r5-spl-size branch from adce8fe to 5f9d90d Compare July 20, 2026 09:21
@igorpecovnik igorpecovnik changed the title k3: sk-am62-lp: shrink R5 SPL to fit SRAM + silence k3 cp noise k3: fit am62p & am62-lp R5 SPL to SRAM, and fix tispl/u-boot rename on newer u-boot Jul 20, 2026
@igorpecovnik
igorpecovnik force-pushed the k3-am62-lpsk-r5-spl-size branch from 5f9d90d to 77454d9 Compare July 20, 2026 14:54
@github-actions github-actions Bot added the Framework Framework components label Jul 20, 2026
@igorpecovnik igorpecovnik changed the title k3: fit am62p & am62-lp R5 SPL to SRAM, and fix tispl/u-boot rename on newer u-boot k3: build R5 SPL with GCC 13 to fit SRAM (restore am62-lp SPI-NAND), fix tispl rename & artifact hashing Jul 20, 2026
@igorpecovnik
igorpecovnik force-pushed the k3-am62-lpsk-r5-spl-size branch from 5bf8788 to 8d054ed Compare July 20, 2026 20:40
@igorpecovnik igorpecovnik changed the title k3: build R5 SPL with GCC 13 to fit SRAM (restore am62-lp SPI-NAND), fix tispl rename & artifact hashing k3: build R5 SPL with GCC 13 to fit SRAM, fix tispl rename & u-boot artifact hashing Jul 20, 2026
@igorpecovnik
igorpecovnik force-pushed the k3-am62-lpsk-r5-spl-size branch 6 times, most recently from ee9f898 to 0c13082 Compare July 22, 2026 02:52
@igorpecovnik
igorpecovnik force-pushed the k3-am62-lpsk-r5-spl-size branch from 0c13082 to 0b80178 Compare July 24, 2026 14:02
@Grippy98

Copy link
Copy Markdown
Contributor

@jonaswood01 @glneo Can you guys take a look?

SK-AM62-LP binary is still too big even with the PR for some reason when I built it w/this PR (0x31074)

I think YMODEM is also required for UART boot so it wouldn't fly for Test farm.

@igorpecovnik
igorpecovnik force-pushed the k3-am62-lpsk-r5-spl-size branch from ca713bb to f563f6a Compare July 26, 2026 16:26
@igorpecovnik igorpecovnik changed the title k3: build R5 SPL with GCC 13 to fit SRAM, fix tispl rename & u-boot artifact hashing k3: fit am62p/am62-lp R5 SPL into SRAM (GCC 13 + per-SoC size handling), fix tispl rename & u-boot artifact hashing Jul 26, 2026
@igorpecovnik
igorpecovnik force-pushed the k3-am62-lpsk-r5-spl-size branch from f563f6a to 925859b Compare July 26, 2026 18:24
The R5 first-stage SPL (tiboot3) for am62p and am62-lp overran
CONFIG_SPL_SIZE_LIMIT on the Trixie toolchain (GCC 14) and newer TI
u-boot. Fix it per-SoC in compile_k3_bootgen():

- Build the R5 SPL with GCC 13; GCC 14 emits oversized code. Fail early
  if arm-linux-gnueabi-gcc-13 is absent rather than silently falling back
  to the default compiler and reintroducing the overflow.
- am62p (AM62P5): the SoC has ~0xE7f0 of MCU SRAM headroom above the
  limit (early stack pointer at base+0x4a7f0, BSS at base+0x4b000, but
  SPL_SIZE_LIMIT only 0x3C000). Raise SPL_SIZE_LIMIT to 0x40000 and
  SPL_MAX_SIZE to 0x3F000 and build for size (-Os). No boot paths removed.
- am62-lp (AM625): SPL_SIZE_LIMIT (0x3A7F0) already sits at the stack
  pointer with BSS immediately above -- no SRAM to raise into -- so shrink
  the image. Armbian boots tiboot3 from SD/eMMC-FAT only, so drop the
  unused SPI-NOR and SPI-NAND/MTD boot stacks am62x_lpsk adds over
  am62x_evm, and build for size (-Os).

Only the R5 first stage is affected; the A53 SPL and u-boot proper are
untouched. Also make the tispl/u-boot output rename robust to renamed and
same-file binman outputs on newer u-boot (mainline 2026.07 / recent TI
SDK), which otherwise trip Armbian's ERR trap.

Signed-off-by: Igor Pecovnik <igor@armbian.com>
The computed u-boot artifact version did not change when the K3
first-stage build functions (compile_k3_bootgen / compile_k3_optee) were
edited, so cached artifacts could survive across meaningful changes to the
R5 SPL / OP-TEE build recipe. Add both functions to the list hashed into
the version. calculate_hash_for_function_bodies skips functions that don't
exist, so listing these K3-specific builders is a no-op for other families.

Signed-off-by: Igor Pecovnik <igor@armbian.com>
@igorpecovnik
igorpecovnik force-pushed the k3-am62-lpsk-r5-spl-size branch from 925859b to 4e72b1b Compare July 27, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

08 Milestone: Third quarter release Framework Framework components Hardware Hardware related like kernel, U-Boot, ... Needs review Seeking for review size/medium PR with more then 50 and less then 250 lines Work in progress Unfinished / work in progress

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.