วันศุกร์ที่ 25 เมษายน พ.ศ. 2557

เตรียมเครื่อง Linux PC ไว้สำหรับเล่น raspberry pi

1. have linux pc (ubuntu11)
2. sudo apt-get update
3. sudo apt-get install build-essential git
4. mkdir rpi in home directory
5. cd rpi
6. sudo git clone git://github.com/raspberrypi/tools.git คำสั่งนี้จะ clone raspbian's official cross compile นานหน่อย
7. cd ~/
8. nano .bashrc
9. insert "export PATH=$PATH:$HOME/rpi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin" on the last line off file.
10. type source .bashrc for update path.
11. type "arm-linux-gnueabihf-gcc -v" for check it work or not.

12. install java runtime "sudo apt-get install openjdk-7-jre"
14. typically “~/Downloads/”)then type: “tar -xvzf eclipse-cpp-kepler-R-linux-gtk.tar.gz -C ~/
15. now u can use eclipse in "~/eclipse/eclipse &"
16. start new c++ project
17. next,next then In the “Cross compiler prefix” field type: “arm-linux-gnueabihf-”.
18. In the “Cross compiler path” field type the full path to the toolchain: “/home/kong/rpi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/”
19. after adding source code, build all
20. Lets go there via a console window with cd “cd ~/workspace/HelloRPiWorld/Debug/“. Type in “ls -al” the “HelloRPiWorld” Binary file is highlighted in green.
21. in eclipse program, To deploy the binary on the Raspberry Pi, make sure that the RPi board is powered and connected to your network. The next step is click on “Window->Show View->Other”. This will open a show view window. In this window select the “Remote Systems” folder and then select “Remote Systems Details” and press OK
22. If the “Remote Systems Details” shows up in the bottom of the workspace, drag it such that its tab shares  the same region as the project explorer tab
23. Now right click in the “Remote Systems Detail” area and click on “New Connection”. In the “Select Remote System Type” window, select “SSH only” then click “Next”
24. In the “Remote SSH Only System Connection” (Figure 9) type in the IP address of the RPi in the “Host name” field and give the connection a valid name in the “Connection name” field. I typed “Raspberry Pi”.  Then click “Finish”.
25. At this point a second device (Raspberry Pi) shows up in the “Remote Systems Detail” tab (Figure 10). Right click on the Raspberry Pi resource and click connect. You will be prompted to enter the username and password. Make sure that you utilize “username:pi” and “password:raspberry” (if you haven’t changed the default password). You may get a warning windows asking you if you are sure that you want to accept this connection. Affirm that you want to proceed with the connection. At this point you should be connected to your RPi from Eclipse.
26. Right click on the Raspberry Pi resource again  in the “Remote Systems Detail” tab and click on the “Show in Remote Systems View”. This will open a “Remote Systems” tab in the same region of the workspace. In this tab, one can navigate the root file systems of both the Local Linux OS and that of the Raspbian/Raspberry Pi.
27. Locate the HelloWorld Binary file on our local desktop PC and drag it to the home directory on the Raspberry Pi (You could also right click on the binary and click on “Copy” and then right click on the home folder in the Raspberry Pi and click “Paste”. This effectively copies the binary file to the home directory of the Raspberry Pi.
28. Now right click on the SSH terminal icon under the Raspberry Pi icon (Figure 11) in the  “Remote Systems” and select “Launch Terminal” . This should launch a terminal window in the bottom of the Eclipse workspace (Figure 12). This is basically a console / terminal window connected to the Raspberry Pi via SSH.
29. In the terminal window type “ls -al” to confirm that the “HelloWorld” binary indeed got copied into the home directory of the Raspberry Pi’s root file system. Then change the “HelloWorld” binary’s permission to make it executable: “chmod +x HelloWorld

ที่มา
http://www.lab4inf.fh-muenster.de/lab4inf/docs/Embedded-Software/Eclipse_Cross_Development.pdf
แสดงความคิดเห็น