# # Name: Makehead.rtems # # Purpose: This file is used to customize operating system and installation # dependent features of the MX makefiles. This version is customized # for RTEMS. # MX_RTEMS_DIR = /opt/rtems/4.11.3 MX_RTEMS_INSTALLED_DIR = $(MX_RTEMS_DIR)/kernel/installed/i386-rtems4.11 MX_RTEMS_BSP_DIR = $(MX_RTEMS_INSTALLED_DIR)/pc686 MX_RTEMS_LIBBSP_DIR = $(MX_RTEMS_DIR)/kernel/pc686/i386-rtems4.11/c/pc686/lib/libbsp/i386/pc386 MX_RTEMS_CPUKIT_DIR = $(MX_RTEMS_DIR)/kernel/pc686/i386-rtems4.11/c/pc686/cpukit MX_RTEMS_GCC_DIR = $(MX_RTEMS_DIR)/lib/gcc/i386-rtems4.11/4.9.3 MX_RTEMS_GCC = $(MX_RTEMS_DIR)/bin/i386-rtems4.11-gcc #--- INCLUDES = $(MX_INCLUDES) LIB_DIRS = -L$(MX_RTEMS_PATH)/lib \ -L$(MX_RTEMS_BSP_DIR)/lib \ -L$(MX_RTEMS_GCC_DIR) \ -L$(MX_RTEMS_CPUKIT_DIR)/posix \ -L$(MX_RTEMS_LIBBSP_DIR) \ -L$(MX_RTEMS_DIR)/i386-rtems4.11/lib/mpentiumpro \ -L../libMx # FIXME: The following definition is an atrocity. There must be a better way # to do this. LIBRARIES = -lrtemsbsp -lrtemscpu -lbsp -lbspstart \ -lposix -lc -lm -lgcc \ $(MX_RTEMS_GCC_DIR)/mpentiumpro/crti.o \ -lrtemsbsp -lrtemscpu MX_DRIVER_SRCS += i_rtems_vme.c # # RTEMS often runs on resource constrained systems, so we define here # a list of MX drivers that only includes the actual drivers we need. # You must also edit libMx/mx_driver_rtems.c to match. # # The following is just an example. You should customize it to match # the configuration you actually need. # MX_DRIVER_RTEMS_SRCS = i_tty.c i_rtems_vme.c \ i_pdi40.c i_pdi45.c i_vme58.c i_vsc16.c i_iseries.c \ d_soft_ainput.c d_soft_aoutput.c d_soft_dinput.c d_soft_doutput.c \ d_pdi45_aio.c d_pdi45_dio.c d_iseries_aio.c d_iseries_dio.c \ d_bit.c d_vme_dio.c \ d_soft_motor.c d_pdi40.c d_stp100.c d_vme58.c d_elapsed_time.c \ d_soft_scaler.c d_vsc16_scaler.c d_vsc16_timer.c \ d_pdi45_scaler.c d_pdi45_timer.c d_soft_timer.c d_interval_timer.c \ d_soft_amplifier.c d_generic_relay.c d_blind_relay.c \ d_pdi45_pulser.c v_mathop.c # # WARNING: I am not currently sure if the following information is correct, # since my MVME162 is currently not booting with RTEMS. # # MVME162 Note: # The linker command file /opt/rtems-4.6/m68k-rtems/mvme162/lib/linkcmds, # as distributed, comes configured for 1 megabyte of RAM. This is not # enough to run MX, so you must change the specified amount of RAM to # match the actual board you have. MX has only been tested with RTEMS # on the 16 megabyte MVME162-532A, which has more than enough memory. # # The lines that need to be changed are: # # _RamSize = DEFINED(_RamSize) ? _RamSize : 1M; # # and # # ram : org = 0x000000, l = 1M # # where you must replace the 1M with the actual amount of memory you have. # For example, 16M for the MVME162-532A mentioned above. # # If you really only have 1 megabyte of RAM in your MVME162, then you # are out of luck and cannot run MX on it. # # #======================================================================== # # Generally, you should not have to modify anything after this point unless # you are adding a new board support package, where you must customize the # makefile conditionals that use RTEMS_BSP below. # include $(MX_RTEMS_BSP_DIR)/Makefile.inc include $(RTEMS_CUSTOM) #include $(PROJECT_ROOT)/make/leaf.cfg # # Define a CPP macro describing the board support package (BSP) in use # and also define any BSP specific CPP macro definitions as well. # # In general, $(RTEMS_CUSTOM) provides definitions for at least # RTEMS_BSP, RTEMS_BSP_FAMILY, RTEMS_CPU, and RTEMS_CPU_MODEL # for each board support package. # # Most BSPs actually provide even more definitions. Look in the # directory /opt/rtems-4.6/make/custom for the details. # ifeq ($(RTEMS_BSP),pc686) BSP_FLAGS = -DMX_RTEMS_BSP_PC686 MX_LIB_SRCS = mx_driver_rtems.c $(MX_CORE_SRCS) $(MX_DRIVER_RTEMS_SRCS) HOST_CC = gcc TARGET_CPP = i386-rtems4.11-cpp endif ifeq ($(RTEMS_BSP),mvme162) BSP_FLAGS = -DMX_RTEMS_BSP_MVME162 -DHAVE_RTEMS_VME MX_LIB_SRCS = mx_driver_rtems.c $(MX_CORE_SRCS) $(MX_DRIVER_RTEMS_SRCS) HOST_CC = gcc TARGET_CPP = m68k-rtems-cpp endif ifeq ($(RTEMS_BSP),mvme2307) BSP_FLAGS = -DMX_RTEMS_BSP_MVME2307 -DHAVE_RTEMS_VME MX_LIB_SRCS = mx_driver_rtems.c $(MX_CORE_SRCS) $(MX_DRIVER_RTEMS_SRCS) HOST_CC = gcc TARGET_CPP = powerpc-rtems-cpp endif #------------------------------------------------------------------------ MANAGERS = io event semaphore ifeq ($(mx_directory_name),"motor") OBJS = mrtems.o $(MOTOR_OBJS) \ ../libMx/libMx.a $(LIBRARIES) else ifeq ($(mx_directory_name),"server") OBJS = ms_rtems.o $(SERVER_OBJS) \ ../libMx/libMx.a $(LIBRARIES) endif endif CFLAGS_LD += -Wl,--defsym -Wl,HeapSize=0x80000 # # gcc specific flags # GCCFLAGS = -Wall -Werror \ -Wpointer-arith \ -Wcast-align \ -Wcast-qual \ -Wnested-externs \ -Winline # The RTEMS include files are not compatible with the following warnings. # #-Wstrict-prototypes \ #-Wmissing-prototypes \ #-Wshadow \ # # RTEMS with GCC # CFLAGS = -g -O $(GCCFLAGS) \ -I$(MX_RTEMS_BSP_DIR)/lib/include \ $(INCLUDES) -DOS_RTEMS \ $(EXTRA_FLAGS) -DDEBUG \ $(BSP_FLAGS) # Special cases for individual files. CFLAGS_MX_VERS = -DOS_RTEMS -DMX_MAJOR_VERSION=$(MX_MAJOR_VERSION) \ -DMX_MINOR_VERSION=$(MX_MINOR_VERSION) \ -DMX_UPDATE_VERSION=$(MX_UPDATE_VERSION) \ -DMX_BRANCH_LABEL="\"$(MX_BRANCH_LABEL)\"" COMPILE = $(MX_RTEMS_GCC) -c DEFINE = -D MAKEDEPEND = $(MX_RTEMS_GCC) -MM $(CFLAGS) *.c > Makefile.depend MAKEDEPEND_CLEAN = rm Makefile.depend # #--------------------------------------------------- # # Declare bundled programs to be MX "applications". # One of the consequences of this is that mx_poison.h # is applied to them. # APP_FLAGS=$(DEFINE)__MX_APP__ # #--------------------------------------------------- # # # See libMx/Makehead.irix for why this is here. # MX_LIB_OBJS = $(MX_LIB_SRCS:.c=.$(OBJ)) MOTOR_OBJS = $(MOTOR_SRCS:.c=.$(OBJ)) SERVER_OBJS = $(SERVER_SRCS:.c=.$(OBJ)) AUTOSAVE_OBJS = $(AUTOSAVE_SRCS:.c=.$(OBJ)) MXDRIVERINFO_OBJS = $(MXDRIVERINFO_SRCS:.c=.$(OBJ)) MXMONITOR_OBJS = $(MXMONITOR_SRCS:.c=.$(OBJ)) #---- MX_LIB_OBJS += ../tools/strlcpy.o ../tools/strlcat.o MX_LIB_OBJS += ../tools/xdr_hyper.o # #--------------------------------------------------- # RM = rm -f MAKE = make MKDIR = mkdir TOUCH = touch -a OBJ = o EXEOUT = -o DOTEXE = # #--------------------------------------------------- # MX_LIB_DIR = ../libMx MX_INC_DIR = $(MX_LIB_DIR) MX_INCLUDES = -I$(MX_INC_DIR) MX_LIBRARY_NAME = libMx.a MX_LIBRARY_STATIC_NAME = $(MX_LIBRARY_NAME) MX_LIBRARY_PATH = $(MX_LIB_DIR)/$(MX_LIBRARY_NAME) MX_LIBRARY_DELETE = rm $(MX_LIBRARY_NAME) $(MX_LIBRARY_NAME): $(MX_LIB_OBJS) -$(MX_LIBRARY_DELETE) ar rcs $(MX_LIBRARY_NAME) $(MX_LIB_OBJS) ranlib $(MX_LIBRARY_NAME) library_install: -mkdir $(MX_INSTALL_DIR)/bin -mkdir $(MX_INSTALL_DIR)/etc -mkdir $(MX_INSTALL_DIR)/etc/startup -mkdir $(MX_INSTALL_DIR)/include -mkdir $(MX_INSTALL_DIR)/lib -mkdir $(MX_INSTALL_DIR)/log -mkdir $(MX_INSTALL_DIR)/run -mkdir $(MX_INSTALL_DIR)/sbin -mkdir $(MX_INSTALL_DIR)/state install -m 644 mx*.h $(MX_INSTALL_DIR)/include install -m 644 $(MX_LIBRARY_NAME) $(MX_INSTALL_DIR)/lib install -m 644 libMx.a $(MX_INSTALL_DIR)/lib ( cd $(MX_INSTALL_DIR)/lib ; ln -sf $(MX_LIBRARY_NAME) $(MX_SONAME) ) ( cd $(MX_INSTALL_DIR)/lib ; ln -sf $(MX_LIBRARY_NAME) libMx.so ) touch $(MX_INSTALL_DIR)/etc/mxmotor.dat touch $(MX_INSTALL_DIR)/etc/mxscan.dat install -m 755 ../plotgnu/plotgnu.pl $(MX_INSTALL_DIR)/bin install -m 755 ../plotgnu/showdata $(MX_INSTALL_DIR)/bin install -m 755 ../plotgnu/showplot $(MX_INSTALL_DIR)/bin install -m 755 ../plotgnu/plot2ps $(MX_INSTALL_DIR)/bin install -m 755 ../tools/mx_config $(MX_INSTALL_DIR)/bin mx_list_head.$(OBJ): Makefile.version mx_list_head.c mx_version.h $(COMPILE) $(CFLAGS) -DMX_CFLAGS="${CFLAGS}" mx_list_head.c # #--------------------------------------------------- # MOTOR_NAME = mxmotor.exe $(MOTOR_NAME): mrtems.o $(MOTOR_OBJS) $(MX_LIBRARY_PATH) $(LINK_FILES) $(LD) -o $(MOTOR_NAME) $(LIB_DIRS) -T linkcmds \ mrtems.o $(MOTOR_OBJS) -lMx \ $(LIBRARIES) mrtems.o: mrtems.c $(COMPILE) $(CFLAGS) mrtems.c motor_install: install -m 755 $(MOTOR_NAME) $(MX_INSTALL_DIR)/bin # #--------------------------------------------------- # SERVER_NAME = mxserver.exe $(SERVER_NAME): ms_rtems.o $(SERVER_OBJS) $(MX_LIBRARY_PATH) $(LINK_FILES) $(LD) -o $(SERVER_NAME) $(LIB_DIRS) -T linkcmds \ ms_rtems.o $(SERVER_OBJS) -lMx \ $(LIBRARIES) ms_rtems.o: ms_rtems.c $(COMPILE) $(CFLAGS) ms_rtems.c server_install: install -m 755 $(SERVER_NAME) $(MX_INSTALL_DIR)/sbin touch $(MX_INSTALL_DIR)/etc/mxserver.dat touch $(MX_INSTALL_DIR)/etc/mxserver.acl # #--------------------------------------------------- # AUTOSAVE_NAME = mxautosave.exe $(AUTOSAVE_NAME): autosave_install: # #--------------------------------------------------- # MXDRIVERINFO_NAME = mxdriverinfo.exe $(MXDRIVERINFO_NAME): util_install: