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

   # arm64/imx95: enable SMP on i.MX95, expand DRAM to 512 MB, and align 
nsh_smp defconfig
   
   ## Summary
   
   Five commits preparing `imx95-a55-evk` for a real SMP workload (FastDDS / C++
   runtime, basePlateAPP, SQLite):
   
   1. `arm64/cmake` — set default LLVM arch/ABI so downstream WASM AOT tooling 
can
      generate native code for arm64 targets.
   2. `boards/arm64/imx95` — add the first `nsh_smp` defconfig for the board.
   3. `imx95-a55-evk` — grow NuttX DRAM from 128 MB to 512 MB, keeping i.MX93 at
      128 MB.
   4. `imx95-a55-evk` — align `nsh_smp` with the `usbdev` config: eMMC, USB/ADB,
      FATFS, large files.
   5. `imx95-a55-evk` — align `nsh_smp` for the FastDDS/C++ runtime: locale,
      `atexit`, file-descriptor limits, `pthread_atfork`, larger stacks, more 
TLS
      slots.
   
   ## Commits
   
   ```text
   e8a307c9e51 arm64/cmake: set default LLVM arch and ABI type for arm64 targets
   953a1842840 boards/arm64/imx95: add smp
   fa69c1a2ebd imx95-a55-evk: expand NuttX RAM from 128MB to 512MB
   1d9a34dfade boards/imx95-a55-evk: align nsh_smp defconfig with usbdev
   504a6c3b132 boards/imx95-a55-evk: align nsh_smp defconfig for FastDDS runtime
   ```
   
   ```text
    arch/arm64/include/imx9/chip.h                            |   5 +-
    arch/arm64/src/cmake/Toolchain.cmake                      |   4 +
    boards/arm64/imx9/imx95-a55-evk/configs/nsh/defconfig     |   2 +-
    boards/arm64/imx9/imx95-a55-evk/configs/nsh_smp/defconfig | 123 
++++++++++++++++++++--
    boards/arm64/imx9/imx95-a55-evk/scripts/dramboot.ld       |   4 +-
    5 files changed, 130 insertions(+), 8 deletions(-)
   ```
   
   ## Change detail
   
   ### 1. LLVM arch/ABI defaults (`arch/arm64/src/cmake/Toolchain.cmake`)
   
   ```diff
   +# Set default LLVM arch/abi for all arm64 targets
   +set(LLVM_ARCHTYPE aarch64)
   +set(LLVM_ABITYPE aapcs64)
   ```
   
   These are consumed by wamrc when AOT-compiling WASM to native arm64. Without
   them the tooling has no way to infer the target triple from the 
Makefile-driven
   build, so every arm64 board had to set it locally.
   
   ### 2. NuttX DRAM 128 MB → 512 MB (`arch/arm64/include/imx9/chip.h`)
   
   `CONFIG_RAMBANK1_SIZE` was a single `MB(128)` shared by both i.MX93 and 
i.MX95.
   It is now selected per chip so i.MX93 keeps its 128 MB:
   
   ```diff
    #if defined(CONFIG_ARCH_CHIP_IMX93)
    #define CONFIG_RAMBANK1_ADDR      0x80000000
   +#define CONFIG_RAMBANK1_SIZE      MB(128)
    #elif defined(CONFIG_ARCH_CHIP_IMX95)
    #define CONFIG_RAMBANK1_ADDR      0xa0100000
   +#define CONFIG_RAMBANK1_SIZE      MB(512)
    #endif
   -#define CONFIG_RAMBANK1_SIZE      MB(128)
   ```
   
   Because the PCI DMA window used to sit immediately after the old 128 MB 
bank, it
   moves out of the way:
   
   ```diff
   -#define CONFIG_PCI_DMA_ADDR       0xa8100000
   +#define CONFIG_PCI_DMA_ADDR       0xc0100000
   ```
   
   `0xa0100000 + 512 MB = 0xc0100000`, so the DMA window now starts exactly 
where
   DRAM ends and no region overlaps. The linker script and both defconfigs 
follow:
   
   ```diff
   -  dram (rwx) : ORIGIN = 0xa0100000, LENGTH = 128M
   +  dram (rwx) : ORIGIN = 0xa0100000, LENGTH = 512M
   
   -CONFIG_RAM_SIZE=134217728
   +CONFIG_RAM_SIZE=536870912
   ```
   
   ### 3–5. `nsh_smp` defconfig
   
   The `nsh_smp` config starts from the existing `nsh` config and adds, in 
