You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "yf13 (via GitHub)" <gi...@apache.org> on 2024/04/22 04:58:58 UTC

[PR] tools/export: fix names for app linker script and program entry. [nuttx]

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

   ## Summary
   This fixes names of program entry and linker script files so that to support building kernel mode apps using CMake and exported package.
   
   ## Impact
   CMake use cases
   
   ## Testing
   CI checks
   


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] tools/export: fix app entry and linker script names [nuttx]

Posted by "yf13 (via GitHub)" <gi...@apache.org>.
yf13 commented on code in PR #12201:
URL: https://github.com/apache/nuttx/pull/12201#discussion_r1574535035


##########
tools/toolchain.cmake.export:
##########
@@ -23,11 +23,16 @@ file(GLOB STARTUP_OBJS ${NUTTX_PATH}/startup/*)
 add_compile_options(-nostdlib)
 add_compile_options(-ffunction-sections -fdata-sections)
 
+set(ENTRY_NAME "__start")
+if("${NUTTX_MODE}" STREQUAL "k")
+  set(ENTRY_NAME "_start")

Review Comment:
   That will propogate to multiple startup and linker sript files, which is more changes than this patch.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] cmake/export: fix kernel mode app building [nuttx]

Posted by "masayuki2009 (via GitHub)" <gi...@apache.org>.
masayuki2009 commented on PR #12201:
URL: https://github.com/apache/nuttx/pull/12201#issuecomment-2074091770

   @yf13 
   I noticed that rv-virt:knsh32 crashes with this PR.
   
   ```
   /home/ishikawa/opensource/QEMU/qemu-8.2.0/build/qemu-system-riscv32 -semihosting -nographic -cpu rv32 -M virt,aclint=on -bios none -kernel nuttx
   ABC[    0.032000] riscv_exception: EXCEPTION: Instruction page fault. MCAUSE: 0000000c, EPC: 00000000, MTVAL: 00000000
   ```


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] tools/export: fix app entry and linker script names [nuttx]

Posted by "yf13 (via GitHub)" <gi...@apache.org>.
yf13 commented on code in PR #12201:
URL: https://github.com/apache/nuttx/pull/12201#discussion_r1574528785


##########
tools/mkexport.sh:
##########
@@ -255,11 +262,12 @@ echo "HOSTINCLUDES     = ${HOSTINCLUDES}" >>"${EXPORTDIR}/scripts/Make.defs"
 echo "HOSTCFLAGS       = ${HOSTCFLAGS}" >>"${EXPORTDIR}/scripts/Make.defs"
 echo "HOSTLDFLAGS      = ${HOSTLDFLAGS}" >>"${EXPORTDIR}/scripts/Make.defs"
 echo "HOSTEXEEXT       = ${HOSTEXEEXT}" >>"${EXPORTDIR}/scripts/Make.defs"
-echo "LDNAME           = ${LDNAME}" >>"${EXPORTDIR}/scripts/Make.defs"
+echo "LDNAME           = ${APPLD}"      >>"${EXPORTDIR}/scripts/Make.defs"

Review Comment:
   Setting LDNAME in `Make.defs` is unnecessary now as makefile system seems working well. However, it doesn't hurt to keep LDNAME in sync with the definitions in `target.cmake`, this maybe good for some out-of-tree apps builders.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] tools/export: fix app entry and linker script names [nuttx]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #12201:
URL: https://github.com/apache/nuttx/pull/12201#discussion_r1574999860


##########
tools/toolchain.cmake.export:
##########
@@ -23,11 +23,16 @@ file(GLOB STARTUP_OBJS ${NUTTX_PATH}/startup/*)
 add_compile_options(-nostdlib)
 add_compile_options(-ffunction-sections -fdata-sections)
 
+set(ENTRY_NAME "__start")
+if("${NUTTX_MODE}" STREQUAL "k")
+  set(ENTRY_NAME "_start")

Review Comment:
   but the unification is important.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] cmake/export: fix kernel mode app building [nuttx]

Posted by "yf13 (via GitHub)" <gi...@apache.org>.
yf13 commented on PR #12201:
URL: https://github.com/apache/nuttx/pull/12201#issuecomment-2074754501

   @masayuki2009 I was using `rv-virt/knsh64`. let me check again here.


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] tools/export: fix app entry and linker script names [nuttx]

Posted by "yf13 (via GitHub)" <gi...@apache.org>.
yf13 commented on code in PR #12201:
URL: https://github.com/apache/nuttx/pull/12201#discussion_r1574535035


##########
tools/toolchain.cmake.export:
##########
@@ -23,11 +23,16 @@ file(GLOB STARTUP_OBJS ${NUTTX_PATH}/startup/*)
 add_compile_options(-nostdlib)
 add_compile_options(-ffunction-sections -fdata-sections)
 
+set(ENTRY_NAME "__start")
+if("${NUTTX_MODE}" STREQUAL "k")
+  set(ENTRY_NAME "_start")

Review Comment:
   That will propogate to multiple startup and linker sript files, it may also impact the working app makefiles, which implies more changes than this patch.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] tools/export: fix app entry and linker script names [nuttx]

Posted by "yf13 (via GitHub)" <gi...@apache.org>.
yf13 commented on code in PR #12201:
URL: https://github.com/apache/nuttx/pull/12201#discussion_r1574528785


##########
tools/mkexport.sh:
##########
@@ -255,11 +262,12 @@ echo "HOSTINCLUDES     = ${HOSTINCLUDES}" >>"${EXPORTDIR}/scripts/Make.defs"
 echo "HOSTCFLAGS       = ${HOSTCFLAGS}" >>"${EXPORTDIR}/scripts/Make.defs"
 echo "HOSTLDFLAGS      = ${HOSTLDFLAGS}" >>"${EXPORTDIR}/scripts/Make.defs"
 echo "HOSTEXEEXT       = ${HOSTEXEEXT}" >>"${EXPORTDIR}/scripts/Make.defs"
-echo "LDNAME           = ${LDNAME}" >>"${EXPORTDIR}/scripts/Make.defs"
+echo "LDNAME           = ${APPLD}"      >>"${EXPORTDIR}/scripts/Make.defs"

Review Comment:
   Setting LDNAME in `Make.defs` is unnecessary now as makefile system seems working well. However, it doesn't hurt to keep LDNAME in sync with the definitions in `target.cmake`, just in case that some non-default apps folder can build smoothly with the export package.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] tools/export: fix app entry and linker script names [nuttx]

Posted by "yf13 (via GitHub)" <gi...@apache.org>.
yf13 commented on code in PR #12201:
URL: https://github.com/apache/nuttx/pull/12201#discussion_r1574535035


##########
tools/toolchain.cmake.export:
##########
@@ -23,11 +23,16 @@ file(GLOB STARTUP_OBJS ${NUTTX_PATH}/startup/*)
 add_compile_options(-nostdlib)
 add_compile_options(-ffunction-sections -fdata-sections)
 
+set(ENTRY_NAME "__start")
+if("${NUTTX_MODE}" STREQUAL "k")
+  set(ENTRY_NAME "_start")

Review Comment:
   That will propogate to multiple startup and linker sript files, I am unsure how it impact the working app makefile system. So looks like more complex than current changes. 



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] cmake/export: fix kernel mode app building [nuttx]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #12201:
URL: https://github.com/apache/nuttx/pull/12201


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] tools/export: fix app entry and linker script names [nuttx]

Posted by "yf13 (via GitHub)" <gi...@apache.org>.
yf13 commented on code in PR #12201:
URL: https://github.com/apache/nuttx/pull/12201#discussion_r1574535035


##########
tools/toolchain.cmake.export:
##########
@@ -23,11 +23,16 @@ file(GLOB STARTUP_OBJS ${NUTTX_PATH}/startup/*)
 add_compile_options(-nostdlib)
 add_compile_options(-ffunction-sections -fdata-sections)
 
+set(ENTRY_NAME "__start")
+if("${NUTTX_MODE}" STREQUAL "k")
+  set(ENTRY_NAME "_start")

Review Comment:
   That will propogate to multiple startup and linker sript files, it may also impact the working app makefiles, which looks like more changes.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] tools/export: fix app entry and linker script names [nuttx]

Posted by "yf13 (via GitHub)" <gi...@apache.org>.
yf13 commented on code in PR #12201:
URL: https://github.com/apache/nuttx/pull/12201#discussion_r1574528785


##########
tools/mkexport.sh:
##########
@@ -255,11 +262,12 @@ echo "HOSTINCLUDES     = ${HOSTINCLUDES}" >>"${EXPORTDIR}/scripts/Make.defs"
 echo "HOSTCFLAGS       = ${HOSTCFLAGS}" >>"${EXPORTDIR}/scripts/Make.defs"
 echo "HOSTLDFLAGS      = ${HOSTLDFLAGS}" >>"${EXPORTDIR}/scripts/Make.defs"
 echo "HOSTEXEEXT       = ${HOSTEXEEXT}" >>"${EXPORTDIR}/scripts/Make.defs"
-echo "LDNAME           = ${LDNAME}" >>"${EXPORTDIR}/scripts/Make.defs"
+echo "LDNAME           = ${APPLD}"      >>"${EXPORTDIR}/scripts/Make.defs"

Review Comment:
   Setting LDNAME in `Make.defs` is unnecessary now as makefile system seems working well. However, it doesn't hurt to keep LDNAME in sync with the definitions in `target.cmake`, which may help some non-default apps build system.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] tools/export: fix app entry and linker script names [nuttx]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #12201:
URL: https://github.com/apache/nuttx/pull/12201#discussion_r1574316505


##########
tools/toolchain.cmake.export:
##########
@@ -23,11 +23,16 @@ file(GLOB STARTUP_OBJS ${NUTTX_PATH}/startup/*)
 add_compile_options(-nostdlib)
 add_compile_options(-ffunction-sections -fdata-sections)
 
+set(ENTRY_NAME "__start")
+if("${NUTTX_MODE}" STREQUAL "k")
+  set(ENTRY_NAME "_start")

Review Comment:
   could we modify the code  to make the entry point consistent?



##########
tools/Export.mk:
##########
@@ -90,6 +90,15 @@ ifdef CONFIG_ARCH_BOARD
 	@echo "NUTTX_BOARD=\"$(CONFIG_ARCH_BOARD)\"" >> $(EXPORTDIR)/makeinfo.sh
 else
 	@echo "NUTTX_BOARD=\"$(CONFIG_ARCH_BOARD_CUSTOM_NAME)\"" >> $(EXPORTDIR)/makeinfo.sh
+endif
+ifdef CONFIG_BUILD_FLAT
+	@echo "NUTTX_MODE=\"f\"" >> $(EXPORTDIR)/makeinfo.sh

Review Comment:
   can we use the full name instead f/p/k?



##########
tools/mkexport.sh:
##########
@@ -255,11 +262,12 @@ echo "HOSTINCLUDES     = ${HOSTINCLUDES}" >>"${EXPORTDIR}/scripts/Make.defs"
 echo "HOSTCFLAGS       = ${HOSTCFLAGS}" >>"${EXPORTDIR}/scripts/Make.defs"
 echo "HOSTLDFLAGS      = ${HOSTLDFLAGS}" >>"${EXPORTDIR}/scripts/Make.defs"
 echo "HOSTEXEEXT       = ${HOSTEXEEXT}" >>"${EXPORTDIR}/scripts/Make.defs"
-echo "LDNAME           = ${LDNAME}" >>"${EXPORTDIR}/scripts/Make.defs"
+echo "LDNAME           = ${APPLD}"      >>"${EXPORTDIR}/scripts/Make.defs"

Review Comment:
   should we expose both script?



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] tools/export: fix app entry and linker script names [nuttx]

Posted by "yf13 (via GitHub)" <gi...@apache.org>.
yf13 commented on code in PR #12201:
URL: https://github.com/apache/nuttx/pull/12201#discussion_r1574528785


##########
tools/mkexport.sh:
##########
@@ -255,11 +262,12 @@ echo "HOSTINCLUDES     = ${HOSTINCLUDES}" >>"${EXPORTDIR}/scripts/Make.defs"
 echo "HOSTCFLAGS       = ${HOSTCFLAGS}" >>"${EXPORTDIR}/scripts/Make.defs"
 echo "HOSTLDFLAGS      = ${HOSTLDFLAGS}" >>"${EXPORTDIR}/scripts/Make.defs"
 echo "HOSTEXEEXT       = ${HOSTEXEEXT}" >>"${EXPORTDIR}/scripts/Make.defs"
-echo "LDNAME           = ${LDNAME}" >>"${EXPORTDIR}/scripts/Make.defs"
+echo "LDNAME           = ${APPLD}"      >>"${EXPORTDIR}/scripts/Make.defs"

Review Comment:
   Setting LDNAME in `Make.defs` is unnecessary now as makefile system seems working well. However, it doesn't hurt to keep LDNAME in sync with the definitions in `target.cmake`.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] cmake/export: fix kernel mode app building [nuttx]

Posted by "masayuki2009 (via GitHub)" <gi...@apache.org>.
masayuki2009 commented on PR #12201:
URL: https://github.com/apache/nuttx/pull/12201#issuecomment-2074098683

   @yf13 
   Which configurations did you test?
   


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] tools/export: fix app entry and linker script names [nuttx]

Posted by "yf13 (via GitHub)" <gi...@apache.org>.
yf13 commented on PR #12201:
URL: https://github.com/apache/nuttx/pull/12201#issuecomment-2071611402

   @xiaoxiang781216 please check latest updates, it changes `crt0.c` to use unified entrace `__start`.


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] tools/export: fix cmake issues for building kernel mode apps [nuttx]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #12201:
URL: https://github.com/apache/nuttx/pull/12201#discussion_r1576089039


##########
tools/mkexport.sh:
##########
@@ -182,10 +182,17 @@ cp "${TOPDIR}/tools/incdir.c" "${EXPORTDIR}/tools/."
 
 # Copy the board specific linker if found, or use the default when not.
 
-if [ -f "${BOARDDIR}/scripts/gnu-elf.ld" ]; then
-  cp -f "${BOARDDIR}/scripts/gnu-elf.ld" "${EXPORTDIR}/scripts/."
+APPLD=gnu-elf.ld
+if [ -f "${BOARDDIR}/scripts/${APPLD}" ]; then
+  cp -f "${BOARDDIR}/scripts/${APPLD}" "${EXPORTDIR}/scripts/."
 else
-  cp -f "${TOPDIR}/binfmt/libelf/gnu-elf.ld" "${EXPORTDIR}/scripts/."
+  cp -f "${TOPDIR}/binfmt/libelf/${APPLD}" "${EXPORTDIR}/scripts/."
+fi
+
+# non-kernel mode uses ${LDNAME} instead.
+
+if [ "${NUTTX_BUILD}" != "kernel" ]; then
+  APPLD=${LDNAME}

Review Comment:
   ```suggestion
     LDNAME=${APPLD}
   ```



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org