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.

Custom modules on am3517

Other Parts Discussed in Thread: AM3517

Hi everyone,

I am new at linux. And i have an am3517. I was able to install angstrom and build a filesystem with buildroot.

Now, i have to write and compile custom module. First,

i found a simple hello world example module. But at this example they compile the module with gcc. Bu i have to compile it with angstrom toolchain.

How can i do this ? or is there anyway to do that?

you can find the example here  http://tldp.org/HOWTO/Module-HOWTO/x839.html

Thanks in advance,

  • In the example that you have, the module is being built on an x86 Linux host and it expects to run on that same x86 machine.  So if you use the Linux host machine x86 gcc compiler, the module will not run on the Arm.  In the angstrom toolchain there should be a cross compiler for compiling Arm modules/applications.  You just need to set up your environment so that the call to "gcc" goes to the Arm cross compiler instead of the normal Linux gcc compiler.  In the AM3517 SDK there is a cross compiler built in and there is an environment script that sets up the path so that the command "gcc" becomes "arm-arago-linux-gnueabi-gcc".  Find your cross-compiler and try issuing the compile command with the full path to the cross-compiler instead of "gcc".

    Greg

  • The AM3517 SDK can be found here:

    http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/sdk/AM3517/latest/index_FDS.html

    After it is installed, the cross-compile tools will be in a sub-dir called "linux-devkit".  There is an environment setup script that will re-direct the "gcc" command to the cross-compiler.

    user@laptop:~/ti-sdk-am335x-evm-05.04.00.00/linux-devkit$ ls -l arm-arago-linux-gnueabi/bin/
    total 0
    lrwxrwxrwx 1 user user 43 2012-02-01 04:41 addr2line -> ../../bin/arm-arago-linux-gnueabi-addr2line
    lrwxrwxrwx 1 user user 36 2012-02-01 04:41 ar -> ../../bin/arm-arago-linux-gnueabi-ar
    lrwxrwxrwx 1 user user 36 2012-02-01 04:41 as -> ../../bin/arm-arago-linux-gnueabi-as
    lrwxrwxrwx 1 user user 37 2012-02-01 04:41 cc -> ../../bin/arm-arago-linux-gnueabi-gcc
    lrwxrwxrwx 1 user user 41 2012-02-01 04:41 c++filt -> ../../bin/arm-arago-linux-gnueabi-c++filt
    lrwxrwxrwx 1 user user 37 2012-02-01 04:41 cpp -> ../../bin/arm-arago-linux-gnueabi-cpp
    lrwxrwxrwx 1 user user 37 2012-02-01 04:41 g++ -> ../../bin/arm-arago-linux-gnueabi-g++
    lrwxrwxrwx 1 user user 37 2012-02-01 04:41 gcc -> ../../bin/arm-arago-linux-gnueabi-gcc
    lrwxrwxrwx 1 user user 40 2012-02-01 04:41 gccbug -> ../../bin/arm-arago-linux-gnueabi-gccbug
    lrwxrwxrwx 1 user user 38 2012-02-01 04:41 gcov -> ../../bin/arm-arago-linux-gnueabi-gcov
    lrwxrwxrwx 1 user user 39 2012-02-01 04:41 gprof -> ../../bin/arm-arago-linux-gnueabi-gprof
    lrwxrwxrwx 1 user user 36 2012-02-01 04:41 ld -> ../../bin/arm-arago-linux-gnueabi-ld
    lrwxrwxrwx 1 user user 36 2012-02-01 04:41 nm -> ../../bin/arm-arago-linux-gnueabi-nm
    lrwxrwxrwx 1 user user 41 2012-02-01 04:41 objcopy -> ../../bin/arm-arago-linux-gnueabi-objcopy
    lrwxrwxrwx 1 user user 41 2012-02-01 04:41 objdump -> ../../bin/arm-arago-linux-gnueabi-objdump
    lrwxrwxrwx 1 user user 40 2012-02-01 04:41 ranlib -> ../../bin/arm-arago-linux-gnueabi-ranlib
    lrwxrwxrwx 1 user user 41 2012-02-01 04:41 readelf -> ../../bin/arm-arago-linux-gnueabi-readelf
    lrwxrwxrwx 1 user user 38 2012-02-01 04:41 size -> ../../bin/arm-arago-linux-gnueabi-size
    lrwxrwxrwx 1 user user 41 2012-02-01 04:41 strings -> ../../bin/arm-arago-linux-gnueabi-strings
    lrwxrwxrwx 1 user user 39 2012-02-01 04:41 strip -> ../../bin/arm-arago-linux-gnueabi-strip
    user@laptop:~/ti-sdk-am335x-evm-05.04.00.00/linux-devkit$ ls
    arm-arago-linux-gnueabi  bin  environment-setup  etc  i686-linux  include  lib  libexec  mkspecs  README  share  site-config  usr  version
    user@laptop:~/ti-sdk-am335x-evm-05.04.00.00/linux-devkit$

  • Hi Hakan,

    Below post have the details on how test application can be build (cross compile) as module

    http://e2e.ti.com/support/embedded/linux/f/354/t/156496.aspx#567559

    Regards

    AnilKumar

    Please mark this Forum post as answered via the Verify Answer button below if it helps answer your question.  Thanks!

  • Thanks Anil,

    But i have some problems with my tool-chain prefix.

    i have create the make file 

    obj-m += hello.o
    /home/developer/workdir/Angstrom/angstrom/arm
    all:
    make -C /home/developer/Desktop/xukr-20120201-omap3/linux-2.6.37-tn M=/home/developer/Desktop/module_test ARCH=arm CROSS_COMPILE=angstrom-linux-gnueabi- modules

    clean:
    make -C /home/developer/Desktop/xukr-20120201-omap3/linux-2.6.37-tn M=/home/developer/Desktop/module_test clean

    But when i give the "make" command, it says 
    /bin/sh: angstrom-linux-gnueabi-gcc: not found
    am i missing something ? i am really new at this, sorry for that. 
    
    
    Thanks,
  • Hi Hakan,

    Add tool chain installation path to PATH

    export PATH=/opt/arago/arago-2011.09/armv7a/bin/:$PATH

    Or you can add to ~/.bashrc file (From next login onwards it will export the path).

    cd /home/developer/Desktop/module_test

    vi Makefile (add obj-m += hello.o)

    Then issue this command for compilation
    make -C /home/developer/Desktop/xukr-20120201-omap3/linux-2.6.37-tn
    M=$PWD ARCH=arm CROSS_COMPILE=angstrom-linux-gnueabi-

    To run the module, at command prompt:

    $ insmod hello.ko

    Regards

    AnilKumar

    Please mark this Forum post as answered via the Verify Answer button below if it helps answer your question.  Thanks!