robertofem / CycloneVSoC-examples

Examples using the Cyclone V SoC chip
GNU General Public License v3.0
104 stars 40 forks source link

Compile error while making DMA_PL330_LKM #11

Closed alirezazd closed 4 years ago

alirezazd commented 4 years ago

I get following error while trying to compile DMA_PL330_LKM for DE10-Nano kernel 4.5 using gcc cross compiler included in SoC EDS 18.1. before that i had to modify Makefile and add KBUILD_CFLAGS += -Wno-strict-prototypes -Wno-implicit-function-declaration to it to resolve some errors, also i got errors in DMA_PL330_LKM.c before '__ATTR()' call so i resolved it by adding following code at line 420 before the call:

#undef VERIFY_OCTAL_PERMISSIONS
#define VERIFY_OCTAL_PERMISSIONS(perms) (perms)

yet i still can't Make the DMA_PL330_LKM.

full output of make command:

make
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -C /home/alireza/Desktop/linux-socfpga M=/home/alireza/Desktop/CycloneVSoC-examples/Linux-modules/DMA_PL330_LKM modules
make[1]: Entering directory '/home/alireza/Desktop/linux-socfpga'
  CC [M]  /home/alireza/Desktop/CycloneVSoC-examples/Linux-modules/DMA_PL330_LKM/DMA_PL330_LKM.o
In file included from /home/alireza/Desktop/CycloneVSoC-examples/Linux-modules/DMA_PL330_LKM/DMA_PL330_LKM.c:24:0:
/home/alireza/Desktop/CycloneVSoC-examples/Linux-modules/DMA_PL330_LKM/alt_dma.h:86:5: warning: "ALT_DMA_PERIPH_PROVISION_I2C_SUPPORT" is not defined [-Wundef]
 #if ALT_DMA_PERIPH_PROVISION_I2C_SUPPORT
     ^
/home/alireza/Desktop/CycloneVSoC-examples/Linux-modules/DMA_PL330_LKM/alt_dma.h:738:5: warning: "ALT_DMA_PERIPH_PROVISION_I2C_SUPPORT" is not defined [-Wundef]
 #if ALT_DMA_PERIPH_PROVISION_I2C_SUPPORT
     ^
/home/alireza/Desktop/CycloneVSoC-examples/Linux-modules/DMA_PL330_LKM/DMA_PL330_LKM.c: In function ‘dev_write’:
/home/alireza/Desktop/CycloneVSoC-examples/Linux-modules/DMA_PL330_LKM/DMA_PL330_LKM.c:622:7: warning: unused variable ‘i’ [-Wunused-variable]
   int i;
       ^
  CC [M]  /home/alireza/Desktop/CycloneVSoC-examples/Linux-modules/DMA_PL330_LKM/alt_dma.o
In file included from /home/alireza/Desktop/CycloneVSoC-examples/Linux-modules/DMA_PL330_LKM/alt_dma.c:45:0:
/home/alireza/Desktop/CycloneVSoC-examples/Linux-modules/DMA_PL330_LKM/alt_dma.h:86:5: warning: "ALT_DMA_PERIPH_PROVISION_I2C_SUPPORT" is not defined [-Wundef]
 #if ALT_DMA_PERIPH_PROVISION_I2C_SUPPORT
     ^
/home/alireza/Desktop/CycloneVSoC-examples/Linux-modules/DMA_PL330_LKM/alt_dma.h:738:5: warning: "ALT_DMA_PERIPH_PROVISION_I2C_SUPPORT" is not defined [-Wundef]
 #if ALT_DMA_PERIPH_PROVISION_I2C_SUPPORT
     ^
In file included from arch/arm/include/generated/asm/current.h:1:0,
                 from include/linux/wait.h:9,
                 from include/linux/completion.h:11,
                 from include/linux/rcupdate.h:43,
                 from include/linux/rbtree.h:34,
                 from include/linux/vmalloc.h:8,
                 from include/asm-generic/io.h:704,
                 from ./arch/arm/include/asm/io.h:439,
                 from /home/alireza/Desktop/CycloneVSoC-examples/Linux-modules/DMA_PL330_LKM/alt_dma.c:49:
/home/alireza/Desktop/CycloneVSoC-examples/Linux-modules/DMA_PL330_LKM/alt_dma.c: In function ‘alt_dma_channel_kill’:
include/asm-generic/current.h:6:45: error: expected ‘)’ before ‘->’ token
 #define get_current() (current_thread_info()->task)
                                             ^
include/asm-generic/current.h:7:17: note: in expansion of macro ‘get_current’
 #define current get_current()
                 ^
/home/alireza/Desktop/CycloneVSoC-examples/Linux-modules/DMA_PL330_LKM/alt_dma.c:873:29: note: in expansion of macro ‘current’
     ALT_DMA_CHANNEL_STATE_t current;
                             ^
/home/alireza/Desktop/CycloneVSoC-examples/Linux-modules/DMA_PL330_LKM/alt_dma.c:927:9: warning: passing argument 2 of ‘alt_dma_channel_state_get’ from incompatible pointer type [enabled by default]
         status = alt_dma_channel_state_get(channel, &current);
         ^
In file included from /home/alireza/Desktop/CycloneVSoC-examples/Linux-modules/DMA_PL330_LKM/alt_dma.c:45:0:
/home/alireza/Desktop/CycloneVSoC-examples/Linux-modules/DMA_PL330_LKM/alt_dma.h:591:17: note: expected ‘enum ALT_DMA_CHANNEL_STATE_t *’ but argument is of type ‘struct task_struct **’
 ALT_STATUS_CODE alt_dma_channel_state_get(ALT_DMA_CHANNEL_t channel,
                 ^
/home/alireza/Desktop/CycloneVSoC-examples/Linux-modules/DMA_PL330_LKM/alt_dma.c:932:25: warning: comparison between pointer and integer [enabled by default]
         if (   (current == ALT_DMA_CHANNEL_STATE_KILLING)
                         ^
make[2]: *** [scripts/Makefile.build:259: /home/alireza/Desktop/CycloneVSoC-examples/Linux-modules/DMA_PL330_LKM/alt_dma.o] Error 1
make[1]: *** [Makefile:1391: _module_/home/alireza/Desktop/CycloneVSoC-examples/Linux-modules/DMA_PL330_LKM] Error 2
make[1]: Leaving directory '/home/alireza/Desktop/linux-socfpga'
make: *** [Makefile:19: modules] Error 2
alirezazd commented 4 years ago

I was using terasic kernel, after using altera kernel the issue resolved.