raulcxw opened a new pull request, #19463:
URL: https://github.com/apache/nuttx/pull/19463

   ## Summary
   
   Both Realtek Ameba boards (`pke8721daf` / RTL8721Dx and `rtl8720f_evb` /
   RTL8720F) previously built only via the make build; their board
   `CMakeLists.txt` fell back to a `FATAL_ERROR`.  This wires up the full
   vendor-SDK machinery for CMake so `cmake --build` produces the same flashable
   `nuttx.bin` as make, **with no change to any shared/arch-common CMake file**
   (`arch/arm/src/cmake/*` untouched).
   
   - **`tools/ameba/env.sh`** — source once before cmake
     (`. tools/ameba/env.sh <board>`).  It resolves/auto-fetches the 
`ameba-rtos`
     SDK and the SDK-pinned asdk toolchain (reusing the same helper scripts the
     make build already uses) and puts the toolchain on `PATH`, so CMake's 
normal
     compiler probe finds it — like every other NuttX board.  No per-chip hook 
is
     added to the shared arch `Toolchain.cmake`.
   - **`common/ameba/cmake/{ameba_sdk,ameba_board}.cmake`** — the shared 
mechanism:
     SDK resolve + compiler/version guard, autoconf generation, 
`libameba_fwlib.a`
     / `libameba_wifi.a` built with the isolated SDK include set, the image2 
linker
     script + link flags, `nuttx.bin` packaging and the `flash` target.  Per-IC
     inputs are set by each arch chip `CMakeLists.txt`.
   - **`common/ameba/tools/{ameba_gen_ldscript,ameba_package,ameba_flash}.sh`** 
—
     shared shell steps used by both the make and cmake paths so the two produce
     identical output; `tools/ameba/Config.mk` flashes via `ameba_flash.sh` too.
   - **Per-IC asdk toolchain resolution** (`ameba_asdk_version.sh`) — each IC 
pins
     its asdk version in the SDK (RTL8720F -> 12.3.1, RTL8721Dx -> 10.3.1).  
make
     and cmake now build the NuttX objects with the version the IC pins, 
matching
     the SDK archives they link against.  A configure-time guard fails with a
     fix-it message if a stale environment puts the wrong compiler on `PATH`.
     (Supersedes and includes #19352.)
   - **fwlib/wifi archive hygiene** — the archives are packed from an explicit
     object list instead of a `*.o` glob, so a stale object from a previous
     configuration can no longer be pulled into the image.
   - **`CONFIG_SCHED_WAITPID`** enabled in both nsh defconfigs so foreground
     builtins (e.g. `wapi`) run synchronously with a correct exit status.
   - **Docs** — each chip page documents the SDK + toolchain (auto-fetched: by 
make
     on first build, by `env.sh` for cmake) and a `Building and Flashing` 
section
     with `With make` / `With CMake` subsections; build-time config options are
     shared, only the menuconfig entry point differs.
   
   ## Impact
   
   - New: CMake build for both Ameba boards.  The make build is unchanged —
     sourcing `env.sh` is optional for make, required for cmake.
   - No change to any shared/arch-common file (`arch/arm/src/cmake/*` 
untouched).
   
   ## Testing
   
   - Both boards build, flash and boot with Wi-Fi over **both** the make and 
cmake
     paths (hardware verified: NSH + `ifup wlan0` + WPA2).
   - Fork CI on top of current apache/master, all green: fresh-VM matrix
     (make + cmake x 2 boards), plus single-runner ops jobs that exercise the
     kconfig backend (`olddefconfig` / `savedefconfig`), switching boards **both
     ways** across the per-IC asdk boundary (10.3.1 <-> 12.3.1), `make 
distclean`,
     and the abnormal cases (stale / absent `env.sh` caught by the guards; a 
board
     switch without `make distclean` refused).
   
   <details>
   <summary>CMake build — pke8721daf:nsh (RTL8721Dx, asdk 10.3.1)</summary>
   
   ```
   $ . tools/ameba/env.sh pke8721daf
   Fetching asdk toolchain asdk-10.3.1-4602 (one-time) into ~/rtk-toolchain ...
     installed asdk-10.3.1-4602
   $ cmake -B build -DBOARD_CONFIG=pke8721daf:nsh -GNinja
   --   Board:  pke8721daf
   --   Config: nsh
   -- Found assembler: 
~/rtk-toolchain/asdk-10.3.1-4602/linux/newlib/bin/arm-none-eabi-gcc
   $ cmake --build build
   [1458/1460] Linking C executable nuttx
   PACK: wrote build/nuttx.bin
   -rw-r--r-- 1 root root  742176 build/nuttx.bin
   ```
   </details>
   
   <details>
   <summary>CMake build — rtl8720f_evb:nsh (RTL8720F, asdk 12.3.1)</summary>
   
   ```
   $ . tools/ameba/env.sh rtl8720f_evb
   Fetching asdk toolchain asdk-12.3.1-4600 (one-time) into ~/rtk-toolchain ...
     installed asdk-12.3.1-4600
   $ cmake -B build -DBOARD_CONFIG=rtl8720f_evb:nsh -GNinja
   --   Board:  rtl8720f_evb
   --   Config: nsh
   -- Found assembler: 
~/rtk-toolchain/asdk-12.3.1-4600/linux/newlib/bin/arm-none-eabi-gcc
   $ cmake --build build
   [1458/1460] Linking C executable nuttx
   PACK: wrote build/nuttx.bin
   -rw-r--r-- 1 root root  693920 build/nuttx.bin
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to