Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move debug_info target implementation to apps #2924

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ all: $(BIN)

.PHONY: import install dirlinks export .depdirs preconfig depend clean distclean
.PHONY: context postinstall clean_context context_all postinstall_all register register_all
.PHONY: debug_info
.PRECIOUS: $(BIN)

$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),all)))
Expand Down Expand Up @@ -206,6 +207,11 @@ endif
endif
endif

# debug_info: Parse nxdiag example output file (sysinfo.h) and print

debug_info:
$(Q) $(MAKE) -C $(CONFIG_APPS_DIR)/system/nxdiag debug_info

.depdirs: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_depend)

.depend: Makefile .depdirs
Expand Down
29 changes: 28 additions & 1 deletion system/nxdiag/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,26 @@ endif

endif

# debug_info target flags to get diagnostic info without building nxdiag application

SYSINFO_PARSE_FLAGS = "$(realpath $(TOPDIR))"
SYSINFO_PARSE_FLAGS += "-f$(CONFIG_APPS_DIR)/system/nxdiag/sysinfo.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
SYSINFO_FLAGS += --espressif "$(TOPDIR)" "$(ARCH_ESP_HALDIR)"
SYSINFO_FLAGS += "--espressif_chip"
endif

# Common build

.PHONY: sysinfo.h
.PHONY: sysinfo.h debug_info

checkpython3:
@if [ -z "$$(which python3)" ]; then \
Expand All @@ -121,6 +138,16 @@ sysinfo.h : checkpython3 $(INFO_DEPS)
exit 1; \
fi

# debug_info: Parse nxdiag example output file (sysinfo.h) and print

debug_info: checkpython3
@if [[ ! -f "sysinfo.h" ]]; then \
echo "file $(CONFIG_APPS_DIR)/system/nxdiag/sysinfo.h not exists"; \
python3 $(NXTOOLSDIR)$(DELIM)host_sysinfo.py $(SYSINFO_FLAGS) \
$(realpath $(TOPDIR)) > sysinfo.h; \
fi
@python3 $(NXTOOLSDIR)$(DELIM)parse_sysinfo.py $(SYSINFO_PARSE_FLAGS)

depend:: sysinfo.h

distclean::
Expand Down
Loading