diff --git a/src/drv/rts-logger/module/Makefile b/src/drv/rts-logger/module/Makefile index 3454b02453fd7516568e9a03cfe0a77730f2f67a..ce5c39daab8b5fd067c51f7fd6f6a956d0644926 100644 --- a/src/drv/rts-logger/module/Makefile +++ b/src/drv/rts-logger/module/Makefile @@ -4,7 +4,7 @@ mkfile_dir := $(dir $(mkfile_path)) # obj-m specifie we're a kernel module. obj-m += rts-logger.o -EXTRA_CFLAGS += -I$(mkfile_dir)/../../../include/ -I$(mkfile_dir) +ccflags-y += -I$(mkfile_dir)/../../../include/ -I$(mkfile_dir) # Set the path to the Kernel build utils. KBUILD=/lib/modules/$(shell uname -r)/build/ diff --git a/src/drv/rts-logger/test/Makefile b/src/drv/rts-logger/test/Makefile index dedd9beaa666431d27245db783b3eeafd0509572..8734ef92b20fa17511e7d240075d7b60a0f66f7c 100644 --- a/src/drv/rts-logger/test/Makefile +++ b/src/drv/rts-logger/test/Makefile @@ -3,11 +3,11 @@ mkfile_dir := $(dir $(mkfile_path)) KBUILD_EXTRA_SYMBOLS += $(mkfile_dir)/../module/Module.symvers -EXTRA_CFLAGS += -I$(mkfile_dir)/../../../include/ - # obj-m specifie we're a kernel module. obj-m += logger-test.o +ccflags-y += -I$(mkfile_dir)/../../../include/ + # Set the path to the Kernel build utils. KBUILD=/lib/modules/$(shell uname -r)/build/ diff --git a/src/epics/util/lib/createKernelModuleBuildEnv.pm b/src/epics/util/lib/createKernelModuleBuildEnv.pm index 74bc7d4152b78517301975750a4f3af581d7a1f2..21c25f3f0a096b782abd6a464da8443244ecf667 100644 --- a/src/epics/util/lib/createKernelModuleBuildEnv.pm +++ b/src/epics/util/lib/createKernelModuleBuildEnv.pm @@ -48,29 +48,29 @@ print OUTM "KBUILD_EXTRA_SYMBOLS += $::rtsloggerfile\n"; print OUTM "KBUILD_EXTRA_SYMBOLS += \$(mkfile_dir)/../../../utils/ModuleIOP.symvers\n"; -print OUTM "EXTRA_CFLAGS += -std=gnu11 \n"; -print OUTM "EXTRA_CFLAGS += -O \n"; -print OUTM "EXTRA_CFLAGS += -Wno-date-time \n"; -print OUTM "EXTRA_CFLAGS += -Wno-declaration-after-statement #Off explicitly because kbuild sets it on\n"; -print OUTM "EXTRA_CFLAGS += -Wframe-larger-than=4096 #KBuild'd default is 2048, but we are making it a bit larger\n"; -print OUTM "EXTRA_CFLAGS += -Wno-unused-function #Pattern of c file inclusion and usage of some of the functions makes this a hard fix\n"; -print OUTM "EXTRA_CFLAGS += -I$::rcg_src_dir/src/drv/\n"; +print OUTM "ccflags-y += -std=gnu11 \n"; +print OUTM "ccflags-y += -O \n"; +print OUTM "ccflags-y += -Wno-date-time \n"; +print OUTM "ccflags-y += -Wno-declaration-after-statement #Off explicitly because kbuild sets it on\n"; +print OUTM "ccflags-y += -Wframe-larger-than=4096 #KBuild'd default is 2048, but we are making it a bit larger\n"; +print OUTM "ccflags-y += -Wno-unused-function #Pattern of c file inclusion and usage of some of the functions makes this a hard fix\n"; +print OUTM "ccflags-y += -I$::rcg_src_dir/src/drv/\n"; # set vectorization level if($::vectorization eq "avx512") { print "vectorization set to avx512\n"; - print OUTM "EXTRA_CFLAGS += -march=native -mavx512f -mavx512bw -mavx512cd -mavx512dq -mfma \n"; + print OUTM "ccflags-y += -march=native -mavx512f -mavx512bw -mavx512cd -mavx512dq -mfma \n"; } elsif($::vectorization eq "avx2") { print "vectorization set to avx2\n"; - print OUTM "EXTRA_CFLAGS += -march=native -mavx2 -mfma\n"; + print OUTM "ccflags-y += -march=native -mavx2 -mfma\n"; } elsif($::vectorization eq "sse3") { print "vectorization set to sse3\n"; - print OUTM "EXTRA_CFLAGS += -march=native -msse3 -mfma\n"; + print OUTM "ccflags-y += -march=native -msse3 -mfma\n"; } elsif($::vectorization eq "none") { @@ -84,27 +84,27 @@ else -print OUTM "EXTRA_CFLAGS += -D"; +print OUTM "ccflags-y += -D"; print OUTM "\U$::skeleton"; print OUTM "_CODE\n"; -print OUTM "EXTRA_CFLAGS += -DFE_HEADER=\\\"\L$::skeleton.h\\\"\n"; +print OUTM "ccflags-y += -DFE_HEADER=\\\"\L$::skeleton.h\\\"\n"; # Model uses FIR filters if($::useFIRs) { - print OUTM "EXTRA_CFLAGS += -DFIR_FILTERS\n"; + print OUTM "ccflags-y += -DFIR_FILTERS\n"; } -print OUTM "EXTRA_CFLAGS += -g\n"; +print OUTM "ccflags-y += -g\n"; if ($::remoteGPS) { - print OUTM "EXTRA_CFLAGS += -DREMOTE_GPS\n"; + print OUTM "ccflags-y += -DREMOTE_GPS\n"; } if ($::requireIOcnt) { print OUTM "#Comment out to disenable exact IO module count requirement\n"; - print OUTM "EXTRA_CFLAGS += -DREQUIRE_IO_CNT\n"; + print OUTM "ccflags-y += -DREQUIRE_IO_CNT\n"; } else { print OUTM "#Uncomment to enable exact IO module count requirement\n"; - print OUTM "#EXTRA_CFLAGS += -DREQUIRE_IO_CNT\n"; + print OUTM "#ccflags-y += -DREQUIRE_IO_CNT\n"; } if (0 == $::dac_testpoint_names && 0 == $::extraTestPoints && 0 == $::filtCnt) { print "Not compiling DAQ into the front-end\n"; @@ -115,71 +115,71 @@ if ($::edcu) { } if ($::no_daq) { print OUTM "#Comment out to enable DAQ\n"; - print OUTM "EXTRA_CFLAGS += -DNO_DAQ\n"; + print OUTM "ccflags-y += -DNO_DAQ\n"; } # Set to flip polarity of ADC input signals if ($::flipSignals) { - print OUTM "EXTRA_CFLAGS += -DFLIP_SIGNALS=1\n"; + print OUTM "ccflags-y += -DFLIP_SIGNALS=1\n"; } # Set BIQUAD as default starting RCG V2.8 - print OUTM "EXTRA_CFLAGS += -DALL_BIQUAD=1 -DCORE_BIQUAD=1\n"; + print OUTM "ccflags-y += -DALL_BIQUAD=1 -DCORE_BIQUAD=1\n"; if ($::rfmDelay >= 0) { - print OUTM "EXTRA_CFLAGS += -DRFM_DELAY=$::rfmDelay\n"; + print OUTM "ccflags-y += -DRFM_DELAY=$::rfmDelay\n"; } -print OUTM "EXTRA_CFLAGS += -DMODEL_RATE_HZ=$::modelrateHz\n"; +print OUTM "ccflags-y += -DMODEL_RATE_HZ=$::modelrateHz\n"; #********* END OF COMMON COMPILE OPTIONS if ($::iopModel > -1) { #************ SETUP FOR IOP *************** - print OUTM "EXTRA_CFLAGS += -DIOP_MODEL\n"; - print OUTM "EXTRA_CFLAGS += -DSLOW_ADC_SAMPLE_RATE_POW_2=16\n"; - print OUTM "EXTRA_CFLAGS += -DFAST_ADC_SAMPLE_RATE_POW_2=$::fastAdcSampleRate_2power\n"; + print OUTM "ccflags-y += -DIOP_MODEL\n"; + print OUTM "ccflags-y += -DSLOW_ADC_SAMPLE_RATE_POW_2=16\n"; + print OUTM "ccflags-y += -DFAST_ADC_SAMPLE_RATE_POW_2=$::fastAdcSampleRate_2power\n"; $modelType = "IOP"; if($::diagTest > -1) { - print OUTM "EXTRA_CFLAGS += -DDIAG_TEST\n"; + print OUTM "ccflags-y += -DDIAG_TEST\n"; } if($::internalclk) { - print OUTM "EXTRA_CFLAGS += -DUSE_ADC_CLOCK\n"; + print OUTM "ccflags-y += -DUSE_ADC_CLOCK\n"; } # Invoked if IOP cycle rate slower than ADC clock rate - print OUTM "EXTRA_CFLAGS += -DUNDERSAMPLE=$::clock_div\n"; + print OUTM "ccflags-y += -DUNDERSAMPLE=$::clock_div\n"; $adccopyrate = $::modelrateHz / $::adcclockHz; - print OUTM "EXTRA_CFLAGS += -DADC_MEMCPY_RATE=$adccopyrate\n"; + print OUTM "ccflags-y += -DADC_MEMCPY_RATE=$adccopyrate\n"; #Following used for IOP running at 128K if($::adcclockHz ==131072) { - print OUTM "EXTRA_CFLAGS += -DIOP_IO_RATE=131072\n"; + print OUTM "ccflags-y += -DIOP_IO_RATE=131072\n"; } else { - print OUTM "EXTRA_CFLAGS += -DIOP_IO_RATE=65536\n"; + print OUTM "ccflags-y += -DIOP_IO_RATE=65536\n"; } #Following used for testing if($::dacWdOverride > -1) { - print OUTM "EXTRA_CFLAGS += -DDAC_WD_OVERRIDE\n"; + print OUTM "ccflags-y += -DDAC_WD_OVERRIDE\n"; } #Following set to run as standard kernel module if ($::no_cpu_shutdown > 0) { - print OUTM "EXTRA_CFLAGS += -DNO_CPU_SHUTDOWN\n"; + print OUTM "ccflags-y += -DNO_CPU_SHUTDOWN\n"; } else { - print OUTM "#EXTRA_CFLAGS += -DNO_CPU_SHUTDOWN\n"; + print OUTM "#ccflags-y += -DNO_CPU_SHUTDOWN\n"; } # ADD DAC_AUTOCAL to IOPs - print OUTM "EXTRA_CFLAGS += -DDAC_AUTOCAL\n"; + print OUTM "ccflags-y += -DDAC_AUTOCAL\n"; # Set to run without LIGO timing system if ($::no_sync == 1) { - print OUTM "EXTRA_CFLAGS += -DNO_SYNC\n"; + print OUTM "ccflags-y += -DNO_SYNC\n"; } # Test mode to force sync to 1pps even if TDS present if ($::test1pps == 1) { - print OUTM "EXTRA_CFLAGS += -DTEST_1PPS\n"; + print OUTM "ccflags-y += -DTEST_1PPS\n"; } # Set to run IOP as time master for the Dolphin Network if ($::dolphin_time_xmit > -1) { @@ -188,7 +188,7 @@ if ($::iopModel > -1) { #************ SETUP FOR IOP *************** die "Error: Model is configured to transmit dolphin time (dolphin_time_xmit) but is not configured to be a dolphin node (pciRfm)."; } - print OUTM "EXTRA_CFLAGS += -DXMIT_DOLPHIN_TIME=1\n"; + print OUTM "ccflags-y += -DXMIT_DOLPHIN_TIME=1\n"; } # Set to run IOP as time receiver on the Dolphin Network if ($::dolphinTiming > -1 or $::virtualiop == 2) { @@ -196,67 +196,67 @@ if ($::iopModel > -1) { #************ SETUP FOR IOP *************** { die "Error: Model is configured to receive dolphin time (dolphin_time_rcvr) but is not configured to be a dolphin node (pciRfm)."; } - print OUTM "EXTRA_CFLAGS += -DUSE_DOLPHIN_TIMING\n"; - print OUTM "EXTRA_CFLAGS += -DNO_DAC_PRELOAD=1\n"; + print OUTM "ccflags-y += -DUSE_DOLPHIN_TIMING\n"; + print OUTM "ccflags-y += -DNO_DAC_PRELOAD=1\n"; } # Set to run IOP on internal clock ie no IO modules if ($::virtualiop == 1) { - print OUTM "EXTRA_CFLAGS += -DRUN_WO_IO_MODULES=1\n"; - print OUTM "EXTRA_CFLAGS += -DNO_DAC_PRELOAD=1\n"; + print OUTM "ccflags-y += -DRUN_WO_IO_MODULES=1\n"; + print OUTM "ccflags-y += -DNO_DAC_PRELOAD=1\n"; } # Set IOP to map Dolphin Networks # Dolphin Gen2 is the default if ($::virtualiop != 1) { if ($::pciNet > 0) { - print OUTM "EXTRA_CFLAGS += -DDOLPHIN_TEST=1\n"; + print OUTM "ccflags-y += -DDOLPHIN_TEST=1\n"; } } if ($::optimizeIO) { - print OUTM "EXTRA_CFLAGS += -DNO_DAC_PRELOAD=1\n"; + print OUTM "ccflags-y += -DNO_DAC_PRELOAD=1\n"; } if ($::lhomid) { - print OUTM "EXTRA_CFLAGS += -DADD_SEC_ON_START=1\n"; + print OUTM "ccflags-y += -DADD_SEC_ON_START=1\n"; } #Non-zero in cases where there is a large delay in querying the time - print OUTM "EXTRA_CFLAGS += -DTIME0_DELAY_US=$::time0_delay_us\n"; + print OUTM "ccflags-y += -DTIME0_DELAY_US=$::time0_delay_us\n"; } # End of IOP compile options if ($::iopModel < 1) { #************ SETUP FOR USER APP *************** - print OUTM "EXTRA_CFLAGS += -DCONTROL_MODEL\n"; - print OUTM "EXTRA_CFLAGS += -DUNDERSAMPLE=1\n"; - print OUTM "EXTRA_CFLAGS += -DADC_MEMCPY_RATE=1\n"; + print OUTM "ccflags-y += -DCONTROL_MODEL\n"; + print OUTM "ccflags-y += -DUNDERSAMPLE=1\n"; + print OUTM "ccflags-y += -DADC_MEMCPY_RATE=1\n"; $modelType = "CONTROL"; if ($::noZeroPad) { - print OUTM "EXTRA_CFLAGS += -DNO_ZERO_PAD=1\n"; + print OUTM "ccflags-y += -DNO_ZERO_PAD=1\n"; } if ($::biotest) { - print OUTM "EXTRA_CFLAGS += -DDIO_TEST=1\n"; + print OUTM "ccflags-y += -DDIO_TEST=1\n"; } #Following used with IOP running at 128K if($::adcclockHz ==131072) { - print OUTM "EXTRA_CFLAGS += -DIOP_IO_RATE=131072\n"; + print OUTM "ccflags-y += -DIOP_IO_RATE=131072\n"; if($::modelrateHz < 131072) { my $drate = 131072/$::modelrateHz; if($drate == 8 or $drate == 2 ) { die "RCG does not support a user model rate $::modelrateHz" . " Hz with IOP data at $::adcclockHz" ." Hz\n" ; } - print OUTM "EXTRA_CFLAGS += -DOVERSAMPLE\n"; - print OUTM "EXTRA_CFLAGS += -DOVERSAMPLE_DAC\n"; - print OUTM "EXTRA_CFLAGS += -DOVERSAMPLE_TIMES=$drate\n"; - print OUTM "EXTRA_CFLAGS += -DFE_OVERSAMPLE_COEFF=feCoeff$drate"."x\n"; + print OUTM "ccflags-y += -DOVERSAMPLE\n"; + print OUTM "ccflags-y += -DOVERSAMPLE_DAC\n"; + print OUTM "ccflags-y += -DOVERSAMPLE_TIMES=$drate\n"; + print OUTM "ccflags-y += -DFE_OVERSAMPLE_COEFF=feCoeff$drate"."x\n"; } } #Following used with IOP running at 64K (NORMAL) if($::adcclockHz ==65536) { - print OUTM "EXTRA_CFLAGS += -DIOP_IO_RATE=65536\n"; + print OUTM "ccflags-y += -DIOP_IO_RATE=65536\n"; if($::modelrateHz < 65536) { my $drate = 65536/$::modelrateHz; @@ -264,25 +264,25 @@ if ($::iopModel < 1) { #************ SETUP FOR USER APP *************** die "RCG does not support a user model rate $::modelrateHz" . " Hz with IOP data at $::adcclockHz" ." Hz\n" ; } - print OUTM "EXTRA_CFLAGS += -DOVERSAMPLE\n"; - print OUTM "EXTRA_CFLAGS += -DOVERSAMPLE_DAC\n"; - print OUTM "EXTRA_CFLAGS += -DOVERSAMPLE_TIMES=$drate\n"; - print OUTM "EXTRA_CFLAGS += -DFE_OVERSAMPLE_COEFF=feCoeff$drate"."x\n"; + print OUTM "ccflags-y += -DOVERSAMPLE\n"; + print OUTM "ccflags-y += -DOVERSAMPLE_DAC\n"; + print OUTM "ccflags-y += -DOVERSAMPLE_TIMES=$drate\n"; + print OUTM "ccflags-y += -DFE_OVERSAMPLE_COEFF=feCoeff$drate"."x\n"; } } } #******************* END SETUP FOR USER APP -print OUTM "EXTRA_CFLAGS += -DMODULE -DNO_RTL=1\n"; -print OUTM "EXTRA_CFLAGS += -I\$(SUBDIRS)/../../../models/" . "\L$::skeleton" . "/include -I$::rcg_src_dir/src/include\n"; -print OUTM "EXTRA_CFLAGS += -I$::rcg_src_dir/src/fe/demod\n"; -print OUTM "EXTRA_CFLAGS += -ffast-math -m80387 -msse2 -fno-builtin-sincos -mpreferred-stack-boundary=4\n"; +print OUTM "ccflags-y += -DMODULE -DNO_RTL=1\n"; +print OUTM "ccflags-y += -I\$(SUBDIRS)/../../../models/" . "\L$::skeleton" . "/include -I$::rcg_src_dir/src/include\n"; +print OUTM "ccflags-y += -I$::rcg_src_dir/src/fe/demod\n"; +print OUTM "ccflags-y += -ffast-math -m80387 -msse2 -fno-builtin-sincos -mpreferred-stack-boundary=4\n"; print OUTM "\n"; if ($::extra_cflags) { print OUTM "# Extra CFLAGS from cdsParameters in the model:\n"; - print OUTM "EXTRA_CFLAGS += $::extra_cflags\n"; + print OUTM "ccflags-y += $::extra_cflags\n"; }