Although the Raspberry Pi has gcc, you can compile the C + + program, but if the project is large, compiling with the Raspberry Pi will waste a lot of time, we can compile the program on the PC, then pass the executable file to the Raspberry Pi, execute the program, make full use of the resources on the PC and speed up the development progress.
- First need to build a cross-compiling environment on the PC, here I chose Cygwin as a cross-compilation environment, on the official website can be downloaded.
- installation program Cygwin
Download Arm-tool Chain
: Https://github.com/IanLinsdell/Raspberrypi
After the download is done, unzip one of the HARDFP to be pressurized, extract to Cygwin under the working directory formed below:
Cygwin/opt/cross/x-tools/arm-unknown-linux-gnueabi
At this point, the PC-side cross-compilation environment is built.
- To test whether the cross-compilation environment is installed correctly
Writing programs (with floating-point arithmetic)
Cross-compiling at the Cygwin terminal
- Passing executable programs to our Raspberry Pi
Here I'm using a Samba shared folder to complete the communication between the Raspberry Pi and the PC
Copy the file to a shared directory and open the Samba service on the Raspberry Pi for file download:
Program runs successfully, proving that the program is based on ARM's
So later we in the development of large-scale embedded programs, you can consider the use of cross-compilation, and then through the SFTP, samba and other ways to transfer executable files on the embedded device, the whole process is relatively convenient and efficient.
Raspberry Pi Cross-compilation Environment build (Win 7)