Project

General

Profile

Sample Project Creation

The example project we will create/add to Eclipse is the "readsysid" example which is hosted on our GIT repository. An initial "pull" of this repository is on the VM for both the 5CSX and 5CSE versions.

readsysid 5CSX GIT: http://support.criticallink.com/gitweb/?p=mitysom-5cs/mitysom_5csx_dev_board.git;a=summary
readsysid 5CSX VM Directory: /home/user/projects/mitysom_5csx_dev_board/base_project/
readsysid 5CSE GIT: http://support.criticallink.com/gitweb/?p=mitysom-5cs/mitysom_5cse_dev_board.git;a=summary
readsysid 5CSE VM Directory: /home/user/projects/mitysom_5cse_dev_board/dev_exp_5cse_l2_3y8_base

The following steps are to build the 5CSE example project for the Cylcone V SE based modules.

  1. Open a new terminal window and 'cd' to either the 5CSE base project (readsysid)
    user@MitySOM-Dev:~$ cd projects/mitysom_5cse_dev_board/dev_exp_5cse_l2_3y8_base/
    
  2. Ensure that the sample project directory is up to date compared to the GIT source repository using the "git pull" command
    user@MitySOM-Dev:~/projects/mitysom_5cse_dev_board/dev_exp_5cse_l2_3y8_base$ git pull 
    Already up-to-date.
    
  3. Install "autoconf" package if not already installed
    user@MitySOM-Dev:~/projects/mitysom_5cse_dev_board/dev_exp_5cse_l2_3y8_base/software/readsysid$ sudo apt-get install autoconf
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    autoconf is already the newest version.
    0 upgraded, 0 newly installed, 0 to remove and 310 not upgraded.
    
  4. In the project directory for readsysid make a new file named "configure.ac" (attached) and then copy the text below into the file. Note that we modified the file package name to be 5cse_readsysid, version to be 1.0 and the SRCDIR entry to be sysid.cpp as the "unique" file.
    user@MitySOM-Dev:~/projects/mitysom_5cse_dev_board/dev_exp_5cse_l2_3y8_base/software/readsysid$ touch autoconf.ac
    

    # This is David A. Wheeler's template for configure.ac, showing
    # some suggested options and setups.
    
    # Process this file with autoconf to produce a configure script.
    
    # Initialize autoconf.
    AC_INIT([5cse_readsysid], [1.0], [BUG-REPORT-ADDRESS],
            [TAR-NAME], [URL])
    # Force autoconf to be at least this version number:
    AC_PREREQ([2.68])
    # Safety check - list a source file that wouldn't be in other directories:
    AC_CONFIG_SRCDIR([sysid.cpp])
    # Put configuration results here, so we can easily #include them:
    AC_CONFIG_HEADERS([config.h])
    # Put autotools auxiliary files in subdirectories to reduce clutter:
    AC_CONFIG_AUX_DIR([build-aux])
    AC_CONFIG_MACRO_DIR([m4])
    
    # Enable "automake" to simplify creating makefiles:
    AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror])
    AC_CONFIG_FILES([Makefile])
    
    # Checks for programs, e.g., AC_PROG_CC
    # Uncomment for C++
    AC_PROG_CXX
    # Uncomment for C
    #AC_PROG_CC
    
    # Checks for libraries.
    # Uncomment for librt, will auto add -lrt
    #AC_CHECK_LIB([rt], [clock_gettime])
    # Uncomment for libpthread, will auto add -lpthread
    #AC_CHECK_LIB([pthread], [pthread_create])
    
    # Checks for header files.
    # Example header checks
    #AC_CHECK_HEADERS([fcntl.h stdlib.h string.h termios.h unistd.h])
    
    # Checks for typedefs, structures, and compiler characteristics.
    #AC_CHECK_HEADER_STDBOOL
    
    # Checks for library functions.
    #AC_CHECK_FUNCS([memset])
    
    # Do final output.
    AC_OUTPUT
    
  5. In the project directory for readsysid make a new file named "Makefile.am" (attached) and then copy the text below into the file
    user@MitySOM-Dev:~/projects/mitysom_5cse_dev_board/dev_exp_5cse_l2_3y8_base/software/readsysid$ touch Makefile.am
    

    bin_PROGRAMS = main
    # List programs source files
    main_SOURCES = main.cpp sysid.cpp sysid.h sysid_regs.h
    
    #main_CPPFLAGS = 
    #main_CFLAGS = 
    #main_CXXFLAGS = 
    #main_LDFLAGS = 
    #main_LDADD = 
    
    ACLOCAL_AMFLAGS = -I m4 --install
    
  6. In the project directory for readsysid make 4 new files by typing in the command below, they are empty for our example.
    user@MitySOM-Dev:~/projects/mitysom_5cse_dev_board/dev_exp_5cse_l2_3y8_base/software/readsysid$ touch AUTHORS ChangeLog COPYING INSTALL NEWS README
    
  7. Confirm that everything has been entered correctly by running autoreconf from the terminal
    user@MitySOM-Dev:~/projects/mitysom_5cse_dev_board/dev_exp_5cse_l2_3y8_base/software/readsysid$ autoreconf -i
    
  8. Then configure the project for cross-compilation for the ARM processor
    user@MitySOM-Dev:~/projects/mitysom_5cse_dev_board/dev_exp_5cse_l2_3y8_base/software/readsysid$ ./configure --host=arm-linux-gnueabihf
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for arm-linux-gnueabihf-strip... no
    checking for strip... strip
    checking for a thread-safe mkdir -p... /bin/mkdir -p
    checking for gawk... no
    checking for mawk... mawk
    checking whether make sets $(MAKE)... yes
    checking whether make supports nested variables... yes
    checking for arm-linux-gnueabihf-g++... no
    checking for arm-linux-gnueabihf-c++... no
    checking for arm-linux-gnueabihf-gpp... no
    checking for arm-linux-gnueabihf-aCC... no
    checking for arm-linux-gnueabihf-CC... no
    checking for arm-linux-gnueabihf-cxx... no
    checking for arm-linux-gnueabihf-cc++... no
    checking for arm-linux-gnueabihf-cl.exe... no
    checking for arm-linux-gnueabihf-FCC... no
    checking for arm-linux-gnueabihf-KCC... no
    checking for arm-linux-gnueabihf-RCC... no
    checking for arm-linux-gnueabihf-xlC_r... no
    checking for arm-linux-gnueabihf-xlC... no
    checking for g++... g++
    checking whether the C++ compiler works... yes
    checking for C++ compiler default output file name... a.out
    checking for suffix of executables... 
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C++ compiler... yes
    checking whether g++ accepts -g... yes
    checking for style of include used by make... GNU
    checking dependency style of g++... gcc3
    checking that generated files are newer than configure... done
    configure: creating ./config.status
    config.status: creating Makefile
    config.status: creating config.h
    config.status: config.h is unchanged
    config.status: executing depfiles commands
    
    
  9. Then make the application
    user@MitySOM-Dev:~/projects/mitysom_5cse_dev_board/dev_exp_5cse_l2_3y8_base/software/readsysid$ make
    make  all-am
    make[1]: Entering directory `/home/user/projects/mitysom_5cse_dev_board/dev_exp_5cse_l2_3y8_base/software/readsysid'
    depbase=`echo main.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
        g++ -DHAVE_CONFIG_H -I.     -g -O2 -MT main.o -MD -MP -MF $depbase.Tpo -c -o main.o main.cpp &&\
        mv -f $depbase.Tpo $depbase.Po
    depbase=`echo sysid.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
        g++ -DHAVE_CONFIG_H -I.     -g -O2 -MT sysid.o -MD -MP -MF $depbase.Tpo -c -o sysid.o sysid.cpp &&\
        mv -f $depbase.Tpo $depbase.Po
    g++  -g -O2   -o main main.o sysid.o  
    make[1]: Leaving directory `/home/user/projects/mitysom_5cse_dev_board/dev_exp_5cse_l2_3y8_base/software/readsysid'
    
  10. Follow this Wiki to make an autotools project of the readsysid example in Eclipse.

Go to top
Add picture from clipboard (Maximum size: 1 GB)