This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/PROCESSOR-SDK-AM57X: AM57X

Part Number: PROCESSOR-SDK-AM57X

Tool/software: Linux

I am using the AM57X SDK on Linux (using Phytec SOM) and have a PCIe card that I am trying to install and access.  The PCIe card is a demo board for an FPGA and supplies a drive (written in C) and they provide instructions for compiling.  Here is the makefile:

obj-m :=pci_driver.o

KDIR= /lib/modules/$(shell uname -r)/build
all:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
rm -rf $(wildcard *.o *.ko mo* Mo* *.mod.c )

The make doesn't work as the build directory is not in the Linux that booted.  How do I compile this driver so I can install it in Linux?

Thanks.

  • Hi Allen,

    Here is a link to shout tutorial about how to add your Linux driver to kernel:
    hardikpatelblogs.wordpress.com/.../

    BR
    Tsvetolin Shulev
  • Hi, Allen,

    You are building natively, right? Would it work if you create the build directory? Ubuntu has build -> /usr/src/linux-headers-3.13.0-24-generic/. I am not sure if there is any other dependency though. If it doesn't work, you may need to modify the makefile to crosscompile in the linux host machine.

    Rex
  • Allen,

    Just took another look at the filesystem. I don't think you can do native build. The kernel source code is not included in the filesystem unlike ubuntu. The "make modules" will fail if build natively. You'll need to build in host machine using cross-compiler.

    Rex
  • Rex,

    I am new to compiling on Linux. I do have CCS installed and can write programs that execute on the target. Is this something I would compile in CCS?

    Thanks,

    Allen
  • Allen,

    We don't use CCS for Linux cross-compilation. CCS mostly is used for ARM RTOS compilation.
    Please refer to ProcSDK Kernel User's Guide for cross-compiling on a Linux host machine.
    software-dl.ti.com/.../Foundational_Components_Kernel_Users_Guide.html

    I wrote some benchmark utility a while back and wrote my own Makefile as shown below for your reference. You may need to modify the package makefile so that it uses the correct header files and libraries (the cross-compiler ones), etc. They are specified in LDFLAGS (-L) and CFLAGS (-I). GCC needs to point to cross-compiler. You also need to set up according to the PSDK kernel User's Guide. If you need info on makefile, there are plenty info on internet. Hope these info are helpful.


    SDK_INSTALL_DIR = ~/work/ti-processor-sdk-linux-am57xx-evm-04.03.00.05
    RTOS_INSTALL_DIR = ~/work/ti-processor-sdk-rtos-am57xx-evm-04.03.00.05
    CMEM_DIR = $(SDK_INSTALL_DIR)/board-support/extra-drivers/cmem-mod-4.14.01.00+gitAUTOINC+b687f3c365
    IPC_INSTALL_DIR = $(RTOS_INSTALL_DIR)/ipc_3_47_02_00

    LDLIBS = -lc -lrt -lticmem

    LDFLAGS = -L$(IPC_INSTALL_DIR)/linux/src/api/.libs/ \
    -L$(IPC_INSTALL_DIR)/linux/src/utils/.libs \
    -L$(IPC_INSTALL_DIR)/linux/src/transport/.libs \
    -L$(CMEM_INSTALL_DIR)/src/cmem/api/.libs


    CFLAGS = $(DEFINES) -c -O3 -I$(CMEM_DIR)/include/ti -I$(SDK_INSTALL_DIR)/linux-devkit/sysroots/x86_64-arago-linux/lib $(LDLIBS)
    CFLAGS += -I$(IPC_INSTALL_DIR)/linux/include -I$(IPC_INSTALL_DIR)/packages -I$(CMEM_INSTALL_DIR)/include


    GCC = arm-linux-gnueabihf-gcc
    LD = arm-linux-gnueabihf-gcc

    memcpy_bench : test.o
    $(LD) $(LDFLAGS) test.o -o memcpy_bench $(LDLIBS)

    %.o: %.c
    $(GCC) $(CFLAGS) -o $@ $<

    clean:
    rm *.o
    rm memcpy_bench
  • Rex,

    I tried putting together a make file, but am getting errors, but I have been able to use CCS to successfully compile code on host Ubuntu, copy to and execute it on the target board.  I followed instructions from TI to do this.

    My issue now is the PCI driver includes linux/module.h, which includes linux/preempt,h, which includes asm/preempt.h.  The asm/preempt.h is not found and I can't determine the correct file for it.  There are several in the SDK directories, but how do I know which is the right one?  There are a couple of more header files that can't be found as well asm/current.h and asm/uaccess.h.

    I am thinking I would also have these issues if I used the gcc makefile as well, but not sure.

    Any direction you can give is appreciated.

    Thanks, Allen

  • Allen,

    Usually if it is asm/, it should be hardware related and under arch/. I think the asm/preempt.h is the one in ./arm/include/generated/asm/preempt.h. It has generated/ in the path, that means the kernel need to be built first.
    Please give it a try.

    Rex