Sunday, May 26, 2013

how to ssh Raspberry Pi with MacOSX


The ssh should be a default package with the RPi. You could check the service by the command.
ps -aux | grep sshed
 If you can't find the service, you could simply install it by the apt-get command.
sudo apt-get install ssh
  And what you have to do is to start the service.
sudo /etc/init.d/ssh start
  Sometime you may want to restart the service.
sudo /etc/init.d/ssh restart
  Then you could ssh from the Macos host side.

  ssh pi@ // you may have to check the ip from the RPi terminal first by the ifconfig command.

  You may want to force the ssh run every time bootup. Run this command once:

sudo update-rc.d ssh defaultssudo reboot

  How to debug if ssh doesn't work.
i) After the RPi is boot up, checking the sshd is running or not. If it is not running, just simply restart the service.
ii) Try to ping the RPi fro the host side.
iii) If the connection is still refused, try to clear the rsa key on the RPi & try again. These are the commands with the root privilege.
sudo -i
root@raspberrypi:/home/pi# ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key

root@raspberrypi:/home/pi# ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key

root@raspberrypi:/home/pi# ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key

service sshd reload.

  If you want to install the ssh from start, there is a good tutorial.

http://youtu.be/SmMMKojOE4U 


Saturday, May 25, 2013

Setup arm tool chain for RaspBerry-Pi (with MacOSX host)

Installing the ARM Toolchain

1) Simply download the tool chain package from the link.

https://github.com/downloads/UnhandledException/ARMx/ARMx-2009q3-67.tar.bz2

2) un-tar the package /opt/arm-linux-tools

3) add the tool chain path to the system path env & update the PATH env, e.g.
export PATH=/opt/arm-linux-tools/bin:$PATH

4) This is an option to install the eclipse as a IDE. http://www.eclipse.org/downloads/
Any Eclipse IDE for C / C + + Developers are OK. My version is


Eclipse IDE for C/C++ Developers
Version: Juno Service Release 2


5) After the eclipse, simply go to the HELP menu and checks for the update.

6) Now you could new a C project and set up the cross compile env.

7) Go to the project explorer & select the properties. Set up the cross compiler to "arm-none-linux-gnueabi-" & the cross compiler path.


8) You could add your source codes by New command & then Source File. e.g. main.c

#include
int main(void) {
printf("Hello World!\n");
return 0;
}


9) Then you could compile the program by Build command & verify the compiled codes with command  "arm-none-linux-gnueabi-objdump -t filename" on your host console.

10) You could not run your code in the host as it is a arm executable. 

11) You have to ftp the code to your lovely RPi & you have to setup the ftp server on the RPi but it is not difficult. And then execute the program on the target.



12) You could even setup the remote debugger in the eclipse ^_^