Merge rtems5 branch into 7.0
This commit is contained in:
59
.github/workflows/ci-scripts-build.yml
vendored
59
.github/workflows/ci-scripts-build.yml
vendored
@ -43,7 +43,9 @@ jobs:
|
||||
BCFG: ${{ matrix.configuration }}
|
||||
WINE: ${{ matrix.wine }}
|
||||
RTEMS: ${{ matrix.rtems }}
|
||||
RTEMS_TARGET: ${{ matrix.rtems_target }}
|
||||
EXTRA: ${{ matrix.extra }}
|
||||
TEST: ${{ matrix.test }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@ -78,17 +80,74 @@ jobs:
|
||||
extra: "CMD_CXXFLAGS=-std=c++11"
|
||||
name: "Ub-20 clang-10 C++11"
|
||||
|
||||
- os: ubuntu-20.04
|
||||
cmp: gcc
|
||||
configuration: default
|
||||
rtems: "5"
|
||||
rtems_target: RTEMS-pc686-qemu
|
||||
name: "Ub-20 gcc-9 + RT-5.1 pc686"
|
||||
|
||||
- os: ubuntu-20.04
|
||||
cmp: gcc
|
||||
configuration: default
|
||||
rtems: "5"
|
||||
rtems_target: RTEMS-beatnik
|
||||
test: NO
|
||||
name: "Ub-20 gcc-9 + RT-5.1 beatnik"
|
||||
|
||||
# - os: ubuntu-20.04
|
||||
# cmp: gcc
|
||||
# configuration: default
|
||||
# rtems: "5"
|
||||
# rtems_target: RTEMS-mvme2100
|
||||
# test: NO
|
||||
# name: "Ub-20 gcc-9 + RT-5.1 mvme2100"
|
||||
|
||||
- os: ubuntu-20.04
|
||||
cmp: gcc
|
||||
configuration: default
|
||||
rtems: "5"
|
||||
rtems_target: RTEMS-mvme3100
|
||||
test: NO
|
||||
name: "Ub-20 gcc-9 + RT-5.1 mvme3100"
|
||||
|
||||
- os: ubuntu-20.04
|
||||
cmp: gcc
|
||||
configuration: default
|
||||
rtems: "5"
|
||||
rtems_target: RTEMS-qoriq_e500
|
||||
test: NO
|
||||
name: "Ub-20 gcc-9 + RT-5.1 qoriq_e500"
|
||||
|
||||
- os: ubuntu-20.04
|
||||
cmp: gcc
|
||||
configuration: default
|
||||
rtems: "5"
|
||||
rtems_target: RTEMS-xilinx_zynq_a9_qemu
|
||||
test: NO
|
||||
name: "Ub-20 gcc-9 + RT-5.1 xilinx_zynq_a9_qemu"
|
||||
|
||||
- os: ubuntu-20.04
|
||||
cmp: gcc
|
||||
configuration: default
|
||||
rtems: "5"
|
||||
rtems_target: RTEMS-uC5282
|
||||
test: NO
|
||||
name: "Ub-20 gcc-9 + RT-5.1 uC5282"
|
||||
|
||||
- os: ubuntu-20.04
|
||||
cmp: gcc
|
||||
configuration: default
|
||||
rtems: "4.10"
|
||||
name: "Ub-20 gcc-9 + RT-4.10"
|
||||
rtems_target: RTEMS-pc386-qemu
|
||||
|
||||
- os: ubuntu-20.04
|
||||
cmp: gcc
|
||||
configuration: default
|
||||
rtems: "4.9"
|
||||
name: "Ub-20 gcc-9 + RT-4.9"
|
||||
rtems_target: RTEMS-pc386-qemu
|
||||
|
||||
- os: ubuntu-16.04
|
||||
cmp: gcc-4.8
|
||||
|
@ -62,6 +62,9 @@ include $(CONFIG)/os/CONFIG.$(EPICS_HOST_ARCH).Common
|
||||
RELEASE_TOPS := $(shell $(CONVERTRELEASE) -T $(TOP) releaseTops)
|
||||
|
||||
ifdef T_A
|
||||
# Information from the target's compiler
|
||||
#
|
||||
-include $(EPICS_BASE)/cfg/TOOLCHAIN.$(EPICS_HOST_ARCH).$(T_A)
|
||||
|
||||
# Cross compile specific definitions
|
||||
#
|
||||
|
@ -142,9 +142,10 @@ BUILDLIB_SUFFIX = $(BUILDLIB_SUFFIX_$(SHARED_LIBRARIES))
|
||||
#--------------------------------------------------
|
||||
# vpath directories
|
||||
POSIX_YES = os/posix
|
||||
OS_IMPL_DIRS = $(if $(OS_API),os/$(OS_CLASS)-$(OS_API),) os/$(OS_CLASS)
|
||||
GENERIC_SRC_DIRS = .. $(SRC_DIRS)
|
||||
OS_SRC_DIRS += . $(foreach dir, .. $(SRC_DIRS), \
|
||||
$(addprefix $(dir)/, os/$(OS_CLASS) $(POSIX_$(POSIX)) os/default ))
|
||||
$(addprefix $(dir)/, $(OS_IMPL_DIRS) $(POSIX_$(POSIX)) os/default ))
|
||||
CMPLR_SRC_DIRS += . $(foreach dir, .. $(SRC_DIRS), \
|
||||
$(addprefix $(dir)/, compiler/$(CMPLR_CLASS) compiler/default ))
|
||||
ALL_SRC_DIRS = $(CMPLR_SRC_DIRS) $(OS_SRC_DIRS) $(GENERIC_SRC_DIRS)
|
||||
|
@ -86,6 +86,7 @@
|
||||
# vxWorks-mpc8540
|
||||
# vxWorks-mpc8548
|
||||
# RTEMS-at91rm9200ek
|
||||
# RTEMS-beagleboneblack
|
||||
# RTEMS-beatnik
|
||||
# RTEMS-gen68360
|
||||
# RTEMS-mcp750
|
||||
@ -95,8 +96,12 @@
|
||||
# RTEMS-mvme3100
|
||||
# RTEMS-mvme5500
|
||||
# RTEMS-pc386
|
||||
# RTEMS-pc686
|
||||
# RTEMS-psim
|
||||
# RTEMS-qoriq_e500
|
||||
# RTEMS-uC5282
|
||||
# RTEMS-xilinx-zynq_a9_qemu
|
||||
# RTEMS-xilinx_zynq_zedboad
|
||||
# win32-x86-mingw (linux-x86 or -x86_64 host)
|
||||
#
|
||||
|
||||
@ -104,7 +109,6 @@
|
||||
# Definitions in configure/os/CONFIG_SITE.<host>.Common
|
||||
# may override this setting.
|
||||
CROSS_COMPILER_TARGET_ARCHS=
|
||||
#CROSS_COMPILER_TARGET_ARCHS=vxWorks-ppc32
|
||||
|
||||
# If only some of your host architectures can compile the
|
||||
# above CROSS_COMPILER_TARGET_ARCHS specify those host
|
||||
|
@ -15,7 +15,8 @@ include $(TOP)/configure/CONFIG
|
||||
TOOLS = $(TOP)/src/tools
|
||||
|
||||
CONFIGS += $(subst ../,,$(wildcard ../CONFIG*))
|
||||
CONFIGS += $(subst ../,,$(wildcard ../os/CONFIG*))
|
||||
CONFIGS += $(subst ../,,$(wildcard ../os/CONFIG.*))
|
||||
CONFIGS += $(subst ../,,$(wildcard ../os/CONFIG_SITE.*))
|
||||
|
||||
CONFIGS += $(subst ../,,$(wildcard ../RELEASE*))
|
||||
CONFIGS += $(subst ../,,$(wildcard ../RULES*))
|
||||
@ -29,5 +30,9 @@ CFG += CONFIG_CA_VERSION
|
||||
CFG += CONFIG_DATABASE_MODULE
|
||||
CFG += CONFIG_DATABASE_VERSION
|
||||
|
||||
CFG += TOOLCHAIN.$(EPICS_HOST_ARCH).$(T_A)
|
||||
|
||||
include $(TOP)/configure/RULES
|
||||
|
||||
TOOLCHAIN.$(EPICS_HOST_ARCH).$(T_A): toolchain.c
|
||||
$(PREPROCESS.cpp)
|
||||
|
@ -28,12 +28,13 @@ ifneq ($(CONFIG),$(TOP)/configure)
|
||||
endif
|
||||
|
||||
#--------------------------------------------------
|
||||
# Set RTEMS_BSP from T_A if not already done
|
||||
# Set RTEMS_BSP and GNU_TARGET if not already done
|
||||
RTEMS_BSP ?= $(subst RTEMS-,,$(T_A))
|
||||
GNU_TARGET ?= $(RTEMS_TARGET_CPU)-rtems
|
||||
|
||||
#-------------------------------------------------------
|
||||
# Pick up the RTEMS tool/path definitions from the RTEMS BSP directory.
|
||||
include $(RTEMS_BASE)/$(RTEMS_TARGET_CPU)-rtems$(RTEMS_VERSION)/$(RTEMS_BSP)/Makefile.inc
|
||||
include $(RTEMS_BASE)/$(GNU_TARGET)$(RTEMS_VERSION)/$(RTEMS_BSP)/Makefile.inc
|
||||
include $(RTEMS_CUSTOM)
|
||||
include $(CONFIG.CC)
|
||||
|
||||
@ -41,7 +42,7 @@ include $(CONFIG.CC)
|
||||
# RTEMS cross-development tools
|
||||
CC = $(RTEMS_TOOLS)/bin/$(CC_FOR_TARGET) $(GCCSPECS) -fasm
|
||||
CCC = $(RTEMS_TOOLS)/bin/$(CXX)
|
||||
CPP = $(RTEMS_TOOLS)/bin/$(CC_FOR_TARGET) -x c -E
|
||||
CPP = $(RTEMS_TOOLS)/bin/$(CC_FOR_TARGET) -x c -E $(GCCSPECS)
|
||||
AR = $(RTEMS_TOOLS)/bin/$(AR_FOR_TARGET)
|
||||
LD = $(RTEMS_TOOLS)/bin/$(LD_FOR_TARGET) -r
|
||||
|
||||
@ -95,20 +96,39 @@ MODEXT=.obj
|
||||
OS_CLASS = RTEMS
|
||||
|
||||
#--------------------------------------------------
|
||||
# Operating system flags
|
||||
OP_SYS_LDLIBS += -lrtemsCom -lc -lrtemscpu -lCom -lnfs -lm
|
||||
OP_SYS_LDFLAGS += $(CPU_CFLAGS) -u Init \
|
||||
# Operating system compile & link flags
|
||||
OP_SYS_CFLAGS += -D__LINUX_ERRNO_EXTENSIONS__
|
||||
|
||||
OP_SYS_CFLAGS_NET_yes = -DRTEMS_LEGACY_STACK
|
||||
OP_SYS_CFLAGS += $(OP_SYS_CFLAGS_NET_$(RTEMS_HAS_NETWORKING))
|
||||
|
||||
ifeq ($(RTEMS_HAS_POSIX_API),yes)
|
||||
POSIX_CPPFLAGS = -D_GNU_SOURCE -D_DEFAULT_SOURCE
|
||||
endif
|
||||
|
||||
OP_SYS_LDLIBS_posix_NET_yes = -ltftpfs -lnfs -lz -ltelnetd
|
||||
OP_SYS_LDLIBS_posix_NET_no = -ltftpfs -lbsd -lz
|
||||
OP_SYS_LDLIBS_kernel_NET_yes = -lnfs
|
||||
OP_SYS_LDLIBS_kernel_NET_no = -lnfs
|
||||
OP_SYS_LDLIBS += -lrtemsCom -lCom
|
||||
OP_SYS_LDLIBS += $(OP_SYS_LDLIBS_$(OS_API)_NET_$(RTEMS_HAS_NETWORKING))
|
||||
OP_SYS_LDLIBS += -lrtemscpu -lc -lm
|
||||
|
||||
OP_SYS_LDFLAGS_posix = -u POSIX_Init
|
||||
OP_SYS_LDFLAGS_kernel = -u Init \
|
||||
$(PROJECT_RELEASE)/lib/no-dpmem.rel \
|
||||
$(PROJECT_RELEASE)/lib/no-mp.rel \
|
||||
$(PROJECT_RELEASE)/lib/no-part.rel \
|
||||
$(PROJECT_RELEASE)/lib/no-signal.rel \
|
||||
$(PROJECT_RELEASE)/lib/no-rtmon.rel
|
||||
OP_SYS_LDFLAGS += $(CPU_CFLAGS) $(OP_SYS_LDFLAGS_$(OS_API))
|
||||
|
||||
# Settings for GeSys
|
||||
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 += -lc -lm -lrtemscpu -lrtemsbsp -lrtems++
|
||||
GESYS_LIBS += -lcexp -ltecla_r -lspencer_regexp -lpmelf -lpmbfd
|
||||
GESYS_LIBS += -lnfs -ltelnetd -lrtems-gdb-stub
|
||||
|
||||
|
18
configure/os/CONFIG.Common.RTEMS-beagleboneblack
Normal file
18
configure/os/CONFIG.Common.RTEMS-beagleboneblack
Normal file
@ -0,0 +1,18 @@
|
||||
#
|
||||
# CONFIG.Common.RTEMS-beaglebineblack
|
||||
# Author: Heinz Junkes <junkes@fhi-berlin.mpg.de>
|
||||
#
|
||||
# All RTEMS targets use the same Makefile fragment
|
||||
#
|
||||
#EXE = .elf
|
||||
RTEMS_BSP = beagleboneblack
|
||||
RTEMS_TARGET_CPU = arm
|
||||
GNU_TARGET = arm-rtems
|
||||
|
||||
OP_SYS_LDLIBS += -Wl,--gc-sections
|
||||
ARCH_DEP_LDFLAGS = -L$(RTEMS_BASE)/$(GNU_TARGET)$(RTEMS_VERSION)/beagleboneblack/lib/
|
||||
|
||||
include $(CONFIG)/os/CONFIG.Common.RTEMS
|
||||
|
||||
|
||||
|
@ -8,14 +8,16 @@ EXE = .elf
|
||||
RTEMS_BSP = beatnik
|
||||
RTEMS_TARGET_CPU = powerpc
|
||||
GNU_TARGET = powerpc-rtems
|
||||
ARCH_DEP_CFLAGS += -DMY_DO_BOOTP=NULL
|
||||
# optimization trouble in postfix.c
|
||||
ARCH_DEP_CFLAGS += -DRTEMS_HAS_ALTIVEC
|
||||
#will use bootp
|
||||
#ARCH_DEP_CFLAGS += -DMY_DO_BOOTP=NULL
|
||||
ARCH_DEP_CFLAGS += -DHAVE_MOTLOAD
|
||||
ARCH_DEP_CFLAGS += -DRTEMS_NETWORK_CONFIG_MBUF_SPACE=2048
|
||||
ARCH_DEP_CFLAGS += -DRTEMS_NETWORK_CONFIG_CLUSTER_SPACE=5120
|
||||
|
||||
OP_SYS_LDLIBS += -lbspExt
|
||||
|
||||
MUNCH_SUFFIX = .boot
|
||||
MUNCHNAME = $(PRODNAME:%$(EXE)=%$(MUNCH_SUFFIX))
|
||||
define MUNCH_CMD
|
||||
$(RTEMS_TOOLS)/bin/$(OBJCOPY_FOR_TARGET) -O binary $< $@
|
||||
endef
|
||||
|
@ -11,8 +11,6 @@ GNU_TARGET = powerpc-rtems
|
||||
ARCH_DEP_CFLAGS += -DMY_DO_BOOTP=NULL
|
||||
ARCH_DEP_CFLAGS += -DHAVE_PPCBUG
|
||||
|
||||
OP_SYS_LDLIBS += -lbspExt
|
||||
|
||||
MUNCH_SUFFIX = .boot
|
||||
define MUNCH_CMD
|
||||
$(RTEMS_TOOLS)/bin/$(OBJCOPY_FOR_TARGET) -O binary -R .comment -S $< rtems
|
||||
|
@ -20,6 +20,4 @@ define MUNCH_CMD
|
||||
rm -f rtems.gz
|
||||
endef
|
||||
|
||||
OP_SYS_LDLIBS += -lbspExt
|
||||
|
||||
include $(CONFIG)/os/CONFIG.Common.RTEMS
|
||||
|
@ -13,8 +13,6 @@ ARCH_DEP_CFLAGS += -DHAVE_MOTLOAD
|
||||
ARCH_DEP_CFLAGS += -DRTEMS_NETWORK_CONFIG_MBUF_SPACE=2048
|
||||
ARCH_DEP_CFLAGS += -DRTEMS_NETWORK_CONFIG_CLUSTER_SPACE=5120
|
||||
|
||||
OP_SYS_LDLIBS += -lbspExt
|
||||
|
||||
MUNCH_SUFFIX = .boot
|
||||
define MUNCH_CMD
|
||||
$(RTEMS_TOOLS)/bin/$(OBJCOPY_FOR_TARGET) -O binary $< $@
|
||||
|
@ -14,13 +14,9 @@ ARCH_DEP_CFLAGS += -DRTEMS_NETWORK_CONFIG_MBUF_SPACE=2048
|
||||
ARCH_DEP_CFLAGS += -DRTEMS_NETWORK_CONFIG_CLUSTER_SPACE=5120
|
||||
ARCH_DEP_CFLAGS += -DBSP_NVRAM_BASE_ADDR=0xf1110000
|
||||
|
||||
OP_SYS_LDLIBS += -lbspExt
|
||||
|
||||
MUNCH_SUFFIX = .boot
|
||||
define MUNCH_CMD
|
||||
$(RTEMS_TOOLS)/bin/$(OBJCOPY_FOR_TARGET) -O binary $< $@
|
||||
endef
|
||||
|
||||
OP_SYS_LDLIBS += -lbspExt
|
||||
|
||||
include $(CONFIG)/os/CONFIG.Common.RTEMS
|
||||
|
@ -1,12 +1,13 @@
|
||||
# CONFIG.Common.RTEMS-pc386
|
||||
#
|
||||
# Author: W. Eric Norum
|
||||
# Canadian Light Source
|
||||
# eric@cls.usask.ca
|
||||
#
|
||||
# All RTEMS targets use the same Makefile fragment
|
||||
# Definitions for the RTEMS-pc386 target, RTEMS 4.x only
|
||||
# Site-specific overrides go in CONFIG_SITE.Common.RTEMS-pc386
|
||||
#
|
||||
#-------------------------------------------------------
|
||||
|
||||
RTEMS_BSP = pc386
|
||||
RTEMS_TARGET_CPU = i386
|
||||
GNU_TARGET = i386-rtems
|
||||
|
||||
MUNCH_SUFFIX = .boot
|
||||
define MUNCH_CMD
|
||||
@ -22,3 +23,10 @@ include $(CONFIG)/os/CONFIG.Common.RTEMS
|
||||
# Put text segment where it will work with etherboot
|
||||
#
|
||||
OP_SYS_LDFLAGS += -Wl,-Ttext,0x100000
|
||||
|
||||
# This check must appear after the above include
|
||||
ifeq ($(RTEMS_VERSION),5)
|
||||
$(info *** This target is not compatible with the configured RTEMS version.)
|
||||
$(info *** Build the RTEMS-pc686 (-qemu) target for RTEMS 5.x)
|
||||
$(error Can't continue)
|
||||
endif
|
||||
|
@ -6,6 +6,7 @@
|
||||
#-------------------------------------------------------
|
||||
|
||||
# Include definitions from RTEMS-pc386
|
||||
# For Tests overwrite it with pc686
|
||||
include $(CONFIG)/os/CONFIG.Common.RTEMS-pc386
|
||||
|
||||
RTEMS_QEMU_FIXUPS = YES
|
||||
|
39
configure/os/CONFIG.Common.RTEMS-pc686
Normal file
39
configure/os/CONFIG.Common.RTEMS-pc686
Normal file
@ -0,0 +1,39 @@
|
||||
# CONFIG.Common.RTEMS-pc686
|
||||
#
|
||||
# Definitions for the RTEMS-pc686 target, RTEMS 5.x only
|
||||
# Site-specific overrides go in CONFIG_SITE.Common.RTEMS-pc686
|
||||
#
|
||||
#-------------------------------------------------------
|
||||
#
|
||||
# Author: W. Eric Norum
|
||||
# Canadian Light Source
|
||||
# eric@cls.usask.ca
|
||||
#
|
||||
# All RTEMS targets use the same Makefile fragment
|
||||
#
|
||||
RTEMS_BSP = pc686
|
||||
RTEMS_TARGET_CPU = i386
|
||||
GNU_TARGET = i386-rtems
|
||||
|
||||
MUNCH_SUFFIX = .boot
|
||||
define MUNCH_CMD
|
||||
$(RTEMS_TOOLS)/bin/$(OBJCOPY_FOR_TARGET) -O binary -R .comment -S $< $@
|
||||
endef
|
||||
|
||||
OP_SYS_LDLIBS += -Wl,--gc-sections
|
||||
ARCH_DEP_LDFLAGS = -L$(RTEMS_BASE)/$(GNU_TARGET)$(RTEMS_VERSION)/pc686/lib/
|
||||
|
||||
include $(CONFIG)/os/CONFIG.Common.RTEMS
|
||||
|
||||
#
|
||||
# Put text segment where it will work with etherboot
|
||||
#
|
||||
OP_SYS_LDFLAGS += -Wl,-Ttext,0x100000
|
||||
|
||||
|
||||
# This check must appear after the above include
|
||||
ifneq ($(RTEMS_VERSION),5)
|
||||
$(info *** This target is not compatible with the configured RTEMS version.)
|
||||
$(info *** Build the RTEMS-pc386 (-qemu) target for RTEMS 4.x)
|
||||
$(error Can't continue)
|
||||
endif
|
11
configure/os/CONFIG.Common.RTEMS-pc686-qemu
Normal file
11
configure/os/CONFIG.Common.RTEMS-pc686-qemu
Normal file
@ -0,0 +1,11 @@
|
||||
# CONFIG.Common.RTEMS-pc686-qemu
|
||||
#
|
||||
# Definitions for the RTEMS-pc686-qemu target
|
||||
# Site-specific overrides go in CONFIG_SITE.Common.RTEMS-pc686-qemu
|
||||
#
|
||||
#-------------------------------------------------------
|
||||
|
||||
# Include definitions from RTEMS-pc686
|
||||
include $(CONFIG)/os/CONFIG.Common.RTEMS-pc686
|
||||
|
||||
RTEMS_QEMU_FIXUPS = YES
|
48
configure/os/CONFIG.Common.RTEMS-qoriq_e500
Normal file
48
configure/os/CONFIG.Common.RTEMS-qoriq_e500
Normal file
@ -0,0 +1,48 @@
|
||||
#
|
||||
# CONFIG.Common.RTEMS-qoriq_e500
|
||||
# Author: Heinz Junkes <junkes@fhi-berlin.mpg.de>
|
||||
#
|
||||
# All RTEMS targets use the same Makefile fragment
|
||||
#
|
||||
EXE = .elf
|
||||
RTEMS_BSP = qoriq_e500
|
||||
RTEMS_TARGET_CPU = powerpc
|
||||
GNU_TARGET = powerpc-rtems
|
||||
# optimization trouble in postfix.c
|
||||
ARCH_DEP_CFLAGS += -DRTEMS_HAS_ALTIVEC
|
||||
#will use bootp
|
||||
#ARCH_DEP_CFLAGS += -DMY_DO_BOOTP=NULL
|
||||
|
||||
#ARCH_DEP_CFLAGS += -DRTEMS_NETWORK_CONFIG_MBUF_SPACE=2048
|
||||
#ARCH_DEP_CFLAGS += -DRTEMS_NETWORK_CONFIG_CLUSTER_SPACE=5120
|
||||
|
||||
#netbsdlib
|
||||
#ARCH_DEP_CFLAGS += -I$(RTEMS_BASE)/powerpc-rtems5/qoriq_e500/lib/include
|
||||
|
||||
#OP_SYS_LDLIBS += -lbspExt #does not use posix stuff ... want to ignore
|
||||
OP_SYS_LDLIBS += -Wl,--gc-sections
|
||||
#ARCH_DEP_LDFLAGS = -mcpu=8540 -meabi -msdata=sysv -mstrict-align -mspe -mabi=spe -mfloat-gprs=double
|
||||
ARCH_DEP_LDFLAGS = -L$(RTEMS_BASE)/powerpc-rtems5/qoriq_e500/lib
|
||||
|
||||
MUNCH_SUFFIX = .img
|
||||
MUNCHNAME = $(PRODNAME:%$(EXE)=%$(MUNCH_SUFFIX))
|
||||
define MUNCH_CMD
|
||||
$(RTEMS_TOOLS)/bin/$(OBJCOPY_FOR_TARGET) -O binary $< $@
|
||||
gzip -9 -f $@
|
||||
$(RTEMS_TOOLS)/bin/mkimage.py -A ppc -O linux -T kernel -a 0x4000 -e 0x4000 -n $* -d $@.gz $*.img
|
||||
endef
|
||||
|
||||
include $(CONFIG)/os/CONFIG.Common.RTEMS
|
||||
|
||||
RTEMSSYMS=$(PRODNAME:%$(EXE)=%.sym)
|
||||
RTEMSIMGS=$(PRODNAME:%$(EXE)=%.bin)
|
||||
INSTALL_RTEMSSYMS=$(RTEMSSYMS:%=$(INSTALL_BIN)/%)
|
||||
INSTALL_RTEMSIMGS=$(RTEMSIMGS:%=$(INSTALL_BIN)/%)
|
||||
|
||||
%.sym: %$(EXE)
|
||||
$(XSYMS) $^ $@
|
||||
|
||||
%.bin: %$(EXE)
|
||||
$(OBJCOPY) -Obinary $^ $@
|
||||
|
||||
#PRODTARGETS+=$(INSTALL_RTEMSSYMS) $(INSTALL_RTEMSIMGS)
|
@ -9,6 +9,10 @@ RTEMS_BSP = uC5282
|
||||
RTEMS_TARGET_CPU = m68k
|
||||
ARCH_DEP_CFLAGS += -DMY_DO_BOOTP=NULL
|
||||
|
||||
# Hopefully a temporary fix:
|
||||
ARCH_DEP_CXXFLAGS_5 = -std=c++98
|
||||
ARCH_DEP_CXXFLAGS += $(ARCH_DEP_CXXFLAGS_$(RTEMS_VERSION))
|
||||
|
||||
MUNCH_SUFFIX = .boot
|
||||
define MUNCH_CMD
|
||||
$(RTEMS_TOOLS)/bin/$(OBJCOPY_FOR_TARGET) -O binary -R .comment -S $< $@
|
||||
|
20
configure/os/CONFIG.Common.RTEMS-xilinx_zynq_a9_qemu
Normal file
20
configure/os/CONFIG.Common.RTEMS-xilinx_zynq_a9_qemu
Normal file
@ -0,0 +1,20 @@
|
||||
#
|
||||
# CONFIG.Common.RTEMS-xilinx_zynq_a9_qemu
|
||||
# Author: Heinz Junkes <junkes@fhi-berlin.mpg.de>
|
||||
#
|
||||
# All RTEMS targets use the same Makefile fragment
|
||||
#
|
||||
#EXE = .elf
|
||||
RTEMS_BSP = xilinx_zynq_a9_qemu
|
||||
RTEMS_TARGET_CPU = arm
|
||||
GNU_TARGET = arm-rtems
|
||||
|
||||
#use dhcp/bootp
|
||||
ARCH_DEP_CFLAGS += -DMY_DO_BOOTP=NULL
|
||||
|
||||
OP_SYS_LDLIBS += -Wl,--gc-sections
|
||||
ARCH_DEP_LDFLAGS = -L$(RTEMS_BASE)/$(GNU_TARGET)$(RTEMS_VERSION)/xilinx_zynq_a9_qemu/lib/
|
||||
|
||||
|
||||
include $(CONFIG)/os/CONFIG.Common.RTEMS
|
||||
|
19
configure/os/CONFIG.Common.RTEMS-xilinx_zynq_zedboard
Normal file
19
configure/os/CONFIG.Common.RTEMS-xilinx_zynq_zedboard
Normal file
@ -0,0 +1,19 @@
|
||||
#
|
||||
# CONFIG.Common.RTEMS-xilinx_zynq_zedboard
|
||||
# Author: Heinz Junkes <junkes@fhi-berlin.mpg.de>
|
||||
#
|
||||
# All RTEMS targets use the same Makefile fragment
|
||||
#
|
||||
#EXE = .elf
|
||||
RTEMS_BSP = xilinx_zynq_zedboard
|
||||
RTEMS_TARGET_CPU = arm
|
||||
GNU_TARGET = arm-rtems
|
||||
|
||||
OP_SYS_LDLIBS += -Wl,--gc-sections
|
||||
ARCH_DEP_LDFLAGS = -L$(RTEMS_BASE)/$(GNU_TARGET)$(RTEMS_VERSION)/xilinx_zynq_zedboard/lib/
|
||||
|
||||
|
||||
include $(CONFIG)/os/CONFIG.Common.RTEMS
|
||||
|
||||
|
||||
|
@ -3,6 +3,6 @@
|
||||
# Definitions for darwin-x86 host builds
|
||||
# Sites may override these definitions in CONFIG_SITE.darwin-x86.Common
|
||||
#-------------------------------------------------------
|
||||
|
||||
#support for IPv6 etc.
|
||||
#Include definitions common to unix hosts
|
||||
include $(CONFIG)/os/CONFIG.UnixCommon.Common
|
||||
|
@ -30,6 +30,7 @@ ARCH_DEP_LDFLAGS += $(ARCH_DEP_FLAGS)
|
||||
#
|
||||
# Special flags for Darwin
|
||||
# No common blocks (as required when using shared libraries)
|
||||
# OS provides socket address length
|
||||
#
|
||||
OP_SYS_CFLAGS += -fno-common
|
||||
|
||||
|
@ -3,11 +3,26 @@
|
||||
# Site-specific information for all RTEMS targets
|
||||
#-------------------------------------------------------
|
||||
|
||||
# Where to find RTEMS
|
||||
# Where to find RTEMS, and what version is it
|
||||
#
|
||||
# RTEMS_BASE must point to the specific installation of RTEMS to
|
||||
# build the target code with.
|
||||
# RTEMS_VERSION is used in the path to the toolsets inside that
|
||||
# installation. For RTEMS 5 only the major version number is
|
||||
# used, but for RTEMS 4.10.2 say all 3 components are required.
|
||||
#
|
||||
|
||||
# FHI:
|
||||
#RTEMS_VERSION = 5
|
||||
#RTEMS_BASE = /home/h1/DBG/rtems
|
||||
#RTEMS_BASE = /home/ad/MVME6100/rtems/$(RTEMS_VERSION)
|
||||
#RTEMS_BASE = /opt/RTEMS/qoriq/rtems/$(RTEMS_VERSION)
|
||||
|
||||
# APS:
|
||||
RTEMS_VERSION = 4.10.2
|
||||
RTEMS_BASE = /usr/local/vw/rtems/rtems-$(RTEMS_VERSION)
|
||||
#RTEMS_VERSION = 4.10.2
|
||||
#RTEMS_BASE = /usr/local/vw/rtems/rtems-4.10.2
|
||||
#RTEMS_VERSION = 5
|
||||
#RTEMS_BASE = /usr/local/vw/rtems/rtems-5.1
|
||||
|
||||
# Cross-compile toolchain in $(RTEMS_TOOLS)/bin
|
||||
#
|
||||
|
@ -6,4 +6,4 @@
|
||||
# If you're building this architecture you _probably_ want to
|
||||
# run the tests for it under QEMU, but if not you can turn
|
||||
# them off here by commenting out this line:
|
||||
CROSS_COMPILER_RUNTEST_ARCHS += RTEMS-pc386-qemu
|
||||
CROSS_COMPILER_RUNTEST_ARCHS += $(T_A)
|
||||
|
9
configure/os/CONFIG_SITE.Common.RTEMS-pc686-qemu
Normal file
9
configure/os/CONFIG_SITE.Common.RTEMS-pc686-qemu
Normal file
@ -0,0 +1,9 @@
|
||||
# CONFIG_SITE.Common.RTEMS-pc686-qemu
|
||||
#
|
||||
# Site-specific overrides for the RTEMS-pc686-qemu target
|
||||
#
|
||||
|
||||
# If you're building this architecture you _probably_ want to
|
||||
# run the tests for it under QEMU, but if not you can turn
|
||||
# them off here by commenting out this line:
|
||||
CROSS_COMPILER_RUNTEST_ARCHS += $(T_A)
|
37
configure/toolchain.c
Normal file
37
configure/toolchain.c
Normal file
@ -0,0 +1,37 @@
|
||||
#ifdef _COMMENT_
|
||||
/* Extract compiler pre-defined macros as Make variables
|
||||
*
|
||||
* Expanded as $(INSTALL_CFG)/TOOLCHAIN.$(EPICS_HOST_ARCH).$(T_A)
|
||||
*
|
||||
* Must be careful not to #include any C definitions
|
||||
* into what is really a Makefile snippet
|
||||
*
|
||||
* cf. https://sourceforge.net/p/predef/wiki/Home/
|
||||
*/
|
||||
/* GCC preprocessor drops C comments from output.
|
||||
* MSVC preprocessor emits C comments in output
|
||||
*/
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
GCC_MAJOR = __GNUC__
|
||||
GCC_MINOR = __GNUC_MINOR__
|
||||
GCC_PATCH = __GNUC_PATCHLEVEL__
|
||||
|
||||
#elif defined(__clang__)
|
||||
CLANG_MAJOR = __clang_major__
|
||||
CLANG_MINOR = __clang_minor__
|
||||
CLANG_PATCH = __clang_patchlevel__
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
MSVC_VER = _MSC_VER
|
||||
#endif
|
||||
|
||||
#ifdef __rtems__
|
||||
#include <rtems/score/cpuopts.h>
|
||||
# if __RTEMS_MAJOR__>=5
|
||||
OS_API = posix
|
||||
# else
|
||||
OS_API = kernel
|
||||
# endif
|
||||
#endif
|
@ -133,6 +133,44 @@ Test programs written directly in Perl as a `.plt` script should implement a
|
||||
similar timeout for themselves. The "netget" test in Base does this in a way
|
||||
that works on Windows as well as Unix-like hosts.
|
||||
|
||||
### Experimental Support for RTEMS 5
|
||||
The new major release of the RTEMS real-time OS contains many changes
|
||||
including the ability to support SMP systems and support for several
|
||||
new targets:
|
||||
|
||||
- RTEMS-beagleboneblack
|
||||
- RTEMS-pc686
|
||||
- RTEMS-qoriq_e500
|
||||
- RTEMS-xilinx-zynq-a9_qemu
|
||||
- RTEMS-xilinx_zynq_zedboard
|
||||
|
||||
The earlier EPICS support for RTEMS made use of various
|
||||
RTEMS-specific kernel APIs which cannot be used on an SMP system, so
|
||||
the changes here required a completely new port to the Posix
|
||||
real-time APIs that RTEMS-5 now recommends.
|
||||
|
||||
A new RTEMS configuration variable RTEMS_VERSION has been added which
|
||||
should be set to the OS version number, e.g. 4.9. When this is 4.12
|
||||
or greater, true for 5.1 as well, the new libCom/osi/os/RTEMS-posix
|
||||
source files will be used; the older API source files can now be
|
||||
found in libCom/osi/os/RTEMS-kernel, and those which are common to
|
||||
both installations are in libCom/osi/os/RTEMS. The compiler options
|
||||
are read from the Makefile.inc of the corresponding BSP and set in
|
||||
the configuration files. It checks that the BSP was also built with
|
||||
the --enable-posix option. It also checks if the BSP was built with
|
||||
the legacy stack or libbsd.
|
||||
|
||||
The dependency on bspExt has been removed. RTEMS 5 provides the bus
|
||||
support natively now.
|
||||
|
||||
Known Issues:
|
||||
- MVME2100, MVME167, and uC5282 have not yet been updated to compile for RTEMS 5.
|
||||
- VMEBus support is not available for all powerpc BSPs.
|
||||
- There are some known issues with floating point on MVME2500
|
||||
- Changed network driver for beatnik to work with libbsd. Some
|
||||
issues with DHCP, but network stack usable. Can load env from
|
||||
NVRAM.
|
||||
|
||||
-----
|
||||
|
||||
## EPICS Release 7.0.5
|
||||
|
@ -17,6 +17,9 @@
|
||||
#ifndef INC_caProto_H
|
||||
#define INC_caProto_H
|
||||
|
||||
// Pick up definition of IPPORT_USERRESERVED
|
||||
#include <osdSock.h>
|
||||
|
||||
#define capStrOf(A) #A
|
||||
#define capStrOfX(A) capStrOf ( A )
|
||||
|
||||
|
@ -54,7 +54,7 @@ typedef struct myPvt {
|
||||
int resultFail;
|
||||
} myPvt;
|
||||
|
||||
epicsEventId finished;
|
||||
static epicsEventId finished;
|
||||
|
||||
static void myCallback(epicsCallback *pCallback)
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ typedef struct myPvt {
|
||||
int resultFail;
|
||||
} myPvt;
|
||||
|
||||
epicsEventId finished;
|
||||
static epicsEventId finished;
|
||||
|
||||
|
||||
static void myCallback(epicsCallback *pCallback)
|
||||
|
@ -11,10 +11,14 @@ TOP = ../../..
|
||||
include $(TOP)/configure/CONFIG
|
||||
include $(TOP)/configure/CONFIG_LIBCOM_VERSION
|
||||
|
||||
# check check
|
||||
SRC_DIRS += ../$(OS_API)
|
||||
|
||||
PERL_SCRIPTS += epicsMakeMemFs.pl
|
||||
|
||||
INC += epicsRtemsInitHooks.h
|
||||
INC += epicsMemFs.h
|
||||
INC += epicsNtp.h
|
||||
|
||||
ifeq ($(RTEMS_QEMU_FIXUPS),YES)
|
||||
rtems_init_CPPFLAGS += -DQEMU_FIXUPS
|
||||
@ -27,11 +31,14 @@ rtemsCom_SRCS += setBootConfigFromNVRAM.c
|
||||
rtemsCom_SRCS += epicsRtemsInitHookPre.c
|
||||
rtemsCom_SRCS += epicsRtemsInitHookPost.c
|
||||
rtemsCom_SRCS += epicsMemFs.c
|
||||
rtemsCom_SRCS += epicsNtp.c
|
||||
|
||||
ifeq ($(RTEMS_BSP),pc386)
|
||||
ifeq ($(RTEMS_TARGET_CPU),i386)
|
||||
rtemsCom_SRCS += ne2kpci.c
|
||||
endif
|
||||
|
||||
rtems_config_CPPFLAGS += -DBSP_$(RTEMS_BSP)
|
||||
|
||||
LIBRARY_RTEMS = rtemsCom
|
||||
|
||||
# shared library ABI version.
|
||||
|
85
modules/libcom/RTEMS/epicsNtp.c
Normal file
85
modules/libcom/RTEMS/epicsNtp.c
Normal file
@ -0,0 +1,85 @@
|
||||
/*************************************************************************\
|
||||
* (C) 2014 David Lettier.
|
||||
* http://www.lettier.com/
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
\*************************************************************************/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <rtems.h>
|
||||
#include "epicsNtp.h"
|
||||
|
||||
int epicsNtpGetTime(char *ntpIp, struct timespec *now)
|
||||
{
|
||||
|
||||
int sockfd, n; // Socket file descriptor and the n return result from writing/reading from the socket.
|
||||
int portno = 123; // NTP UDP port number.
|
||||
|
||||
// Create and zero out the packet. All 48 bytes worth.
|
||||
ntp_packet packet = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
memset( &packet, 0, sizeof( ntp_packet ) );
|
||||
// Set the first byte's bits to 00,011,011 for li = 0, vn = 3, and mode = 3. The rest will be left set to zero.
|
||||
*( ( char * ) &packet + 0 ) = 0x1b; // Represents 27 in base 10 or 00011011 in base 2.
|
||||
|
||||
// Create a UDP socket, convert the host-name to an IP address, set the port number,
|
||||
// connect to the server, send the packet, and then read in the return packet.
|
||||
struct sockaddr_in serv_addr; // Server address data structure.
|
||||
|
||||
sockfd = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP ); // Create a UDP socket.
|
||||
|
||||
if ( sockfd < 0 ) {
|
||||
perror( "epicsNtpGetTime" );
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Zero out the server address structure.
|
||||
memset( ( char* ) &serv_addr, 0, sizeof( serv_addr ) );
|
||||
|
||||
serv_addr.sin_family = AF_INET;
|
||||
serv_addr.sin_addr.s_addr = inet_addr(ntpIp);
|
||||
|
||||
serv_addr.sin_port = htons( portno );
|
||||
|
||||
// Call up the server using its IP address and port number.
|
||||
if ( connect( sockfd, ( struct sockaddr * ) &serv_addr, sizeof( serv_addr) ) < 0 ) {
|
||||
perror( "epicsNtpGetTime" );
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Send it the NTP packet it wants. If n == -1, it failed.
|
||||
n = write( sockfd, ( char* ) &packet, sizeof( ntp_packet ) );
|
||||
if ( n < 0 ) {
|
||||
perror( "epicsNtpGetTime" );
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Wait and receive the packet back from the server. If n == -1, it failed.
|
||||
n = read( sockfd, ( char* ) &packet, sizeof( ntp_packet ) );
|
||||
if ( n < 0 ) {
|
||||
perror( "epicsNtpGetTime" );
|
||||
return -1;
|
||||
}
|
||||
|
||||
// These two fields contain the time-stamp seconds as the packet left the NTP server.
|
||||
// The number of seconds correspond to the seconds passed since 1900.
|
||||
// ntohl() converts the bit/byte order from the network's to host's "endianness".
|
||||
packet.txTm_s = ntohl( packet.txTm_s ); // Time-stamp seconds.
|
||||
packet.txTm_f = ntohl( packet.txTm_f ); // Time-stamp fraction of a second.
|
||||
|
||||
// Extract the 32 bits that represent the time-stamp seconds (since NTP epoch) from when the packet left the server.
|
||||
// Subtract 70 years worth of seconds from the seconds since 1900.
|
||||
// This leaves the seconds since the UNIX epoch of 1970.
|
||||
// (1900)------------------(1970)**************************************(Time Packet Left the Server)
|
||||
time_t txTm = ( time_t ) ( packet.txTm_s - NTP_TIMESTAMP_DELTA );
|
||||
now->tv_sec = txTm;
|
||||
return 0;
|
||||
}
|
42
modules/libcom/RTEMS/epicsNtp.h
Normal file
42
modules/libcom/RTEMS/epicsNtp.h
Normal file
@ -0,0 +1,42 @@
|
||||
/*************************************************************************\
|
||||
* (C) 2014 David Lettier.
|
||||
* http://www.lettier.com/
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
\*************************************************************************/
|
||||
#ifndef EPICSNTP_H
|
||||
#define EPICSNTP_H
|
||||
|
||||
#define NTP_TIMESTAMP_DELTA 2208988800ull
|
||||
|
||||
int epicsNtpGetTime(char *ntpIp, struct timespec *now);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
uint8_t li_vn_mode; // Eight bits. li, vn, and mode.
|
||||
// li. Two bits. Leap indicator.
|
||||
// vn. Three bits. Version number of the protocol.
|
||||
// mode. Three bits. Client will pick mode 3 for client.
|
||||
|
||||
uint8_t stratum; // Eight bits. Stratum level of the local clock.
|
||||
uint8_t poll; // Eight bits. Maximum interval between successive messages.
|
||||
uint8_t precision; // Eight bits. Precision of the local clock.
|
||||
|
||||
uint32_t rootDelay; // 32 bits. Total round trip delay time.
|
||||
uint32_t rootDispersion; // 32 bits. Max error aloud from primary clock source.
|
||||
uint32_t refId; // 32 bits. Reference clock identifier.
|
||||
|
||||
uint32_t refTm_s; // 32 bits. Reference time-stamp seconds.
|
||||
uint32_t refTm_f; // 32 bits. Reference time-stamp fraction of a second.
|
||||
|
||||
uint32_t origTm_s; // 32 bits. Originate time-stamp seconds.
|
||||
uint32_t origTm_f; // 32 bits. Originate time-stamp fraction of a second.
|
||||
|
||||
uint32_t rxTm_s; // 32 bits. Received time-stamp seconds.
|
||||
uint32_t rxTm_f; // 32 bits. Received time-stamp fraction of a second.
|
||||
|
||||
uint32_t txTm_s; // 32 bits and the most important field the client cares about. Transmit time-stamp seconds.
|
||||
uint32_t txTm_f; // 32 bits. Transmit time-stamp fraction of a second.
|
||||
|
||||
} ntp_packet; // Total: 384 bits or 48 bytes.
|
||||
#endif // EPICSNTP_H
|
@ -10,9 +10,10 @@
|
||||
* Dummy version -- use if application does not provide its own version
|
||||
*/
|
||||
#include "epicsRtemsInitHooks.h"
|
||||
|
||||
#ifdef RTEMS_LEGACY_STACK
|
||||
int
|
||||
epicsRtemsInitPostSetBootConfigFromNVRAM(struct rtems_bsdnet_config *config)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -10,9 +10,10 @@
|
||||
* Dummy version -- use if application does not provide its own version
|
||||
*/
|
||||
#include "epicsRtemsInitHooks.h"
|
||||
|
||||
#ifdef RTEMS_LEGACY_STACK
|
||||
int
|
||||
epicsRtemsInitPreSetBootConfigFromNVRAM(struct rtems_bsdnet_config *config)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -10,7 +10,9 @@
|
||||
* Hooks into RTEMS startup code
|
||||
*/
|
||||
#include <bsp.h>
|
||||
#ifdef RTEMS_LEGACY_STACK
|
||||
#include <rtems/rtems_bsdnet.h>
|
||||
#endif
|
||||
|
||||
extern char *env_nfsServer;
|
||||
extern char *env_nfsPath;
|
||||
@ -23,8 +25,10 @@ extern "C" {
|
||||
/*
|
||||
* Return 0 for success, non-zero for failure (will cause panic)
|
||||
*/
|
||||
#ifdef RTEMS_LEGACY_STACK
|
||||
int epicsRtemsInitPreSetBootConfigFromNVRAM(struct rtems_bsdnet_config *config);
|
||||
int epicsRtemsInitPostSetBootConfigFromNVRAM(struct rtems_bsdnet_config *config);
|
||||
#endif
|
||||
/* Return 0 if local file system was setup, or non-zero (will fall back to network */
|
||||
int epicsRtemsMountLocalFilesystem(char **argv);
|
||||
|
||||
|
172
modules/libcom/RTEMS/posix/rtems_config.c
Normal file
172
modules/libcom/RTEMS/posix/rtems_config.c
Normal file
@ -0,0 +1,172 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Saskatchewan
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/*
|
||||
* RTEMS configuration for EPICS
|
||||
* Author: W. Eric Norum
|
||||
* norume@aps.anl.gov
|
||||
* (630) 252-4793
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
|
||||
/*
|
||||
***********************************************************************
|
||||
* RTEMS CONFIGURATION *
|
||||
***********************************************************************
|
||||
*/
|
||||
|
||||
extern void *POSIX_Init(void *argument);
|
||||
|
||||
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
|
||||
#define CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT POSIX_Init
|
||||
#define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE (64*1024)
|
||||
|
||||
#define CONFIGURE_MAXIMUM_PERIODS 5
|
||||
#define CONFIGURE_MICROSECONDS_PER_TICK 10000
|
||||
#define CONFIGURE_MALLOC_STATISTICS 1
|
||||
/* MINIMUM_STACK_SIZE == 8K */
|
||||
#define CONFIGURE_EXTRA_TASK_STACKS (4000 * RTEMS_MINIMUM_STACK_SIZE)
|
||||
|
||||
#if __RTEMS_MAJOR__ > 4
|
||||
#define CONFIGURE_FILESYSTEM_DEVFS
|
||||
#define CONFIGURE_FILESYSTEM_TFTPFS
|
||||
#endif
|
||||
#define CONFIGURE_FILESYSTEM_NFS
|
||||
#define CONFIGURE_FILESYSTEM_IMFS
|
||||
|
||||
#ifndef RTEMS_LEGACY_STACK
|
||||
#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
|
||||
/*
|
||||
* Configure LibBSD.
|
||||
*/
|
||||
//#define RTEMS_BSD_CONFIG_NET_PF_UNIX
|
||||
//#define RTEMS_BSD_CONFIG_NET_IF_BRIDGE
|
||||
//#define RTEMS_BSD_CONFIG_NET_IF_LAGG
|
||||
//#define RTEMS_BSD_CONFIG_NET_IF_VLAN
|
||||
#define RTEMS_BSD_CONFIG_BSP_CONFIG
|
||||
#define RTEMS_BSD_CONFIG_INIT
|
||||
#include <machine/rtems-bsd-config.h>
|
||||
#endif // not LEGACY_STACK
|
||||
|
||||
/*
|
||||
* Configure RTEMS.
|
||||
*/
|
||||
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
|
||||
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
|
||||
#define CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
|
||||
#define CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
|
||||
|
||||
#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 150
|
||||
#define CONFIGURE_IMFS_ENABLE_MKFIFO 2
|
||||
|
||||
#define CONFIGURE_MAXIMUM_NFS_MOUNTS 3
|
||||
#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 5
|
||||
|
||||
#define CONFIGURE_UNLIMITED_ALLOCATION_SIZE 32
|
||||
#define CONFIGURE_UNLIMITED_OBJECTS
|
||||
#define CONFIGURE_UNIFIED_WORK_AREAS
|
||||
|
||||
#define CONFIGURE_STACK_CHECKER_ENABLED
|
||||
|
||||
#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
|
||||
#define CONFIGURE_BDBUF_BUFFER_MAX_SIZE (64 * 1024)
|
||||
#define CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS 4
|
||||
#define CONFIGURE_BDBUF_CACHE_MEMORY_SIZE (1 * 1024 * 1024)
|
||||
|
||||
/* we are using POSIX_INIT needed by V4
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
#define CONFIGURE_INIT_TASK_STACK_SIZE (32 * 1024)
|
||||
#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES
|
||||
#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
|
||||
#endif
|
||||
*/
|
||||
|
||||
//#define RTEMS_PCI_CONFIG_LIB
|
||||
//#define CONFIGURE_PCI_LIB PCI_LIB_AUTO
|
||||
|
||||
#if __RTEMS_MAJOR__ > 4
|
||||
#define CONFIGURE_SHELL_COMMANDS_INIT
|
||||
|
||||
#include <bsp/irq-info.h>
|
||||
|
||||
#ifndef RTEMS_LEGACY_STACK
|
||||
#include <rtems/netcmds-config.h>
|
||||
|
||||
#define CONFIGURE_SHELL_USER_COMMANDS \
|
||||
&bsp_interrupt_shell_command, \
|
||||
&rtems_shell_HOSTNAME_Command, \
|
||||
&rtems_shell_PING_Command, \
|
||||
&rtems_shell_ROUTE_Command, \
|
||||
&rtems_shell_NETSTAT_Command, \
|
||||
&rtems_shell_IFCONFIG_Command, \
|
||||
&rtems_shell_TCPDUMP_Command, \
|
||||
&rtems_shell_PFCTL_Command, \
|
||||
&rtems_shell_SYSCTL_Command
|
||||
#else // LEGACY_STACK:
|
||||
#define CONFIGURE_SHELL_USER_COMMANDS \
|
||||
&bsp_interrupt_shell_command, \
|
||||
&rtems_shell_PING_Command, \
|
||||
&rtems_shell_ROUTE_Command, \
|
||||
&rtems_shell_IFCONFIG_Command
|
||||
#endif
|
||||
|
||||
#define CONFIGURE_SHELL_COMMAND_CPUUSE
|
||||
#define CONFIGURE_SHELL_COMMAND_PERIODUSE
|
||||
#define CONFIGURE_SHELL_COMMAND_STACKUSE
|
||||
#define CONFIGURE_SHELL_COMMAND_PROFREPORT
|
||||
|
||||
#define CONFIGURE_SHELL_COMMAND_CP
|
||||
#define CONFIGURE_SHELL_COMMAND_PWD
|
||||
#define CONFIGURE_SHELL_COMMAND_LS
|
||||
#define CONFIGURE_SHELL_COMMAND_LN
|
||||
#define CONFIGURE_SHELL_COMMAND_LSOF
|
||||
#define CONFIGURE_SHELL_COMMAND_CHDIR
|
||||
#define CONFIGURE_SHELL_COMMAND_CD
|
||||
#define CONFIGURE_SHELL_COMMAND_MKDIR
|
||||
#define CONFIGURE_SHELL_COMMAND_RMDIR
|
||||
#define CONFIGURE_SHELL_COMMAND_CAT
|
||||
#define CONFIGURE_SHELL_COMMAND_MV
|
||||
#define CONFIGURE_SHELL_COMMAND_RM
|
||||
#define CONFIGURE_SHELL_COMMAND_MALLOC_INFO
|
||||
#define CONFIGURE_SHELL_COMMAND_SHUTDOWN
|
||||
|
||||
#include <rtems/shellconfig.h>
|
||||
#define RTEMS_BSD_CONFIG_BSP_CONFIG
|
||||
#define RTEMS_BSD_CONFIG_SERVICE_TELNETD
|
||||
#define RTEMS_BSD_CONFIG_TELNETD_STACK_SIZE (16 * 1024)
|
||||
#define RTEMS_BSD_CONFIG_SERVICE_FTPD
|
||||
#define RTEMS_BSD_CONFIG_FIREWALL_PF
|
||||
#else
|
||||
#include <rtems/shellconfig.h>
|
||||
#endif // not LEGACY_STACK
|
||||
|
||||
#if __RTEMS_MAJOR__ < 5 // still needed in Version 4?
|
||||
#define CONFIGURE_MAXIMUM_TASKS rtems_resource_unlimited(30)
|
||||
#endif
|
||||
|
||||
#define CONFIGURE_MAXIMUM_DRIVERS 40
|
||||
|
||||
/*
|
||||
* This should be made BSP dependent, not CPU dependent but I know of no
|
||||
* appropriate conditionals to use.
|
||||
* The new general time support makes including the RTC driver less important.
|
||||
*/
|
||||
#if !defined(mpc604) && !defined(__mc68040__) && !defined(__mcf5200__) && \
|
||||
!defined(mpc7455) && !defined(__arm__) && !defined(__nios2__)
|
||||
/* don't have RTC code */
|
||||
#define CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
|
||||
#endif
|
||||
|
||||
#if defined(BSP_pc386) || defined(BSP_pc686)
|
||||
#define RTEMS_BSD_CONFIG_DOMAIN_PAGE_MBUFS_SIZE (64 * 1024 * 1024)
|
||||
#elif defined(BSP_qoriq_e500)
|
||||
#define RTEMS_BSD_CONFIG_DOMAIN_PAGE_MBUFS_SIZE (32 * 1024 * 1024)
|
||||
#endif
|
||||
|
||||
#define CONFIGURE_INIT
|
||||
|
||||
#include <rtems/confdefs.h>
|
1186
modules/libcom/RTEMS/posix/rtems_init.c
Normal file
1186
modules/libcom/RTEMS/posix/rtems_init.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -15,8 +15,24 @@
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <bsp.h>
|
||||
#include <epicsVersion.h>
|
||||
|
||||
#define RTEMS_VERSION_INT VERSION_INT(__RTEMS_MAJOR__, __RTEMS_MINOR__, 0, 0)
|
||||
|
||||
#ifdef RTEMS_LEGACY_STACK // old non libbsd stack
|
||||
#include <rtems/rtems_bsdnet.h>
|
||||
|
||||
/*
|
||||
* Comment (by sebastian.huber):
|
||||
*
|
||||
* This rtems_bsdnet_loopattach() was a hack and is no longer needed in RTEMS
|
||||
* 4.11.
|
||||
*
|
||||
* --
|
||||
* Ticket URL: <http://devel.rtems.org/ticket/2375#comment:23>
|
||||
*/
|
||||
|
||||
#if RTEMS_VERSION_INT<=VERSION_INT(4,10,0,0)
|
||||
extern void rtems_bsdnet_loopattach();
|
||||
static struct rtems_bsdnet_ifconfig loopback_config = {
|
||||
"lo0", /* name */
|
||||
@ -25,7 +41,7 @@ static struct rtems_bsdnet_ifconfig loopback_config = {
|
||||
"127.0.0.1", /* IP address */
|
||||
"255.0.0.0", /* IP net mask */
|
||||
};
|
||||
|
||||
#endif
|
||||
/*
|
||||
* The following conditionals select the network interface card.
|
||||
*
|
||||
@ -37,19 +53,23 @@ static struct rtems_bsdnet_ifconfig loopback_config = {
|
||||
* application directory and make the appropriate changes.
|
||||
*/
|
||||
#if defined(__i386__)
|
||||
|
||||
extern int
|
||||
rtems_ne2kpci_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach);
|
||||
static struct rtems_bsdnet_ifconfig ne2k_driver_config = {
|
||||
"ne2", /* name */
|
||||
rtems_ne2kpci_driver_attach, /* attach function */
|
||||
#if RTEMS_VERSION_INT<=VERSION_INT(4,10,0,0)
|
||||
&loopback_config, /* link to next interface */
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
};
|
||||
|
||||
extern int rtems_fxp_attach (struct rtems_bsdnet_ifconfig *, int);
|
||||
static struct rtems_bsdnet_ifconfig fxp_driver_config = {
|
||||
"fxp1", /* name */
|
||||
rtems_fxp_attach, /* attach function */
|
||||
&ne2k_driver_config, /* link to next interface */
|
||||
&ne2k_driver_config, /* link to next interface */
|
||||
};
|
||||
extern int rtems_3c509_driver_attach (struct rtems_bsdnet_ifconfig *, int);
|
||||
static struct rtems_bsdnet_ifconfig e3c509_driver_config = {
|
||||
@ -73,12 +93,14 @@ static struct rtems_bsdnet_ifconfig e3c509_driver_config = {
|
||||
# endif
|
||||
# endif
|
||||
|
||||
static struct rtems_bsdnet_ifconfig bsp_driver_config = {
|
||||
static struct rtems_bsdnet_ifconfig netdriver_config = {
|
||||
RTEMS_BSP_NETWORK_DRIVER_NAME, /* name */
|
||||
RTEMS_BSP_NETWORK_DRIVER_ATTACH, /* attach function */
|
||||
#if RTEMS_VERSION_INT<=VERSION_INT(4,10,0,0)
|
||||
&loopback_config, /* link to next interface */
|
||||
#endif
|
||||
};
|
||||
#define FIRST_DRIVER_CONFIG &bsp_driver_config
|
||||
#define FIRST_DRIVER_CONFIG &netdriver_config
|
||||
|
||||
#endif
|
||||
|
||||
@ -127,3 +149,11 @@ struct rtems_bsdnet_config rtems_bsdnet_config = {
|
||||
NULL, /* Host name */
|
||||
MY_DOMAINNAME, /* Domain name */
|
||||
};
|
||||
#else // libbsd "new" stack
|
||||
// nothing to do??
|
||||
#endif // RTEMS_LEGACY_STACK
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -12,7 +12,9 @@
|
||||
#include <netinet/in.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#ifdef RTEMS_LEGACY_STACK
|
||||
#include <rtems/rtems_bsdnet.h>
|
||||
#endif
|
||||
#include <bsp.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
@ -26,6 +28,7 @@ char *env_nfsServer;
|
||||
char *env_nfsPath;
|
||||
char *env_nfsMountPoint;
|
||||
|
||||
extern char* rtems_bsdnet_bootp_cmdline;
|
||||
/*
|
||||
* Split argument string of form nfs_server:nfs_export:<path>
|
||||
* The nfs_export component will be used as:
|
||||
|
@ -27,6 +27,10 @@
|
||||
#include "postfixPvt.h"
|
||||
#include "libComAPI.h"
|
||||
|
||||
#ifdef RTEMS_HAS_ALTIVEC
|
||||
#pragma GCC push_options
|
||||
#pragma GCC optimize ("O0")
|
||||
#endif
|
||||
|
||||
/* declarations for postfix */
|
||||
|
||||
@ -626,3 +630,6 @@ LIBCOM_API void
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef RTEMS_HAS_ALTIVEC
|
||||
#pragma GCC pop_options
|
||||
#endif
|
||||
|
@ -19,12 +19,16 @@
|
||||
#include <bsp.h>
|
||||
#include "devLibVME.h"
|
||||
#include <epicsInterrupt.h>
|
||||
#include <epicsMMIO.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(__PPC__) || defined(__mcf528x__)
|
||||
/* EPICS VME support requires various routines to be provided by the
|
||||
* BSP. Most MVME PowerPC BSPs provide them, plus the uC5282.
|
||||
*/
|
||||
|
||||
#if defined(__PPC__)
|
||||
#include <bsp/VME.h>
|
||||
#include <bsp/bspExt.h>
|
||||
#endif
|
||||
|
||||
|
||||
@ -126,8 +130,7 @@ static long
|
||||
rtemsDevInit(void)
|
||||
{
|
||||
/* assume the vme bridge has been initialized by bsp */
|
||||
/* init BSP extensions [memProbe etc.] */
|
||||
return bspExtInit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -245,18 +248,70 @@ static long rtemsDevMapAddr (epicsAddressType addrType, unsigned options,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(__m68k__)
|
||||
/* All RTEMS m68k BSPs define this, m68k/shared/[misc/]memProbe.c */
|
||||
extern
|
||||
rtems_status_code bspExtMemProbe(void *addr, int write, int size, void *pval);
|
||||
#else
|
||||
|
||||
static
|
||||
rtems_status_code bspExtMemProbe(void *addr, int write, int size, void *pval)
|
||||
{
|
||||
rtems_interrupt_level flags;
|
||||
rtems_status_code ret = RTEMS_SUCCESSFUL;
|
||||
epicsUInt32 val;
|
||||
|
||||
/* bspExt allows caller to write uninitialized values, we don't */
|
||||
if(write && !pval)
|
||||
return RTEMS_INVALID_NUMBER;
|
||||
|
||||
switch(size) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
break;
|
||||
default:
|
||||
return RTEMS_INVALID_SIZE;
|
||||
}
|
||||
|
||||
if(write)
|
||||
memcpy(&val, pval, size);
|
||||
|
||||
rtems_interrupt_disable(flags);
|
||||
_BSP_clear_hostbridge_errors(0,1);
|
||||
|
||||
if(!write) {
|
||||
switch(size) {
|
||||
case 1: val = ioread8(addr)<<24; break;
|
||||
case 2: val = nat_ioread16(addr)<<16; break;
|
||||
case 4: val = nat_ioread32(addr); break;
|
||||
}
|
||||
} else {
|
||||
switch(size) {
|
||||
case 1: iowrite8(addr, val>>24); break;
|
||||
case 2: nat_iowrite16(addr, val>>16); break;
|
||||
case 4: nat_iowrite32(addr, val); break;
|
||||
}
|
||||
}
|
||||
|
||||
ret = _BSP_clear_hostbridge_errors(0,1);
|
||||
rtems_interrupt_enable(flags);
|
||||
|
||||
if(!write && pval)
|
||||
memcpy(pval, &val, size);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* a bus error safe "wordSize" read at the specified address which returns
|
||||
* unsuccessful status if the device isnt present
|
||||
*/
|
||||
rtems_status_code bspExtMemProbe(void *addr, int write, int size, void *pval);
|
||||
static long rtemsDevReadProbe (unsigned wordSize, volatile const void *ptr, void *pValue)
|
||||
{
|
||||
long status;
|
||||
|
||||
/*
|
||||
* this global variable exists in the nivxi library
|
||||
*/
|
||||
status = bspExtMemProbe ((void*)ptr, 0/*read*/, wordSize, pValue);
|
||||
if (status!=RTEMS_SUCCESSFUL) {
|
||||
return S_dev_noDevice;
|
||||
@ -273,9 +328,6 @@ static long rtemsDevWriteProbe (unsigned wordSize, volatile void *ptr, const voi
|
||||
{
|
||||
long status;
|
||||
|
||||
/*
|
||||
* this global variable exists in the nivxi library
|
||||
*/
|
||||
status = bspExtMemProbe ((void*)ptr, 1/*write*/, wordSize, (void*)pValue);
|
||||
if (status!=RTEMS_SUCCESSFUL) {
|
||||
return S_dev_noDevice;
|
||||
@ -359,7 +411,7 @@ devLibVME *pdevLibVME;
|
||||
#endif /* defined(__PPC__) || defined(__mcf528x__) */
|
||||
|
||||
/*
|
||||
* Some vxWorks convenience routines
|
||||
* Some convenience routines
|
||||
*/
|
||||
void
|
||||
bcopyLongs(char *source, char *destination, int nlongs)
|
@ -37,6 +37,10 @@ int select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, str
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef IPPORT_USERRESERVED
|
||||
#define IPPORT_USERRESERVED 5000
|
||||
#endif
|
||||
|
||||
typedef int SOCKET;
|
||||
#define INVALID_SOCKET (-1)
|
||||
#define SOCKERRNO errno
|
||||
@ -68,7 +72,6 @@ typedef unsigned char osiSockOptMcastTTL_t;
|
||||
#define SOCK_ENOTSOCK ENOTSOCK
|
||||
#define SOCK_EBADF EBADF
|
||||
|
||||
#define bzero(p,n) memset(p,0,n)
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
6
modules/libcom/src/osi/os/RTEMS-posix/devLibVMEOSD.c
Normal file
6
modules/libcom/src/osi/os/RTEMS-posix/devLibVMEOSD.c
Normal file
@ -0,0 +1,6 @@
|
||||
#ifdef RTEMS_LEGACY_STACK
|
||||
#include "../RTEMS-kernel/devLibVMEOSD.c"
|
||||
#else
|
||||
#pragma message "\n VME-Support only with RTEMS Legacy stack\n"
|
||||
#include "../default/devLibVMEOSD.c"
|
||||
#endif
|
160
modules/libcom/src/osi/os/RTEMS-posix/osdMessageQueue.c
Normal file
160
modules/libcom/src/osi/os/RTEMS-posix/osdMessageQueue.c
Normal file
@ -0,0 +1,160 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* SPDX-License-Identifier: EPICS
|
||||
* EPICS Base is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/*
|
||||
* Author W. Eric Norum
|
||||
* norume@aps.anl.gov
|
||||
* 630 252 4793
|
||||
*/
|
||||
|
||||
/*
|
||||
* We want to access information which is
|
||||
* normally hidden from application programs.
|
||||
*/
|
||||
#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ 1
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <rtems.h>
|
||||
#include <rtems/error.h>
|
||||
#include "epicsMessageQueue.h"
|
||||
#include "errlog.h"
|
||||
#include <epicsAtomic.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <mqueue.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
static int idCnt;
|
||||
|
||||
LIBCOM_API epicsMessageQueueId epicsStdCall
|
||||
epicsMessageQueueCreate(unsigned int capacity, unsigned int maximumMessageSize)
|
||||
{
|
||||
struct mq_attr the_attr;
|
||||
epicsMessageQueueId id = (epicsMessageQueueId)calloc(1, sizeof(*id));
|
||||
sprintf(id->name, "MQ_%0d", epicsAtomicIncrIntT(&idCnt));
|
||||
the_attr.mq_maxmsg = capacity;
|
||||
the_attr.mq_msgsize = maximumMessageSize;
|
||||
id->id = mq_open(id->name, O_RDWR | O_CREAT | O_EXCL, 0644, &the_attr);
|
||||
if (id->id <0) {
|
||||
fprintf (stderr, "Can't create message queue: %s\n", strerror (errno));
|
||||
return NULL;
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
LIBCOM_API void epicsStdCall epicsMessageQueueDestroy(
|
||||
epicsMessageQueueId id)
|
||||
{
|
||||
int rv;
|
||||
rv = mq_close(id->id);
|
||||
if( rv ) {
|
||||
fprintf(stderr, "epicsMessageQueueDestroy mq_close failed: %s\n",
|
||||
strerror(rv));
|
||||
}
|
||||
rv = mq_unlink(id->name);
|
||||
if( rv ) {
|
||||
fprintf(stderr,"epicsMessageQueueDestroy mq_unlink %s failed: %s\n",
|
||||
id->name, strerror(rv));
|
||||
}
|
||||
free(id);
|
||||
}
|
||||
|
||||
|
||||
LIBCOM_API int epicsStdCall epicsMessageQueueTrySend(
|
||||
epicsMessageQueueId id,
|
||||
void *message,
|
||||
unsigned int messageSize)
|
||||
{
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
return mq_timedsend(id->id, (char const *)message, messageSize, 0, &ts);
|
||||
}
|
||||
|
||||
LIBCOM_API int epicsStdCall epicsMessageQueueSendWithTimeout(
|
||||
epicsMessageQueueId id,
|
||||
void *message,
|
||||
unsigned int messageSize,
|
||||
double timeout)
|
||||
{
|
||||
struct timespec ts;
|
||||
unsigned long micros;
|
||||
|
||||
// assume timeout in sec
|
||||
micros = (unsigned long)(timeout * 1000000.0);
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
ts.tv_sec += micros / 1000000L;
|
||||
ts.tv_nsec += (micros % 1000000L) * 1000L;
|
||||
|
||||
return mq_timedsend (id->id, (const char *)message, messageSize, 0, &ts);
|
||||
}
|
||||
|
||||
LIBCOM_API int epicsStdCall epicsMessageQueueTryReceive(
|
||||
epicsMessageQueueId id,
|
||||
void *message,
|
||||
unsigned int size)
|
||||
{
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
return mq_timedreceive(id->id, (char *)message, size, NULL, &ts);
|
||||
}
|
||||
|
||||
LIBCOM_API int epicsStdCall epicsMessageQueueReceiveWithTimeout(
|
||||
epicsMessageQueueId id,
|
||||
void *message,
|
||||
unsigned int size,
|
||||
double timeout)
|
||||
{
|
||||
unsigned long micros;
|
||||
struct timespec ts;
|
||||
|
||||
micros = (unsigned long)(timeout * 1000000.0);
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
ts.tv_sec += micros / 1000000L;
|
||||
ts.tv_nsec += (micros % 1000000L) * 1000L;
|
||||
|
||||
return mq_timedreceive(id->id, (char *)message, size, NULL, &ts);
|
||||
}
|
||||
|
||||
LIBCOM_API int epicsStdCall epicsMessageQueuePending(
|
||||
epicsMessageQueueId id)
|
||||
{
|
||||
int rv;
|
||||
struct mq_attr the_attr;
|
||||
|
||||
rv = mq_getattr(id->id, &the_attr);
|
||||
if (rv) {
|
||||
fprintf(stderr, "Epics Message queue %x (%s) get attr failed: %s\n",
|
||||
(unsigned int)id->id, id->name, strerror(rv));
|
||||
return -1;
|
||||
}
|
||||
return the_attr.mq_curmsgs;
|
||||
}
|
||||
LIBCOM_API void epicsStdCall epicsMessageQueueShow(
|
||||
epicsMessageQueueId id,
|
||||
int level)
|
||||
{
|
||||
int rv;
|
||||
struct mq_attr the_attr;
|
||||
|
||||
rv = mq_getattr(id->id, &the_attr);
|
||||
if (rv) {
|
||||
fprintf(stderr, "Epics Message queue %x (%s) get attr failed: %s\n",
|
||||
(unsigned int)id->id, id->name, strerror(rv));
|
||||
}
|
||||
|
||||
printf("Message Queue Used:%ld Max Msg:%lu", the_attr.mq_curmsgs, the_attr.mq_maxmsg);
|
||||
if (level >= 1)
|
||||
printf(" Maximum size:%lu", the_attr.mq_msgsize);
|
||||
|
||||
printf("\n");
|
||||
}
|
28
modules/libcom/src/osi/os/RTEMS-posix/osdMessageQueue.h
Normal file
28
modules/libcom/src/osi/os/RTEMS-posix/osdMessageQueue.h
Normal file
@ -0,0 +1,28 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/*
|
||||
* Author W. Eric Norum
|
||||
* norume@aps.anl.gov
|
||||
* 630 252 4793
|
||||
*/
|
||||
|
||||
/*
|
||||
* Very thin shims around RTEMS routines
|
||||
*/
|
||||
#include <rtems.h>
|
||||
#include <mqueue.h>
|
||||
|
||||
struct epicsMessageQueueOSD {
|
||||
mqd_t id;
|
||||
char name[24];
|
||||
};
|
||||
#define epicsMessageQueueSend(q,m,l) (mq_send((q)->id, (const char*)(m), (l), 0))
|
||||
#define epicsMessageQueueReceive(q,m,s) (mq_receive((q)->id, (char*)(m), (s), NULL))
|
||||
|
8
modules/libcom/src/osi/os/RTEMS-posix/osdMutex.c
Normal file
8
modules/libcom/src/osi/os/RTEMS-posix/osdMutex.c
Normal file
@ -0,0 +1,8 @@
|
||||
#include <rtems.h>
|
||||
#include <rtems/error.h>
|
||||
#include <rtems/rtems/tasks.h>
|
||||
#ifndef RTEMS_LEGACY_STACK
|
||||
#include <rtems/score/threadimpl.h>
|
||||
#endif
|
||||
|
||||
#include "../posix/osdMutex.c"
|
43
modules/libcom/src/osi/os/RTEMS-posix/osdPoolStatus.c
Normal file
43
modules/libcom/src/osi/os/RTEMS-posix/osdPoolStatus.c
Normal file
@ -0,0 +1,43 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
#include <rtems.h>
|
||||
#include <rtems/malloc.h>
|
||||
#include <rtems/score/heap.h>
|
||||
#define epicsExportSharedSymbols
|
||||
#include "osiPoolStatus.h"
|
||||
|
||||
#if __RTEMS_MAJOR__<5
|
||||
/*
|
||||
* * osiSufficentSpaceInPool ()
|
||||
* */
|
||||
LIBCOM_API int epicsStdCall osiSufficentSpaceInPool ( size_t contiguousBlockSize )
|
||||
{
|
||||
rtems_malloc_statistics_t s;
|
||||
unsigned long n;
|
||||
|
||||
malloc_get_statistics(&s);
|
||||
n = s.space_available - (unsigned long)(s.lifetime_allocated - s.lifetime_freed);
|
||||
return (n > (50000 + contiguousBlockSize));
|
||||
}
|
||||
|
||||
#else
|
||||
/*
|
||||
* osiSufficentSpaceInPool ()
|
||||
*/
|
||||
LIBCOM_API int epicsStdCall osiSufficentSpaceInPool ( size_t contiguousBlockSize )
|
||||
{
|
||||
unsigned long n;
|
||||
Heap_Information_block info;
|
||||
|
||||
malloc_info( &info );
|
||||
n = info.Stats.size - (unsigned long)(info.Stats.lifetime_allocated - info.Stats.lifetime_freed);
|
||||
return (n > (50000 + contiguousBlockSize));
|
||||
}
|
||||
#endif
|
80
modules/libcom/src/osi/os/RTEMS-posix/osdSock.h
Normal file
80
modules/libcom/src/osi/os/RTEMS-posix/osdSock.h
Normal file
@ -0,0 +1,80 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* Linux specific socket include
|
||||
*/
|
||||
|
||||
#ifndef osdSockH
|
||||
#define osdSockH
|
||||
|
||||
#include <sys/errno.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h> /* for MAXHOSTNAMELEN */
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <net/if.h>
|
||||
#include <netdb.h>
|
||||
#include <unistd.h> /* close() and others */
|
||||
|
||||
typedef int SOCKET;
|
||||
#define INVALID_SOCKET (-1)
|
||||
#define SOCKERRNO errno
|
||||
#define socket_ioctl(A,B,C) ioctl(A,B,C)
|
||||
typedef int osiSockIoctl_t;
|
||||
typedef socklen_t osiSocklen_t;
|
||||
typedef char osiSockOptMcastLoop_t;
|
||||
typedef char osiSockOptMcastTTL_t;
|
||||
|
||||
#define FD_IN_FDSET(FD) ((FD)<FD_SETSIZE)
|
||||
|
||||
#define SOCK_EWOULDBLOCK EWOULDBLOCK
|
||||
#define SOCK_ENOBUFS ENOBUFS
|
||||
#define SOCK_ECONNRESET ECONNRESET
|
||||
#define SOCK_ETIMEDOUT ETIMEDOUT
|
||||
#define SOCK_EACCES EACCES
|
||||
#define SOCK_EADDRINUSE EADDRINUSE
|
||||
#define SOCK_EADDRNOTAVAIL EADDRNOTAVAIL
|
||||
#define SOCK_ECONNREFUSED ECONNREFUSED
|
||||
#define SOCK_ECONNABORTED ECONNABORTED
|
||||
#define SOCK_EINPROGRESS EINPROGRESS
|
||||
#define SOCK_EISCONN EISCONN
|
||||
#define SOCK_EALREADY EALREADY
|
||||
#define SOCK_EINVAL EINVAL
|
||||
#define SOCK_EINTR EINTR
|
||||
#define SOCK_EPIPE EPIPE
|
||||
#define SOCK_EMFILE EMFILE
|
||||
#define SOCK_SHUTDOWN ESHUTDOWN
|
||||
#define SOCK_ENOTSOCK ENOTSOCK
|
||||
#define SOCK_EBADF EBADF
|
||||
|
||||
#ifndef SHUT_RD
|
||||
# define SHUT_RD 0
|
||||
#endif
|
||||
|
||||
#ifndef SHUT_WR
|
||||
# define SHUT_WR 1
|
||||
#endif
|
||||
|
||||
#ifndef SHUT_RDWR
|
||||
# define SHUT_RDWR 2
|
||||
#endif
|
||||
|
||||
#define ifreq_size(pifreq) (pifreq->ifr_addr.sa_len + sizeof(pifreq->ifr_name))
|
||||
|
||||
#ifndef IPPORT_USERRESERVED
|
||||
#define IPPORT_USERRESERVED 5000
|
||||
#endif
|
||||
|
||||
#endif /*osdSockH*/
|
@ -7,9 +7,10 @@
|
||||
\*************************************************************************/
|
||||
/* osi/os/posix/osdFindSymbol.c */
|
||||
|
||||
#include "epicsFindSymbol.h"
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "epicsFindSymbol.h"
|
||||
|
||||
/* non-POSIX extension available on Linux (glibc at least) and OSX.
|
||||
*/
|
||||
|
@ -24,8 +24,9 @@
|
||||
#include <sched.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined(_POSIX_MEMLOCK) && _POSIX_MEMLOCK > 0
|
||||
#include <sys/mman.h>
|
||||
#define USE_MEMLOCK (defined(_POSIX_MEMLOCK) && (_POSIX_MEMLOCK > 0) && !defined(__rtems__))
|
||||
#if USE_MEMLOCK
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
#include "epicsStdio.h"
|
||||
@ -426,7 +427,8 @@ static void epicsThreadInit(void)
|
||||
LIBCOM_API
|
||||
void epicsThreadRealtimeLock(void)
|
||||
{
|
||||
#if defined(_POSIX_MEMLOCK) && _POSIX_MEMLOCK > 0
|
||||
#if USE_MEMLOCK
|
||||
#ifndef RTEMS_LEGACY_STACK // seems to be part of libbsd?
|
||||
if (pcommonAttr->maxPriority > pcommonAttr->minPriority) {
|
||||
int status = mlockall(MCL_CURRENT | MCL_FUTURE);
|
||||
|
||||
@ -451,6 +453,7 @@ void epicsThreadRealtimeLock(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // LEGACY STACK
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -125,3 +125,15 @@ extern "C" LIBCOM_API void
|
||||
++wakeTime->tv_sec;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __rtems__
|
||||
int osdTickGet()
|
||||
{
|
||||
return epicsMonotonicGet(); // ns
|
||||
}
|
||||
int osdTickRateGet()
|
||||
{
|
||||
return 1000000000;
|
||||
}
|
||||
void osdNTPReport() {}
|
||||
#endif
|
||||
|
@ -31,6 +31,14 @@ extern "C" {
|
||||
LIBCOM_API void epicsStdCall
|
||||
convertDoubleToWakeTime(double timeout,struct timespec *wakeTime);
|
||||
|
||||
#ifdef __rtems__
|
||||
void osdNTPInit(void);
|
||||
int osdNTPGet(struct timespec *now);
|
||||
int osdTickGet(void);
|
||||
int osdTickRateGet(void);
|
||||
void osdNTPReport(void);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
@ -6,7 +6,7 @@
|
||||
# Operator of Los Alamos National Laboratory.
|
||||
# SPDX-License-Identifier: EPICS
|
||||
# EPICS BASE is distributed subject to a Software License Agreement found
|
||||
# in file LICENSE that is included with this distribution.
|
||||
# in file LICENSE that is included with this distribution.
|
||||
#*************************************************************************
|
||||
|
||||
# The makeTestfile.pl script generates a file $target.t which is needed
|
||||
@ -36,29 +36,37 @@ my $tool = basename($0);
|
||||
my $timeout = $ENV{EPICS_UNITTEST_TIMEOUT} // 500; # 8 min 20 sec
|
||||
|
||||
my ($TA, $HA, $target, $exe) = @ARGV;
|
||||
my $exec;
|
||||
my ($exec, $error);
|
||||
|
||||
# Use WINE to run windows target executables on non-windows host
|
||||
if( $TA =~ /^win32-x86/ && $HA !~ /^win/ ) {
|
||||
# new deb. derivatives have wine32 and wine64
|
||||
# older have wine and wine64
|
||||
# prefer wine32 if present
|
||||
my $wine32 = "/usr/bin/wine32";
|
||||
$wine32 = "/usr/bin/wine" if ! -x $wine32;
|
||||
$exec = "$wine32 $exe";
|
||||
} elsif( $TA =~ /^windows-x64/ && $HA !~ /^win/ ) {
|
||||
$exec = "wine64 $exe";
|
||||
|
||||
# Run pc386 test harness w/ QEMU
|
||||
} elsif( $TA =~ /^RTEMS-pc386-qemu$/ ) {
|
||||
$exec = "qemu-system-i386 -m 64 -no-reboot -serial stdio -display none -net nic,model=ne2k_pci -net user,restrict=yes -kernel $exe";
|
||||
|
||||
# Explicitly fail for other RTEMS targets
|
||||
} elsif( $TA =~ /^RTEMS-/ ) {
|
||||
die "$tool: I don't know how to create scripts for testing $TA on $HA\n";
|
||||
|
||||
} else {
|
||||
$exec = "./$exe";
|
||||
if ($TA =~ /^win32-x86/ && $HA !~ /^win/) {
|
||||
# Use WINE to run win32-x86 executables on non-windows hosts.
|
||||
# New Debian derivatives have wine32 and wine64, older ones have
|
||||
# wine and wine64. We prefer wine32 if present.
|
||||
my $wine32 = "/usr/bin/wine32";
|
||||
$wine32 = "/usr/bin/wine" if ! -x $wine32;
|
||||
$error = $exec = "$wine32 $exe";
|
||||
}
|
||||
elsif ($TA =~ /^windows-x64/ && $HA !~ /^win/) {
|
||||
# Use WINE to run windows-x64 executables on non-windows hosts.
|
||||
$error = $exec = "wine64 $exe";
|
||||
}
|
||||
elsif ($TA =~ /^RTEMS-pc[36]86-qemu$/) {
|
||||
# Run the pc386 and pc686 test harness w/ QEMU
|
||||
$exec = "qemu-system-i386 -m 64 -no-reboot "
|
||||
. "-serial stdio -display none "
|
||||
. "-net nic,model=e1000 -net nic,model=ne2k_pci "
|
||||
. "-net user,restrict=yes "
|
||||
. "-append --console=/dev/com1 "
|
||||
. "-kernel $exe";
|
||||
$error = "qemu-system-i386 ... -kernel $exe";
|
||||
}
|
||||
elsif ($TA =~ /^RTEMS-/) {
|
||||
# Explicitly fail for other RTEMS targets
|
||||
die "$tool: I don't know how to create scripts for testing $TA on $HA\n";
|
||||
}
|
||||
else {
|
||||
# Assume it's directly executable on other targets
|
||||
$error = $exec = "./$exe";
|
||||
}
|
||||
|
||||
# Create the $target.t file
|
||||
@ -114,12 +122,12 @@ my \$proc;
|
||||
if (! Win32::Process::Create(\$proc, abs_path('$exec'),
|
||||
'$exec', 1, NORMAL_PRIORITY_CLASS, '.')) {
|
||||
my \$err = Win32::FormatMessage(Win32::GetLastError());
|
||||
die "\$tool: Can't create Process for '$exec': \$err\\n";
|
||||
die "\$tool: Can't create Process for '$error': \$err\\n";
|
||||
}
|
||||
if (! \$proc->Wait(1000 * \$timeout)) {
|
||||
\$proc->Kill(1);
|
||||
print "\\n#### Test stopped by \$tool after \$timeout seconds\\n";
|
||||
die "\$tool: Timed out '$exec' after \$timeout seconds\\n";
|
||||
die "\$tool: Timed out '$error' after \$timeout seconds\\n";
|
||||
}
|
||||
my \$status;
|
||||
\$proc->GetExitCode(\$status);
|
||||
@ -132,7 +140,7 @@ else {
|
||||
print $OUT <<__UNIX__;
|
||||
|
||||
my \$pid = fork();
|
||||
die "\$tool: Can't fork for '$exec': \$!\\n"
|
||||
die "\$tool: Can't fork for '$error': \$!\\n"
|
||||
unless defined \$pid;
|
||||
|
||||
if (\$pid) {
|
||||
@ -141,7 +149,7 @@ if (\$pid) {
|
||||
# Time's up, kill the child
|
||||
kill 9, \$pid;
|
||||
print "\\n#### Test stopped by \$tool after \$timeout seconds\\n";
|
||||
die "\$tool: Timed out '$exec' after \$timeout seconds\\n";
|
||||
die "\$tool: Timed out '$error' after \$timeout seconds\\n";
|
||||
};
|
||||
|
||||
alarm \$timeout;
|
||||
@ -152,7 +160,7 @@ if (\$pid) {
|
||||
else {
|
||||
# Child process
|
||||
exec '$exec'
|
||||
or die "\$tool: Can't run '$exec': \$!\\n";
|
||||
or die "\$tool: Can't run '$error': \$!\\n";
|
||||
}
|
||||
__UNIX__
|
||||
}
|
||||
|
Reference in New Issue
Block a user