Skip to content

arch/arm/ameba: fix per-IC asdk toolchain selection and fwlib archive hygiene#19352

Open
raulcxw wants to merge 1 commit into
apache:masterfrom
Ameba-AIoT:ameba-build-fixes
Open

arch/arm/ameba: fix per-IC asdk toolchain selection and fwlib archive hygiene#19352
raulcxw wants to merge 1 commit into
apache:masterfrom
Ameba-AIoT:ameba-build-fixes

Conversation

@raulcxw

@raulcxw raulcxw commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Two independent Ameba build-system fixes:

  • Per-IC asdk toolchain selection. The asdk (arm-none-eabi) toolchain
    version is declared per SoC-project (component/soc/<soc>/project/CMakeLists.txt: v_ASDK_VER), overriding the top-level cmake/global_define.cmake default. The
    RTL8720F project declares 12.3.1 while the amebadplus (RTL8721Dx) subtree
    default is 10.3.1, but toolchain.mk / ameba_fetch_toolchain.sh only read the
    top-level default, so RTL8720F was built with the wrong toolchain (10.3.1
    instead of its declared 12.3.1). Now the per-SoC CMakeLists is read first (via
    AMEBA_SOC_NAME), falling back to the global default.

  • fwlib/wifi archive hygiene. libameba_fwlib.a / libameba_wifi.a were
    archived with a fwlib_obj/*.o wildcard, but distclean does not clean the
    gitignored prebuilt object dir. On an incremental build after the source list
    changed, a stale object (e.g. log.o, whose .bss is ROM-resident) was
    silently re-archived and dragged into the link, tripping the SDK ROM-overlay
    assert (__romlib_bss_end__ is changed). A clean build is unaffected. Now only
    the explicit object list from AMEBA_FWLIB_SRCS / AMEBA_WIFI_SRCS is
    archived, and the archive is removed before rebuilding so it never accumulates.

Impact

  • Is new feature added / existing changed? NO (build-system fixes only).
  • Impact on user? NO.
  • Impact on build? YES — RTL8720F now uses its declared 12.3.1 toolchain, and
    incremental builds no longer trip the ROM-overlay assert from a stale object.
    RTL8721Dx is unaffected (10.3.1, now selected explicitly per-SoC).
  • Impact on hardware? NO logic change; affects the arch/arm/ameba build only.
  • Impact on documentation? NO.
  • Impact on security? NO.
  • Impact on compatibility? NO (self-contained to arch/arm/ameba).

Testing

Build Host: Ubuntu (WSL2), x86_64; Realtek asdk arm-none-eabi-gcc auto-fetched by
the board build.
Targets: pke8721daf:nsh (RTL8721Dx), rtl8720f_evb:nsh (RTL8720F).

Before change — incremental RTL8720F build with a stale prebuilt object:

LD: nuttx
arm-none-eabi-ld: __romlib_bss_end__ is changed. Common bss of rom_lib and
rom_tz may be modified illegally.
make[1]: *** [Makefile:230: nuttx] Error 1

After change — both boards build clean; RTL8720F now selects asdk-12.3.1:

# rtl8720f_evb:nsh   -> asdk-12.3.1-4600
PACK: wrote {app.bin, boot.bin, km4ns_image2_all.bin}
# pke8721daf:nsh     -> asdk-10.3.1-4602
PACK: wrote {app.bin, boot.bin, km0_image2_all.bin}

Both images boot to NSH on hardware (boot/iperf logs in the WiFi PR).

PR verification Self-Check

  • This PR introduces only one functional change (Ameba build-system).
  • I have updated all required description fields above.
  • My PR adheres to Contributing Guidelines (commit title/message, coding standard).
  • My PR is still work in progress (not ready for review).

@raulcxw raulcxw changed the title rch/arm/ameba: fix per-IC asdk toolchain selection and fwlib archive hygiene arch/arm/ameba: fix per-IC asdk toolchain selection and fwlib archive hygiene Jul 6, 2026
@raulcxw raulcxw force-pushed the ameba-build-fixes branch from 4471548 to ba6ae60 Compare July 6, 2026 09:24
xiaoxiang781216
xiaoxiang781216 previously approved these changes Jul 6, 2026
… hygiene

Two independent Ameba build-system fixes:

1. Per-IC asdk (arm-none-eabi) toolchain selection.  The toolchain version is
   declared per SoC-project (component/soc/<soc>/project/CMakeLists.txt:
   v_ASDK_VER), which overrides the top-level cmake/global_define.cmake default.
   The RTL8720F project declares 12.3.1 while the amebadplus (RTL8721Dx) subtree
   default is 10.3.1, but toolchain.mk and ameba_fetch_toolchain.sh only read the
   top-level default, so RTL8720F was built with the wrong toolchain (10.3.1
   instead of its declared 12.3.1).  Read the per-SoC CMakeLists first (via
   AMEBA_SOC_NAME), falling back to the global default.  Also resolve the
   toolchain archive name from the SDK cmake's TOOLCHAINNAME instead of
   hardcoding it: the name differs per version (asdk-12.3.1 drops the
   "_with_small_reent" suffix asdk-10.3.1 uses), so the hardcoded name 404s when
   fetching 12.3.1.

2. fwlib/wifi archive hygiene.  libameba_fwlib.a / libameba_wifi.a were archived
   with a fwlib_obj/*.o wildcard, but distclean does not clean the gitignored
   prebuilt object dir.  On an incremental build after the source list changed, a
   stale object left behind (e.g. log.o, whose .bss is ROM-resident) was silently
   re-archived and dragged into the link, tripping the SDK ROM-overlay assert
   (__romlib_bss_end__ is changed).  A clean build is unaffected.  Archive only
   the explicit object list derived from AMEBA_FWLIB_SRCS / AMEBA_WIFI_SRCS, and
   remove the archive before rebuilding so it never accumulates.

Signed-off-by: raul_chen <raul_chen@realsil.com.cn>
@github-actions github-actions Bot added Arch: arm Issues related to ARM (32-bit) architecture Size: S The size of the change in this PR is small labels Jul 6, 2026
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: arm Issues related to ARM (32-bit) architecture Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants