xiaoxiang781216 commented on code in PR #3762:
URL: https://github.com/apache/nuttx-apps/pull/3762#discussion_r4141840653


##########
examples/fdpicxip/modules/Makefile:
##########
@@ -44,19 +45,68 @@
 
 CPU ?= cortex-m3
 
-FDPICDIR  = $(NUTTX_DIR)/tools/fdpic
-MODULE_MK = $(FDPICDIR)/nuttx-fdpic.mk
-EMBED     = $(FDPICDIR)/fdpic-embed.py
+# The tools and the flags are the configured tree's own, so a fixture is
+# built the way CONFIG_FDPIC builds any module or library: same compiler,
+# same arm-uclinuxfdpiceabi linker, same linker script, same crt0 source.
+# CMODULEFLAGS, CXXMODULEFLAGS and LDMODULEFLAGS are the module and library
+# variables, which carry neither an entry point nor a crt0, so a fixture
+# adds what it needs and nothing has to be filtered back out.
+
+TOPDIR := $(NUTTX_DIR)
+include $(NUTTX_DIR)/Make.defs
+
+# Except for three things.  The CPU, and thus the architecture flags the tree
+# chose for its own target, because a v7-M module runs on both the v7-M and
+# the v8-M targets and one built for the configured target would not.  The
+# debug information and the optimization, because these artifacts are
+# committed as headers and must not depend on how the tree is configured.
+#
+# crt0 is compiled here rather than taken built, for the CPU reason.
 
-# Where each generated header goes, and its path from the repository root --
-# fdpic-embed.py puts that on line 2, which is what nxstyle wants.
+DROPFLAGS   = -march=% -mtune=% -mcpu=% -mfpu=% -mfloat-abi=% \
+              -O% -fno-strict-aliasing
+PINFLAGS    = -mcpu=$(CPU) -g0 -Os -fno-strict-aliasing
+MODCFLAGS   = $(filter-out $(DROPFLAGS),$(CMODULEFLAGS)) $(PINFLAGS)
+MODCXXFLAGS = $(filter-out $(DROPFLAGS),$(CXXMODULEFLAGS)) $(PINFLAGS)
 
 DEMODIR = ..

Review Comment:
   can we build fdpic so like the normal so by `DYNLIB = y` like 
examples/sotest, examples/module? Actually, it's better to convert all current 
example to fdpic automatically once user enable CONFIG_FDPIC.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to