This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 7ea8b59a59 boards/imx93-evk: kernel build for AHAB boot
7ea8b59a59 is described below
commit 7ea8b59a59785cf9107c204d8d38eb61a5f0df70
Author: George Poulios <[email protected]>
AuthorDate: Thu May 1 22:53:18 2025 +0300
boards/imx93-evk: kernel build for AHAB boot
Add kernel build (target imx93-evk:knsh) to i.MX93 EVK.
This target is preconfigured for use with AHAB boot (see
https://spsdk.readthedocs.io/en/latest/examples/ahab/imx93/imx93_ahab_uboot.html)
as a replacement of U-Boot proper (BL33 at EL2), hence
the load address is set to 0x80200000.
Signed-off-by: George Poulios <[email protected]>
---
.../arm64/imx9/boards/imx93-evk/README.txt | 35 +++++
arch/arm64/src/imx9/Kconfig | 8 +
boards/arm64/imx9/imx93-evk/configs/knsh/defconfig | 174 +++++++++++++++++++++
boards/arm64/imx9/imx93-evk/include/.gitignore | 1 +
boards/arm64/imx9/imx93-evk/include/bin_romfsimg.h | 42 +++++
boards/arm64/imx9/imx93-evk/scripts/Make.defs | 2 +
boards/arm64/imx9/imx93-evk/scripts/gnu-elf.ld | 131 ++++++++++++++++
boards/arm64/imx9/imx93-evk/scripts/kernel.ld | 163 +++++++++++++++++++
boards/arm64/imx9/imx93-evk/src/imx9_bringup.c | 23 +++
9 files changed, 579 insertions(+)
diff --git a/Documentation/platforms/arm64/imx9/boards/imx93-evk/README.txt
b/Documentation/platforms/arm64/imx9/boards/imx93-evk/README.txt
index 412b39facc..365b328c03 100644
--- a/Documentation/platforms/arm64/imx9/boards/imx93-evk/README.txt
+++ b/Documentation/platforms/arm64/imx9/boards/imx93-evk/README.txt
@@ -85,6 +85,7 @@ You have four options:
2 - Load via gdb
3 - Load via JLink
4 - Run from SD-card, without u-boot
+5 - Kernel build, via AHAB boot
==========================================
@@ -167,3 +168,37 @@ Option 4: Run from SD-card, without u-boot
3. Insert the SD-card into the imx93-evk, make sure BMODE switch is [1,2,3,4]
= [Off, On, Off, Off] so that it boots from the SD-card.
This should boot into NuttShell in EL3 level.
+
+==========================================
+
+Option 5: Kernel build, via AHAB boot
+
+==========================================
+
+1. Follow the instructions at:
https://spsdk.readthedocs.io/en/latest/examples/ahab/imx93/imx93_ahab_uboot.html
+ to create an eMMC-bootable image (latest version of instructions tested is
v2.6.1). We will be replacing the u-boot binary in step 2.3 with NuttX.
+
+2. Clone both NuttX and NuttX-Apps in same level directories `nuttx` and
`apps` respectively.
+
+3. Configure and build NuttX:
+
+ cd nuttx
+ tools/configure.sh imx93-evk:knsh
+ make
+ make export
+
+4. Build NuttX apps and prepare the /bin ROMFS image:
+
+ pushd ../apps
+ tools/mkimport.sh -z -x ../nuttx/nuttx-export-*.tar.gz
+ make import
+ tools/mkromfsimg.sh
+ mv boot_romfsimg.h
../nuttx/boards/arm64/imx9/imx93-evk/include/bin_romfsimg.h
+ popd
+
+5. Re-build NuttX embedding the generated /bin ROMFS image:
+
+ make clean clean_context
+ make
+
+6. Replace the value of the `u-boot:` entry in workspace/ahab_template.yaml
created in step 1 above with the path to nuttx.bin.
diff --git a/arch/arm64/src/imx9/Kconfig b/arch/arm64/src/imx9/Kconfig
index 36f50bde41..3686bfd8b4 100644
--- a/arch/arm64/src/imx9/Kconfig
+++ b/arch/arm64/src/imx9/Kconfig
@@ -27,6 +27,14 @@ endchoice # i.MX9 Chip Selection
endmenu # "i.MX9 Chip Selection"
+config IMX9_BIN_ROMFS
+ bool "Register the /bin ROMFS file system at /dev/ram0"
+ depends on FS_ROMFS
+ default n
+ ---help---
+ Register a ROMFS image at /dev/ram0 for use with
CONFIG_INIT_MOUNT*.
+ The image must be placed into <arch/board/bin_romfsimg.h>.
+
config IMX9_DMA_ALLOC
bool "Enable DMA capable memory allocator"
depends on GRAN
diff --git a/boards/arm64/imx9/imx93-evk/configs/knsh/defconfig
b/boards/arm64/imx9/imx93-evk/configs/knsh/defconfig
new file mode 100644
index 0000000000..cb66d1c771
--- /dev/null
+++ b/boards/arm64/imx9/imx93-evk/configs/knsh/defconfig
@@ -0,0 +1,174 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed
.config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that
includes your
+# modifications.
+#
+# CONFIG_MMCSD_HAVE_WRITEPROTECT is not set
+# CONFIG_MMCSD_IOCSUPPORT is not set
+# CONFIG_MMCSD_MMCSUPPORT is not set
+CONFIG_ARCH="arm64"
+CONFIG_ARCH_ADDRENV=y
+CONFIG_ARCH_ARM64=y
+CONFIG_ARCH_BOARD="imx93-evk"
+CONFIG_ARCH_BOARD_IMX93_EVK=y
+CONFIG_ARCH_CHIP="imx9"
+CONFIG_ARCH_CHIP_IMX93=y
+CONFIG_ARCH_CHIP_IMX9=y
+CONFIG_ARCH_DATA_NPAGES=0
+CONFIG_ARCH_DATA_VBASE=0xC0000000
+CONFIG_ARCH_EARLY_PRINT=y
+CONFIG_ARCH_HEAP_NPAGES=0
+CONFIG_ARCH_HEAP_VBASE=0x00000000
+CONFIG_ARCH_INTERRUPTSTACK=4096
+CONFIG_ARCH_KERNEL_STACKSIZE=8192
+CONFIG_ARCH_KMAP_NPAGES=4096
+CONFIG_ARCH_KMAP_VBASE=0xBF000000
+CONFIG_ARCH_PGPOOL_MAPPING=y
+CONFIG_ARCH_PGPOOL_PBASE=0x82000000
+CONFIG_ARCH_PGPOOL_SIZE=94371840
+CONFIG_ARCH_PGPOOL_VBASE=0x82000000
+CONFIG_ARCH_TEXT_NPAGES=0
+CONFIG_ARCH_TEXT_VBASE=0x00000000
+CONFIG_ARCH_USE_MMU=y
+CONFIG_ARM64_STRING_FUNCTION=y
+CONFIG_BCH_BUFFER_ALIGNMENT=64
+CONFIG_BOARD_LATE_INITIALIZE=y
+CONFIG_BOARD_LOOPSPERMSEC=241712
+CONFIG_BUILD_KERNEL=y
+CONFIG_CDCACM=y
+CONFIG_DEBUG_ASSERTIONS=y
+CONFIG_DEBUG_FEATURES=y
+CONFIG_DEBUG_FULLOPT=y
+CONFIG_DEBUG_SYMBOLS=y
+CONFIG_DEFAULT_TASK_STACKSIZE=32384
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DRIVERS_NOTE=y
+CONFIG_ELF=y
+CONFIG_ELF_STACKSIZE=4096
+CONFIG_ETH0_PHY_MULTI=y
+CONFIG_EXAMPLES_HELLO=y
+CONFIG_EXAMPLES_TCPBLASTER=y
+CONFIG_EXAMPLES_UDPBLASTER=y
+CONFIG_EXPERIMENTAL=y
+CONFIG_FAT_DMAMEMORY=y
+CONFIG_FS_FAT=y
+CONFIG_FS_FATTIME=y
+CONFIG_FS_PROCFS=y
+CONFIG_FS_ROMFS=y
+CONFIG_GPT_PARTITION=y
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+CONFIG_I2C=y
+CONFIG_I2C_RESET=y
+CONFIG_IDLETHREAD_STACKSIZE=8192
+CONFIG_IMX9_BIN_ROMFS=y
+CONFIG_IMX9_DMA_ALLOC=y
+CONFIG_IMX9_DMA_ALLOC_POOL_SIZE=81920
+CONFIG_IMX9_EDMA=y
+CONFIG_IMX9_ENET1_RGMII=y
+CONFIG_IMX9_ENET=y
+CONFIG_IMX9_ENET_USE_OTP_MAC=y
+CONFIG_IMX9_FLEXIO1_PWM=y
+CONFIG_IMX9_GPIO_IRQ=y
+CONFIG_IMX9_LPI2C1=y
+CONFIG_IMX9_LPI2C1_DMA=y
+CONFIG_IMX9_LPI2C_DMA=y
+CONFIG_IMX9_LPI2C_DYNTIMEO=y
+CONFIG_IMX9_LPI2C_DYNTIMEO_STARTSTOP=10
+CONFIG_IMX9_LPSPI6=y
+CONFIG_IMX9_LPSPI6_DMA=y
+CONFIG_IMX9_LPSPI_DMA=y
+CONFIG_IMX9_LPUART1=y
+CONFIG_IMX9_TPM3_PWM=y
+CONFIG_IMX9_TPM3_PWM_CHMUX=0x00000003
+CONFIG_IMX9_USBDEV_USBC1=y
+CONFIG_IMX9_USDHC2=y
+CONFIG_IMX9_USDHC2_INVERT_CD=y
+CONFIG_INIT_MOUNT=y
+CONFIG_INTELHEX_BINARY=y
+CONFIG_LIBC_ENVPATH=y
+CONFIG_LIBC_EXECFUNCS=y
+CONFIG_LIBC_MAX_EXITFUNS=16
+CONFIG_LIBC_STRERROR=y
+CONFIG_LIBC_USRWORK=y
+CONFIG_LIBC_USRWORKSTACKSIZE=4096
+CONFIG_LPUART1_SERIAL_CONSOLE=y
+CONFIG_MMCSD=y
+CONFIG_MMCSD_SDIO=y
+CONFIG_MM_KMAP=y
+CONFIG_MM_PGALLOC=y
+CONFIG_NAME_MAX=64
+CONFIG_NDEBUG=y
+CONFIG_NET=y
+CONFIG_NETDB_DNSCLIENT=y
+CONFIG_NETDEV_IFINDEX=y
+CONFIG_NETDEV_PHY_IOCTL=y
+CONFIG_NETDEV_WORK_THREAD=y
+CONFIG_NETDEV_WORK_THREAD_PRIORITY=180
+CONFIG_NET_ARP_IPIN=y
+CONFIG_NET_BROADCAST=y
+CONFIG_NET_ETH_PKTSIZE=1478
+CONFIG_NET_ICMP_SOCKET=y
+CONFIG_NET_LOCAL=y
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_DELAYED_ACK=y
+CONFIG_NET_TCP_NOTIFIER=y
+CONFIG_NET_TIMESTAMP=y
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+CONFIG_NET_UDP_NOTIFIER=y
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_DISABLE_DMESG=y
+CONFIG_NSH_DISABLE_EXIT=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_FILE_APPS=y
+CONFIG_NSH_PROMPT_STRING="knsh> "
+CONFIG_NSH_READLINE=y
+CONFIG_NSH_STRERROR=y
+CONFIG_NSH_VARS=y
+CONFIG_PATH_INITIAL="/bin"
+CONFIG_PRIORITY_INHERITANCE=y
+CONFIG_PSEUDOFS_SOFTLINKS=y
+CONFIG_PTHREAD_STACK_MIN=1024
+CONFIG_PWM=y
+CONFIG_PWM_NCHANNELS=4
+CONFIG_RAMLOG=y
+CONFIG_RAM_SIZE=31457280
+CONFIG_RAM_START=0x80200000
+CONFIG_RAM_VSTART=0x80200000
+CONFIG_RAW_BINARY=y
+CONFIG_READLINE_CMD_HISTORY=y
+CONFIG_READLINE_TABCOMPLETION=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_CHILD_STATUS=y
+CONFIG_SCHED_HAVE_PARENT=y
+CONFIG_SCHED_HPWORK=y
+CONFIG_SCHED_INSTRUMENTATION=y
+CONFIG_SCHED_INSTRUMENTATION_SWITCH=y
+CONFIG_SCHED_LPNTHREADS=2
+CONFIG_SCHED_LPWORK=y
+CONFIG_SCHED_LPWORKPRIORITY=50
+CONFIG_SCHED_LPWORKSTACKSIZE=4096
+CONFIG_SCHED_WAITPID=y
+CONFIG_SDIO_BLOCKSETUP=y
+CONFIG_SEM_PREALLOCHOLDERS=32
+CONFIG_SERIAL_NPOLLWAITERS=2
+CONFIG_SERIAL_TERMIOS=y
+CONFIG_SIG_DEFAULT=y
+CONFIG_SIG_SIGALRM_ACTION=y
+CONFIG_SIG_SIGUSR1_ACTION=y
+CONFIG_SIG_SIGUSR2_ACTION=y
+CONFIG_STACK_COLORATION=y
+CONFIG_START_MONTH=3
+CONFIG_START_YEAR=2022
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+CONFIG_SYSTEM_CDCACM=y
+CONFIG_SYSTEM_I2CTOOL=y
+CONFIG_SYSTEM_NSH=y
+CONFIG_SYSTEM_NSH_PROGNAME="init"
+CONFIG_SYSTEM_PING=y
+CONFIG_SYSTEM_TIME64=y
+CONFIG_TASK_NAME_SIZE=24
+CONFIG_TLS_LOG2_MAXSTACK=15
diff --git a/boards/arm64/imx9/imx93-evk/include/.gitignore
b/boards/arm64/imx9/imx93-evk/include/.gitignore
new file mode 100644
index 0000000000..c99e91378d
--- /dev/null
+++ b/boards/arm64/imx9/imx93-evk/include/.gitignore
@@ -0,0 +1 @@
+/*_romfsimg.h
diff --git a/boards/arm64/imx9/imx93-evk/include/bin_romfsimg.h
b/boards/arm64/imx9/imx93-evk/include/bin_romfsimg.h
new file mode 100644
index 0000000000..2f2ef9319d
--- /dev/null
+++ b/boards/arm64/imx9/imx93-evk/include/bin_romfsimg.h
@@ -0,0 +1,42 @@
+/****************************************************************************
+ * boards/arm64/imx9/imx93-evk/include/bin_romfsimg.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __BOARDS_ARM64_IMX9_IMX93_EVK_INCLUDE_BIN_ROMFSIMG_H
+#define __BOARDS_ARM64_IMX9_IMX93_EVK_INCLUDE_BIN_ROMFSIMG_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/compiler.h>
+
+/****************************************************************************
+ * Public data
+ ****************************************************************************/
+
+const unsigned char aligned_data(4) romfs_img[] =
+{
+ 0x00
+};
+unsigned int romfs_img_len = 1;
+
+#endif /* __BOARDS_ARM64_IMX9_IMX93_EVK_INCLUDE_BIN_ROMFSIMG_H */
diff --git a/boards/arm64/imx9/imx93-evk/scripts/Make.defs
b/boards/arm64/imx9/imx93-evk/scripts/Make.defs
index 880435baa6..1c41bb7f66 100644
--- a/boards/arm64/imx9/imx93-evk/scripts/Make.defs
+++ b/boards/arm64/imx9/imx93-evk/scripts/Make.defs
@@ -27,6 +27,8 @@ include $(TOPDIR)/arch/arm64/src/Toolchain.defs
ifeq ($(CONFIG_IMX9_BOOTLOADER),y)
LDSCRIPT = ocramboot.ld
+else ifeq ($(CONFIG_BUILD_KERNEL),y)
+ LDSCRIPT = kernel.ld
else
LDSCRIPT = dramboot.ld
endif
diff --git a/boards/arm64/imx9/imx93-evk/scripts/gnu-elf.ld
b/boards/arm64/imx9/imx93-evk/scripts/gnu-elf.ld
new file mode 100644
index 0000000000..eddc246cfb
--- /dev/null
+++ b/boards/arm64/imx9/imx93-evk/scripts/gnu-elf.ld
@@ -0,0 +1,131 @@
+/****************************************************************************
+ * boards/arm64/imx9/imx93-evk/scripts/gnu-elf.ld
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+SECTIONS
+{
+ .text :
+ {
+ _stext = . ;
+ *(.text)
+ *(.text.*)
+ *(.gnu.warning)
+ *(.stub)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.jcr)
+
+ /* C++ support: The .init and .fini sections contain specific logic
+ * to manage static constructors and destructors.
+ */
+
+ *(.gnu.linkonce.t.*)
+ *(.init) /* Old ABI */
+ *(.fini) /* Old ABI */
+ _etext = . ;
+ }
+
+ .rodata :
+ {
+ _srodata = . ;
+ *(.rodata)
+ *(.rodata1)
+ *(.rodata.*)
+ *(.gnu.linkonce.r*)
+ _erodata = . ;
+ }
+
+ .data :
+ {
+ _sdata = . ;
+ *(.data)
+ *(.data1)
+ *(.data.*)
+ *(.gnu.linkonce.d*)
+ . = ALIGN(4);
+ _edata = . ;
+ }
+
+ /* C++ support. For each global and static local C++ object,
+ * GCC creates a small subroutine to construct the object. Pointers
+ * to these routines (not the routines themselves) are stored as
+ * simple, linear arrays in the .ctors section of the object file.
+ * Similarly, pointers to global/static destructor routines are
+ * stored in .dtors.
+ */
+
+ .ctors :
+ {
+ _sctors = . ;
+ KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*)
SORT_BY_INIT_PRIORITY(.ctors.*)))
+ KEEP(*(.init_array .ctors))
+ _ectors = . ;
+ }
+
+ .dtors :
+ {
+ _sdtors = . ;
+ KEEP (*(.dtors)) /* Old ABI: Unallocated */
+ KEEP (*(.fini_array)) /* New ABI: Allocated */
+ KEEP (*(SORT(.fini_array.*)))
+ _edtors = . ;
+ }
+
+ .bss :
+ {
+ _sbss = . ;
+ *(.bss)
+ *(.bss.*)
+ *(.sbss)
+ *(.sbss.*)
+ *(.gnu.linkonce.b*)
+ *(COMMON)
+ _ebss = . ;
+ }
+
+ /* Thread local storage support */
+ .tdata :
+ {
+ _stdata = ABSOLUTE(.);
+ KEEP (*(.tdata .tdata.* .gnu.linkonce.td.*));
+ _etdata = ABSOLUTE(.);
+ }
+
+ .tbss :
+ {
+ _stbss = ABSOLUTE(.);
+ KEEP (*(.tbss .tbss.* .gnu.linkonce.tb.* .tcommon));
+ _etbss = ABSOLUTE(.);
+ }
+
+ /* Stabs debugging sections. */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/boards/arm64/imx9/imx93-evk/scripts/kernel.ld
b/boards/arm64/imx9/imx93-evk/scripts/kernel.ld
new file mode 100644
index 0000000000..0905ba5086
--- /dev/null
+++ b/boards/arm64/imx9/imx93-evk/scripts/kernel.ld
@@ -0,0 +1,163 @@
+/****************************************************************************
+ * boards/arm64/imx9/imx93-evk/scripts/kernel.ld
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+OUTPUT_ARCH(aarch64)
+
+ENTRY(__start)
+EXTERN(__start)
+
+/* Memory is organized as follows:
+ * - Uboot reserved area is 0x00000000 - 0x00a00000
+ * - NuttX is loaded to 0x80200000, u-boot expects us here, see:
+ - https://github.com/nxp-imx/uboot-imx
+ /configs/imx93_11x11_evk_defconfig#CONFIG_TEXT_BASE
+ - https://www.nxp.com/docs/en/user-guide/IMX_LINUX_USERS_GUIDE.pdf
+ * - NuttX ROM and RAM are one continuous region, starting from 0x80000000
+ with a size of 128MB
+ * - Heap memory is allocated from dram end to idlestack top
+ */
+
+MEMORY
+{
+ dram (rwx) : ORIGIN = 0x80200000, LENGTH = 30720K
+ pgram (rwx) : ORIGIN = 0x82000000, LENGTH = 96M
+}
+
+PHDRS
+{
+ /* R = 100, W = 010, X = 001 */
+
+ text PT_LOAD FLAGS(5); /* RX */
+ rodata PT_LOAD FLAGS(4); /* R */
+ data PT_LOAD FLAGS(6); /* RW */
+}
+
+SECTIONS
+{
+ .text :
+ {
+ _stext = ABSOLUTE(.); /* Text section */
+ *(.start .start.*) /* Place __start here */
+ *(.text .text.*)
+ *(.text.cold)
+ *(.text.unlikely)
+ *(.fixup)
+ *(.gnu.warning)
+ } > dram :text
+
+ .init_section :
+ {
+ _sinit = ABSOLUTE(.);
+ KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*)
SORT_BY_INIT_PRIORITY(.ctors.*)))
+ KEEP(*(.init_array .ctors))
+ _einit = ABSOLUTE(.);
+ } > dram :text
+
+ /* Vector table must be page aligned */
+
+ .vector : ALIGN(4096)
+ {
+ _vector_start = ABSOLUTE(.);
+ KEEP(*(.exc_vector_table))
+ KEEP(*(".exc_vector_table.*"))
+ KEEP(*(.vectors))
+ _vector_end = ABSOLUTE(.);
+ } > dram :text
+
+ /* End of text data must be aligned to page boundary */
+
+ . = ALIGN(4096);
+ _etext = .;
+ _sztext = _etext - _stext;
+
+ /* Start of RO data must be page aligned (mapped as read only) */
+
+ .rodata : ALIGN(4096)
+ {
+ _srodata = ABSOLUTE(.); /* Read-only data */
+ *(.rodata .rodata.*)
+ *(.data.rel.ro)
+ *(.data.rel.ro.*)
+ } > dram :rodata
+
+ /* End of RO data must be page aligned */
+
+ . = ALIGN(4096);
+
+ _erodata = .; /* End of read-only data */
+ _szrodata = _erodata - _srodata;
+ _eronly = .; /* End of read-only data */
+
+ .data : ALIGN(4096)
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data.page_aligned)
+ *(.data .data.*)
+ . = ALIGN(8);
+ *(.data.rel)
+ *(.data.rel.*)
+ CONSTRUCTORS
+ . = ALIGN(8);
+ _edata = ABSOLUTE(.);
+ } > dram :data
+
+ .bss :
+ {
+ . = ALIGN(8);
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ . = ALIGN(8);
+ _ebss = ABSOLUTE(.);
+ } > dram :data
+
+ _szbss = _ebss - _sbss;
+
+ .initstack :
+ {
+ _s_initstack = ABSOLUTE(.);
+ *(.initstack)
+ } > dram :data
+
+ /* End of data must be page aligned */
+ . = ALIGN(4096);
+
+ g_idle_topstack = .;
+ _e_initstack = .;
+ _szdata = _e_initstack - _sdata;
+
+ /* Sections to be discarded */
+ /DISCARD/ : {
+ *(.exit.text)
+ *(.exit.data)
+ *(.exitcall.exit)
+ *(.eh_frame)
+ }
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+}
diff --git a/boards/arm64/imx9/imx93-evk/src/imx9_bringup.c
b/boards/arm64/imx9/imx93-evk/src/imx9_bringup.c
index a4c28c5bc8..8a4e69b0dd 100644
--- a/boards/arm64/imx9/imx93-evk/src/imx9_bringup.c
+++ b/boards/arm64/imx9/imx93-evk/src/imx9_bringup.c
@@ -35,6 +35,18 @@
#include "imx93-evk.h"
+#ifdef CONFIG_IMX9_BIN_ROMFS
+#include <nuttx/drivers/ramdisk.h>
+#include <arch/board/bin_romfsimg.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define SECTORSIZE 512
+#define NSECTORS(b) (((b) + SECTORSIZE - 1) / SECTORSIZE)
+#endif /* CONFIG_IMX9_BIN_ROMFS */
+
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -61,6 +73,17 @@ int imx9_bringup(void)
}
#endif
+#ifdef CONFIG_IMX9_BIN_ROMFS
+ /* Create a ROM disk for the /bin filesystem */
+
+ ret = romdisk_register(0, romfs_img, NSECTORS(romfs_img_len), SECTORSIZE);
+
+ if (ret < 0)
+ {
+ syslog(LOG_ERR, "Failed to register ROMFS at /dev/ram0: %d\n", ret);
+ }
+#endif
+
#ifdef CONFIG_IMX9_DMA_ALLOC
/* Initialize the DMA memory allocator */