Cross-Compiling for RaspBerry Pi

前端 未结 6 875
既然无缘
既然无缘 2021-02-04 08:43

With a RaspBerry Pi and from my computer, I\'m trying to cross-compile a simple helloWorld written in C++. I\'m using Code Sourcery toolchain for linux to compile.

When

相关标签:
6条回答
  • 2021-02-04 09:12

    The problem was to use ASCII mode instead of binary mode in my FTP transfers. Today I prefer to use SFTP (SSH). Thanks.

    0 讨论(0)
  • 2021-02-04 09:15

    My recommendation is here, http://hertaville.com/2012/09/28/development-environment-raspberry-pi-cross-compiler/ He does a good job on explaining how to use Eclipse to compile HelloWorld.cpp, download, and execute it in Raspberry pi board. Check it out.

    0 讨论(0)
  • 2021-02-04 09:23

    Using Visual studio and Visual GDB plugin you can download cross compiler for raspberry pi. After that you can create a ssh connection and also you can deploy your program remotely into raspberry pi.

    0 讨论(0)
  • 2021-02-04 09:25

    The reason why are you getting Segmentation fault error is different ABI. Raspberry Pi when running Raspbian is using linux-arm-gnueabihf ABI which assumes hardfp and VFP support in hardware (which is rare in ARMv6 environment) so requires some additional patches for GCC and EGLIBC (these patches can be found in Raspbian repository).

    Your Code Sourcery cross-toolchain most likely does not have these patches, so it's using another ABI (linux-arm-gnueabi) hence the crash at runtime (static linking works because kernel ABI does not depend on hardfp/softfp).

    Another possible reason why you may be getting Illegal Instruction error is Code Sourcery cross-toolchain configured for ARMv7 and Raspberry Pi is ARMv6. But in this case both static and dynamic linking will yield the same error.

    Here is a step-by-step guide how to build Raspberry Pi cross compiler in Windows, both hardfp/softfp ABI versions. Resulting cross-compiler supports C++ and does not depend on cygwin runtime library (cygwin1.dll).

    0 讨论(0)
  • 2021-02-04 09:34

    I'd recommend trying biicode, it automatically sets up the cross compiler environment for you and sends generated binaries to the raspberry after building

    0 讨论(0)
  • 2021-02-04 09:35

    You could try the toolchain at: https://github.com/kallaballa/Raspberry-GCC-4.7.3

    It's a pre-built gcc-4.7.3 toolchain for armv6 with hardfp using gnueabi. I'm using it to cross compile c++11 for a raspberrian target.

    Please note it only works on linux x86_64 hosts.

    0 讨论(0)
提交回复
热议问题