diff --git a/configure/RULES_BUILD b/configure/RULES_BUILD index bba3cdc73..c0e1ffbe7 100644 --- a/configure/RULES_BUILD +++ b/configure/RULES_BUILD @@ -331,6 +331,12 @@ $(OBJLIB_MUNCHNAME):%.munch : %_ctdt$(OBJ) %$(OBJ) @$(RM) $@ $(MUNCH_CMD) +# GeSys modules for RTEMS +$(MODNAME): %$(MODEXT): %$(EXE) + @echo "Building module $@" + @$(RM) $@ + $(LINK.mod) + runtests: $(TESTSCRIPTS) -$(PERL) -MTest::Harness -e 'runtests @ARGV if @ARGV;' $^ diff --git a/configure/os/CONFIG.Common.RTEMS b/configure/os/CONFIG.Common.RTEMS index 81132cdfd..2e3b73ac8 100644 --- a/configure/os/CONFIG.Common.RTEMS +++ b/configure/os/CONFIG.Common.RTEMS @@ -83,6 +83,8 @@ OPT_CXXFLAGS_YES = $(CFLAGS_OPTIMIZE_V) OPT_CFLAGS_NO = $(CFLAGS_DEBUG_V) OPT_CXXFLAGS_NO = $(CFLAGS_DEBUG_V) +MODEXT=.obj + #-------------------------------------------------- # operating system class (include/os/) OS_CLASS = RTEMS @@ -97,6 +99,42 @@ OP_SYS_LDFLAGS += $(CPU_CFLAGS) -u Init \ $(PROJECT_RELEASE)/lib/no-signal.rel \ $(PROJECT_RELEASE)/lib/no-rtmon.rel +MOD_SYS_LDFLAGS += $(CPU_CFLAGS) -Wl,-r -nostdlib + +# Do not link against libraries which are part of the Generic Image +GESYS_LIBS += -lgcc +GESYS_LIBS += -lc -lm -lrtemscpu -lrtemsbsp -lrtems++ -lbspExt +GESYS_LIBS += -lcexp -ltecla_r -lspencer_regexp -lpmelf -lpmbfd +GESYS_LIBS += -lnfs -ltelnetd -lrtems-gdb-stub + +# While not part of the Generic Image it provides symbols which +# would conflict. +GESYS_LIBS += -lrtemsCom + +#-------------------------------------------------- +# Options for building GeSys loadable objects + +MODNAME_YES = $(PRODNAME:%$(EXE)=%$(MODEXT)) +MODNAME += $(MODNAME_$(USE_GESYS)) +PRODTARGETS += $(MODNAME) +BIN_INSTALLS += $(MODNAME) + +# changes to LDFLAGS in CONFIG_COMMON and LINK.cpp in CONFIG.Common.UnixCommon +# should be reflected here with the following exceptions +# +# replace OP_SYS_LDFLAGS with MOD_SYS_LDFLAGS +# replace PROD_LDLIBS with MOD_LDLIBS +# remove STATIC_LDFLAGS + +MOD_LDLIBS = $(filter-out $(GESYS_LIBS),$(PROD_LDLIBS)) + +MOD_LDFLAGS = $(OPT_LDFLAGS) $(TARGET_LDFLAGS) $(USR_LDFLAGS) $(POSIX_LDFLAGS) \ + $(ARCH_DEP_LDFLAGS) $(DEBUG_LDFLAGS) $(MOD_SYS_LDFLAGS) $($(BUILD_CLASS)_LDFLAGS)\ + $(RUNTIME_LDFLAGS) $(CODE_LDFLAGS) + +LINK.mod = $(CCC) -o $@ $(PRODDIR_LDFLAGS) $(MOD_LDFLAGS) +LINK.mod += $(PROD_LDFLAGS) $(PROD_LD_OBJS) $(PROD_LD_RESS) $(MOD_LDLIBS) + #-------------------------------------------------- # RTEMS has neither shared libraries nor dynamic loading STATIC_BUILD=YES diff --git a/configure/os/CONFIG_SITE.Common.RTEMS b/configure/os/CONFIG_SITE.Common.RTEMS index d8b700b8c..a276bfa47 100644 --- a/configure/os/CONFIG_SITE.Common.RTEMS +++ b/configure/os/CONFIG_SITE.Common.RTEMS @@ -12,6 +12,12 @@ RTEMS_BASE = /usr/local/rtems/rtems-$(RTEMS_VERSION) # RTEMS_TOOLS = $(RTEMS_BASE) +# Link Generic System loadable objects instead of full executable. +# +# A GeSys object is similar to a shared library. It can be (un)loaded +# at runtime by the Generic System loader which is available as a +# patch against RTEMS. +USE_GESYS=NO # If you're using neither BOOTP/DHCP nor FLASH to pick up your IOC # network configuration you must uncomment and specify your Internet diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index ef8612194..c022df09f 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -13,6 +13,12 @@ +

Build rules for RTEMS GESYS modules

+ +

RTEMS target builds can now be configured to make GESYS modules by changing +the USE_GESYS=NO setting in the file +configure/os/CONFIG_SITE.Common.RTEMS to YES.

+

Added Make variables for command-line use

The following variables are now used during the build process, reserved for