Find the answer to your Linux question:
Results 1 to 3 of 3
I have a project for work where I am trying to compile code using GCC but with a target for VxWorks. I do most of my coding using Windows as ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2012
    Posts
    1

    Compiling with GCC with a target for VxWorks


    I have a project for work where I am trying to compile code using GCC but with a target for VxWorks. I do most of my coding using Windows as that is what the company requires. I have compiled and used gcc a decent amount, but never switching targets or using VxWorks. Has anyone had any experience on how to set this up to do? I have been googling all over the place for it, but the only information I can find is many years old and is using very old versions of everything. I was rather hoping someone had since tried this type of thing and it isn't as involved as it was back then. Any help or direction is appreciated. Thanks so much.

  2. #2
    Just Joined! krokoziabla's Avatar
    Join Date
    Sep 2012
    Location
    Russia
    Posts
    20
    In short you need another compiler. The thing is usually if you use gcc on your machine it produces binaries which can be run on this machine. If you run
    Code:
    gcc -v
    you will see something like
    Code:
    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper
    Target: x86_64-linux-gnu
    Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
    Thread model: posix
    gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
    This is output from my gcc and you can see that the target is x86_64-linux-gnu.

    If you want to use your (host) machine to build binaries and run them on another machine (target) then you need a so-called cross-compiler. As to gcc you need just to install another version of gcc along with one you have which will produce binaries for VxWorks. I haven't dealt with cross-compilers for VxWorks but I've had experience with ThreadX RTOS kernel which usually runs on ARM processors. So I had to install one more gcc which had the name something like arm-linux-gcc (target-vendor-compiler) and use it to produce binaries which then I launched on a board with ARM9 processor.

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,737
    What is the target hardware - ARM, x86, MIPS? That is the critical thing. In any case, all GNU compilers can handle ELF object format for .o and library files, and on any platform such ELF code can be generated (by default these days). The key is in the linker stages where the code gets converted into binary machine code. My advice is to consult with the VxWorks team about what you need to do.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •