ppisa commented on issue #6082:
URL: 
https://github.com/apache/incubator-nuttx/issues/6082#issuecomment-1166347130

   Hello, I have found time only now and test state with actual NuttX sources.
   
   I test with `tools/configure.sh esp32c3-devkit:twai` but it seems to be 
problem with most other architectures.
   
   When I run `make export` then at least `HEAD_OBJ` is not exported.
   
   it is initially defined in `nuttx/arch/risc-v/src/esp32c3/Make.defs`:
   ```
   HEAD_ASRC = esp32c3_head.S
   ```
   It then used in `nuttx/arch/risc-v/src/Makefile`:
   ```
   HEAD_OBJ = $(HEAD_ASRC:.S=$(OBJEXT))
   STARTUP_OBJS ?= $(HEAD_OBJ)
   ```
   
   `nuttx/tools/mkexport.sh`:
   ```
     echo "HEAD_OBJ         = ${HEAD_OBJ}" >>"${EXPORTDIR}/scripts/Make.defs"
   ```
   
   then `nuttx-export-10.3.0/scripts/Make.defs`:
   ```
   HEAD_OBJ         =
   ```
   
   Same problem with `LDENDGROUP` and `LDSTARTGROUP`
   
   `nuttx/tools/Export.mk` does not include `HEAD_OBJ` but it includes 
`LDENDGROUP` and `LDSTARTGROUP` which are not exported as well. Even when I add 
line for `HEAD_OBJ` it does not help.
   
   `nuttx/tools/Export.mk` includes only.
   ```
   include $(TOPDIR)/.config
   include $(EXPORTDIR)/Make.defs
   ```
   The second one is copy of `${TOPDIR}/Make.defs` which is link to 
`risc-v/esp32c3/esp32c3-devkit/scripts/Make.defs`.
   
   It includes
   ```
   include $(TOPDIR)/.config
   include $(TOPDIR)/tools/Config.mk
   include $(TOPDIR)/tools/esp32c3/Config.mk
   include $(TOPDIR)/arch/risc-v/src/common/Toolchain.defs
   ```
   But none of these includes group and or head information.
   
   This is only included in `nuttx/arch/risc-v/src/Makefile` but that cannot be 
sourced, because it defines too many rules and is not probably prepared for to 
be used as source of defines for other Makefiles.
   
   So I think that `LDSTARTGROUP` and  `LDENDGROUP` should be defined in  
`nuttx/arch/risc-v/src/common/Toolchain.defs`. There should be even explicit 
define `LINK_BY_CC` or `LINK_BY_LD` to select if link is done by CC or LD.  
Where should be moved define `HEAD_ASRC` and preparation of `HEAD_OBJ` is even 
more questionable. It wold be ideal to do the change for all architectures and 
boards...


-- 
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-unsubscr...@nuttx.apache.org

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

Reply via email to