order:
   
   - **SMP**: `CONFIG_SMP=y`, `CONFIG_SMP_NCPUS=6` (all six Cortex-A55 cores).
   - **Storage / USB**: `CONFIG_IMX9_USDHC1` (eMMC), `CONFIG_USBDEV_DWC3` + ADB,
     `FS_FATFS` instead of the legacy `FS_FAT`, `FS_LARGEFILE`.
   - **C++ runtime**: `LIBC_LOCALE` + `LIBC_LOCALE_GETTEXT`, `LIBC_LOCALTIME`,
     `LIBC_MAX_EXITFUNS=1`, `LIBC_OPEN_MAX=255`, `PTHREAD_ATFORK`,
     `PTHREAD_STACK_DEFAULT=65536`, `TLS_NELEM=16`, `TLS_TASK_NELEM=32`.
   
   `FS_LARGEFILE` is not cosmetic: MBR partition parsing multiplies `blkcnt_t` 
by
   512, which overflows 32 bits for partitions beyond 4 GB, so the switch to 
FATFS
   is what makes the eMMC usable at all on a 512 MB device image.
   
   ## Verification
   
   ### Build
   
   ```text
   $ export PATH=<aarch64-none-elf>/bin:$PATH
   $ tools/configure.sh -a ../apps imx95-a55-evk:nsh_smp
   $ make -j$(nproc)
   ...
   LD: nuttx
   Memory region         Used Size  Region Size  %age Used
               dram:      680160 B       512 MB      0.13%
   CP: nuttx.hex
   CP: nuttx.bin
   ```
   
   The 512 MB region is visible in the linker report. The other two configs of 
the
   same board also build clean:
   
   ```text
   imx95-a55-evk:nsh     PASS   dram: 483136 B / 512 MB
   imx95-a55-evk:emmc    PASS   dram: 540528 B / 512 MB
   imx95-a55-evk:nsh_smp PASS   dram: 680160 B / 512 MB
   ```
   
   ### checkpatch
   
   ```text
   $ tools/checkpatch.sh -c -u -m -g ed122374690..HEAD
   Used config files:
       1: .codespellrc
   ✔️ All checks pass.
   ```
   
   ### Note: a build break fixed in this series
   
   The `usbdev` alignment commit originally replaced `CONFIG_SCHED_HPWORK=y` 
with
   the new MMCSD/USDHC options instead of adding to them. That broke
   `imx95-a55-evk:nsh_smp` outright:
   
   ```text
   ./chip/imx9_usdhc.c:93:4: error: #error "Callback support requires
     CONFIG_SCHED_WORKQUEUE and CONFIG_SCHED_HPWORK"
   ```
   
   `imx9_usdhc.c` requires both symbols whenever the driver and `MMCSD_SDIO` are
   enabled. The fix is folded into that commit:
   
   ```diff
    CONFIG_SCHED_HAVE_PARENT=y
   +CONFIG_SCHED_HPWORK=y
    CONFIG_SCHED_HPWORKPRIORITY=192
    CONFIG_SCHED_LPWORK=y
    CONFIG_SCHED_LPWORKPRIORITY=50
   +CONFIG_SCHED_WORKQUEUE=y
    CONFIG_SDIO_BLOCKSETUP=y
   ```
   
   Note that `CONFIG_SCHED_HPWORKPRIORITY=192` was already present without
   `CONFIG_SCHED_HPWORK=y`, which is why the break was not obvious from the
   priority setting alone.
   
   ## Honest notes
   
   - **No runtime verification.** These changes target `imx95-a55-evk` hardware,
     which is not available here. Everything above is build- and
     tooling-verified; the SMP boot path itself was not exercised on a board and
     no `nsh` session output is included.
   - **`CONFIG_SMP_NCPUS=6` vs. `CONFIG_NCPUS`.** This series predates the
     `CONFIG_NCPUS` unification, so the defconfig uses `CONFIG_SMP_NCPUS`. If 
it is
     rebased onto a tree that renamed the symbol, that line needs updating.
   - **The 512 MB figure is the NuttX bank, not total DRAM.** 
`CONFIG_RAMBANK1_ADDR`
     is `0xa0100000` (after the u-boot reserved area), so the mapped region 
ends at
     `0xc0100000`. Boards whose u-boot layout differs will need their own value.
   


-- 
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