try to build user servo loop
This commit is contained in:
94
usrServo/sampleKernelModule/Makefile.Deltatau
Normal file
94
usrServo/sampleKernelModule/Makefile.Deltatau
Normal file
@@ -0,0 +1,94 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) Delta Tau Data Systems Inc., 2007
|
||||
# All rights reserved.
|
||||
#
|
||||
# Generic makefile for any c realtime C plc 0, user servo or user phase
|
||||
# For a new project change the following
|
||||
#
|
||||
# 1.) usralgo-objs should be assigned the 'C' source code files that need to be compiled
|
||||
# 2.) issue the command 'make depend' the first time a project is created and
|
||||
# (every time an additional 'C' file is added to the project the command
|
||||
# 'make depend' must be issued)
|
||||
# 3.) issue the command make clean
|
||||
# 4.) issue the command make
|
||||
#
|
||||
# Notes
|
||||
# --------
|
||||
# Change DTDEBUG above to -O2 for release w/ optimization
|
||||
# Change DTDEBUG above to -g3 for debug
|
||||
# arm,i386,i385hv,ppc460-2,ppc460-1,ppc405
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
PMAC_ARCH=ppc465-2
|
||||
|
||||
ifeq ($(PMAC_ARCH),ppc465-2)
|
||||
ARCH=powerpc
|
||||
#CROSS_COMPILE=powerpc-meau-linux-gnu-
|
||||
CROSS_COMPILE=/opt/eldk-4.2/usr/bin/ppc_4xxFP-
|
||||
KDIR=/opt/powerpc-465-rootfs/usr/src/linux-3.2.21-serengeti-smp
|
||||
KSRC=/opt/powerpc-465-rootfs/usr/src/linux-3.2.21-serengeti-smp
|
||||
#CC=powerpc-meau-linux-gnu-gcc
|
||||
#AS=powerpc-meau-linux-gnu-as
|
||||
#LD=powerpc-meau-linux-gnu-gcc
|
||||
CC=/opt/eldk-4.2/usr/bin/ppc_4xxFP-gcc
|
||||
AS=/opt/eldk-4.2/usr/bin/ppc_4xxFP-gcc
|
||||
LD=/opt/eldk-4.2/usr/bin/ppc_4xxFP-gcc
|
||||
#STRIP=i686-meau-linux-gnu-strip
|
||||
INCLUDE=/opt/powerpc-465-rootfs/usr/lib/gcc/powerpc-linux-gnu/4.6/include
|
||||
XENOMAI_INC_DIR=/opt/powerpc-465-rootfs/usr/local/xenomai-2.6.2.1/include
|
||||
XENOMAI_LIB_DIR=/opt/powerpc-465-rootfs/usr/local/xenomai-2.6.2.1/lib
|
||||
RPATH=-Wl,-rpath-link,/opt/powerpc-465-rootfs/lib/powerpc-linux-gnu
|
||||
ROOTFS_DIR=/opt/powerpc-465-rootfs
|
||||
endif
|
||||
|
||||
#RTPMACINCLUDEDIR=/usr/local/dtlibs/rtpmac
|
||||
#LIBPPMACINCLUDEDIR=/usr/local/dtlibs/libppmac
|
||||
RTPMACINCLUDEDIR=../ppmac/rtpmac/
|
||||
LIBPPMACINCLUDEDIR=../ppmac/libppmac/
|
||||
|
||||
export ARCH
|
||||
export CROSS_COMPILE
|
||||
|
||||
OBJS := ${patsubst %, %.o, $(MODULES)}
|
||||
CLEANMOD := ${patsubst %, .%*, $(MODULES)}
|
||||
PWD := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
|
||||
|
||||
|
||||
#obj-m += usralgo.o
|
||||
#usralgo-objs := usralgomain.o \
|
||||
usrcode.o
|
||||
obj-m += hello.o
|
||||
|
||||
|
||||
|
||||
LDFLAGS := -nostdlib
|
||||
EXTRA_CFLAGS := -O2 -DCONFIG_460EX -D_GNU_SOURCE -D_REENTRANT -D__XENO__ -mhard-float -I$(RTPMACINCLUDEDIR) -I$(LIBPPMACINCLUDEDIR) -I$(XENOMAI_INC_DIR) -I$(XENOMAI_INC_DIR)/posix -I$(KSRC)/include/xenomai -I$(KSRC)/include/xenomai/posix -I$(INCLUDE) $(ADD_CFLAGS) --sysroot=$(ROOTFS_DIR)
|
||||
KBUILD_EXTRA_SYMBOLS := /usr/local/dtlibs/libppmac/Module.symvers
|
||||
|
||||
%.o: %.S
|
||||
$(CC) -s -D__KERNEL__ -x c -E $< -o $*.i
|
||||
$(AS) -mbooke -o $@ $*.i
|
||||
|
||||
#all::
|
||||
# cp -f /usr/local/usralgo/usralgomain.c $(PWD)
|
||||
all:
|
||||
$(MAKE) -C $(KSRC) SUBDIRS=$(PWD) modules
|
||||
# mv -f usralgo.ko ../../bin/Debug/
|
||||
|
||||
#modules:
|
||||
# @echo "$(CFLAGS)"
|
||||
|
||||
bclean::
|
||||
$(RM) *.o .*.o.d .*.o.cmd *.ko *.log
|
||||
$(RM) -R .tmp*
|
||||
$(RM) .runinfo
|
||||
rm -rf .runinfo .tmp* .*.o.d .*.o.cmd .*.cmd *.o *.ko *.mod.c *.i *.so Module.symvers modules.order
|
||||
|
||||
clean::
|
||||
$(RM) *.o .*.o.d .*.o.cmd *.ko
|
||||
$(RM) -R .tmp*
|
||||
$(RM) .runinfo
|
||||
rm -rf .runinfo .tmp* .*.o.d .*.o.cmd .*.cmd *.o *.ko *.mod.c *.i *.so Module.symvers modules.order
|
||||
|
||||
dbg:
|
||||
@echo PATH $(PATH)
|
||||
8
usrServo/sampleKernelModule/Makefile.Ubuntu
Normal file
8
usrServo/sampleKernelModule/Makefile.Ubuntu
Normal file
@@ -0,0 +1,8 @@
|
||||
obj-m += hello.o
|
||||
|
||||
all:
|
||||
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
|
||||
# make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules V=1
|
||||
|
||||
clean:
|
||||
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
|
||||
21
usrServo/sampleKernelModule/hello.c
Normal file
21
usrServo/sampleKernelModule/hello.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <linux/module.h> // included for all kernel modules
|
||||
#include <linux/kernel.h> // included for KERN_INFO
|
||||
#include <linux/init.h> // included for __init and __exit macros
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("Lakshmanan");
|
||||
MODULE_DESCRIPTION("A Simple Hello World module");
|
||||
|
||||
static int __init hello_init(void)
|
||||
{
|
||||
printk(KERN_INFO "Hello world!\n");
|
||||
return 0; // Non-zero return means that the module couldn't be loaded.
|
||||
}
|
||||
|
||||
static void __exit hello_cleanup(void)
|
||||
{
|
||||
printk(KERN_INFO "Cleaning up module.\n");
|
||||
}
|
||||
|
||||
module_init(hello_init);
|
||||
module_exit(hello_cleanup);
|
||||
Reference in New Issue
Block a user