eren-terzioglu commented on code in PR #15304:
URL: https://github.com/apache/nuttx/pull/15304#discussion_r1900089093


##########
tools/Unix.mk:
##########
@@ -618,6 +619,40 @@ bootloader:
 clean_bootloader:
        $(Q) $(MAKE) -C $(ARCH_SRC) clean_bootloader
 
+checkpython3:
+       @if [ -z "$$(which python3)" ]; then \
+               echo "ERROR: python3 not found in PATH"; \
+               echo "       Please install python3 or fix the PATH"; \
+               exit 1; \
+       fi
+
+# debug_info target flags to get diagnostic info without building nxdiag 
application
+
+SYSINFO_PARSE_FLAGS = "$(realpath $(TOPDIR))"
+SYSINFO_PARSE_FLAGS += "-fsysinfo.h"
+
+SYSINFO_FLAGS = "-c"
+SYSINFO_FLAGS += "-p"
+SYSINFO_FLAGS += -f \""$(shell echo '$(CFLAGS)' | sed 's/"/\\\\\\"/g')"\"
+SYSINFO_FLAGS += \""$(shell echo '$(CXXFLAGS)' | sed 's/"/\\\\\\"/g')"\"
+SYSINFO_FLAGS += \""$(shell echo '$(LDFLAGS)' | sed 's/"/\\\\\\"/g')"\"
+
+ifneq ($(findstring esp,$(CONFIG_ARCH_CHIP)),)
+ARCH_ESP_HALDIR = 
$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)chip$(DELIM)esp-hal-3rdparty

Review Comment:
   We can move `host_sysinfo.py` to its original place and then put related 
flags in `apps/system/nxdiag/makefile` but in the end, we will revert it into 
first version of this PR(mostly). Final decision is up to you. Important point 
is, if we move it we will call something in appsdir from nuttx (here/ 
tools/Unix.mk). Let me create an example to show it better:
   
   ```
   # tools/Unix.mk
   FLAGS = $(APPDIR)/system/nxdiag/sysinfo.h
   FLAGS += ...
   debug_info: checkpython3
   ifneq ($(APPDIR),)
        $(Q) $(MAKE) -C $(APPDIR) debug_info
   endif
   python3 tools/parse_sysinfo.py FLAGS
   
   # apps/Makefile:
   debug_info:
   $(Q) $(MAKE) -C $(APPDIR)/system/nxdiag debug_info
   
   # apps/system/nxdiag/Makefile:
   FLAGS = ...
   debug_info: checkpython3
   python3 $(APPDIR)/tools/host_sysinfo.py FLAGS> sysinfo.h
   ```
   
   You might ask why we need to add a target on `apps/Makefile`. If we don't 
add it, `make debug_info` command gives some errors due to missing some 
configurations.



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