move md to haml
This commit is contained in:
50
arm/overview.html.haml
Normal file
50
arm/overview.html.haml
Normal file
@ -0,0 +1,50 @@
|
||||
%hr/
|
||||
%p
|
||||
layout: arm
|
||||
title: Arm resources
|
||||
—
|
||||
%h2#arm-is-the-target Arm is the target
|
||||
%p
|
||||
So, since the first target is arm, some of us may need to learn a bit (yep, that’s me). So this is
|
||||
a collection of helpful resources (links and specs) with sometimes very very brief summaries.
|
||||
%p So why learn assembler, after all, it’s likely you spent your programmers life avoiding it:
|
||||
%ul
|
||||
%li Some things can not be expressed in ruby
|
||||
%li To speed things up.
|
||||
%li To add cpu specific capabilities
|
||||
%h2#links Links
|
||||
%p
|
||||
A very good
|
||||
%a{:href => "/arm/arm_inst.pdf"} summary pdf
|
||||
was created by the arm university, which i converted
|
||||
to
|
||||
%a{:href => "/arm/target.html"} html for online reading
|
||||
%p
|
||||
%a{:href => "http://www.davespace.co.uk/arm/introduction-to-arm/why-learn.html"} Dave’s
|
||||
site explains just about
|
||||
everything about the arm in nice and easy to understand terms.
|
||||
%p
|
||||
A nice series on thinkgeek, here is the integer
|
||||
%a{:href => "http://thinkingeek.com/2013/08/11/arm-assembler-raspberry-pi-chapter-15/"} division section
|
||||
that has a
|
||||
%a{:href => "https://github.com/rofirrim/raspberry-pi-assembler/blob/master/chapter15/magic.py"} code respository
|
||||
with code to generate code for constants.
|
||||
%p
|
||||
And off course there is the overwhelming arm infocenter,
|
||||
%a{:href => "http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0473c/CEGECDGD.html"} here with it’s bizarre division
|
||||
%p
|
||||
The full 750 page specification for the pi , the
|
||||
%a{:href => "/arm/big_spec.pdf"} ARM1176JZF-S pdf is here
|
||||
or
|
||||
%a{:href => "http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0553a/BABFADHJ.html"} online
|
||||
%p
|
||||
A nice list of
|
||||
%a{:href => "http://docs.cs.up.ac.za/programming/asm/derick_tut/syscalls.html"} Kernel calls
|
||||
\## Virtual pi
|
||||
%p
|
||||
And since not everyone has access to an arm, here is a description how to set up an
|
||||
%a{:href => "/arm/qemu.html"} emulated pi
|
||||
%p
|
||||
And how to
|
||||
%a{:href => "/arm/remote_pi.html"} access that
|
||||
or any remote machine with ssl
|
@ -1,39 +0,0 @@
|
||||
---
|
||||
layout: arm
|
||||
title: Arm resources
|
||||
---
|
||||
|
||||
## Arm is the target
|
||||
|
||||
So, since the first target is arm, some of us may need to learn a bit (yep, that's me). So this is
|
||||
a collection of helpful resources (links and specs) with sometimes very very brief summaries.
|
||||
|
||||
So why learn assembler, after all, it's likely you spent your programmers life avoiding it:
|
||||
|
||||
- Some things can not be expressed in ruby
|
||||
- To speed things up.
|
||||
- To add cpu specific capabilities
|
||||
|
||||
## Links
|
||||
|
||||
A very good [summary pdf](/arm/arm_inst.pdf) was created by the arm university, which i converted
|
||||
to [html for online reading](/arm/target.html)
|
||||
|
||||
[Dave's](http://www.davespace.co.uk/arm/introduction-to-arm/why-learn.html) site explains just about
|
||||
everything about the arm in nice and easy to understand terms.
|
||||
|
||||
A nice series on thinkgeek, here is the integer [division section](http://thinkingeek.com/2013/08/11/arm-assembler-raspberry-pi-chapter-15/) that has a
|
||||
[code respository](https://github.com/rofirrim/raspberry-pi-assembler/blob/master/chapter15/magic.py)
|
||||
with code to generate code for constants.
|
||||
|
||||
And off course there is the overwhelming arm infocenter, [here with it's bizarre division](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0473c/CEGECDGD.html)
|
||||
|
||||
The full 750 page specification for the pi , the [ARM1176JZF-S pdf is here](/arm/big_spec.pdf) or
|
||||
[online](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0553a/BABFADHJ.html)
|
||||
|
||||
A nice list of [Kernel calls](http://docs.cs.up.ac.za/programming/asm/derick_tut/syscalls.html)
|
||||
## Virtual pi
|
||||
|
||||
And since not everyone has access to an arm, here is a description how to set up an [emulated pi](/arm/qemu.html)
|
||||
|
||||
And how to [access that](/arm/remote_pi.html) or any remote machine with ssl
|
103
arm/qemu.html.haml
Normal file
103
arm/qemu.html.haml
Normal file
@ -0,0 +1,103 @@
|
||||
%hr/
|
||||
%p
|
||||
layout: arm
|
||||
title: How to configure Qemu
|
||||
—
|
||||
%h2#target-pi-on-mac Target Pi on Mac
|
||||
%p So even the idea is to run software on the Pi, not everyone has a Pi (yet :-)
|
||||
%p Others, like me, prefer to develop on a laptop and not carry the Pi around.
|
||||
%p For all those, this here explains how to emulate the Pi on a Mac.
|
||||
%p
|
||||
Even if you have a Pi,
|
||||
%a{:href => "/remote_pi.html"} this explains
|
||||
a nice way to develop with it.
|
||||
%h3#replace-the-buggy-llvm Replace the buggy llvm
|
||||
%p Written April 2014: as of writing the latest and greatest llvm based gcc (5.1) on Maverick (10.9) has a bug that makes qemu hang.
|
||||
%p So type gcc -v and if the output contains “LLVM version 5.1”, you must install gcc4.2. Easily done with homebrew:
|
||||
%pre
|
||||
%code
|
||||
:preserve
|
||||
brew install https://raw.github.com/Homebrew/homebrew-dupes/master/apple-gcc42.rb
|
||||
%p This will not interfere with the systems compiler as the gcc4.2 has postfixed executables (ie gcc-4.2)
|
||||
%h3#qemu Qemu
|
||||
%p Then its time to get the Qemu. There may be other emulators out there, and i have read of armulator, but this is what i found discribed and it works and is “easy enough”.
|
||||
%pre
|
||||
%code
|
||||
:preserve
|
||||
brew install qemu --env=std --cc=gcc-4.2
|
||||
%p For people not on Maverick it may work without the -cc option.
|
||||
%h3#pi-images Pi images
|
||||
%p Create a directory for the stuff on your mac, ie pi.
|
||||
%p Get the latest Raspian image.
|
||||
%p There seems to be some chicken and egg problem, so quemu needs the kernel seperately. There is one in the links.
|
||||
%h3#configure Configure
|
||||
%p
|
||||
In the blog post there is some fun configuration, I did it and it works. Not sure what happens if you don’t.
|
||||
The booting is described below (you may or may not need an extra init=/bin/bash in the root… quotes), so boot your Pi and then configure:
|
||||
%p nano /etc/ld.so.preload
|
||||
%p Put a # in front of the first to comment it out. Should just be one line there.
|
||||
%p Press ctrl-x then y then enter to save and exit.
|
||||
%p (Optional) Create a file /etc/udev/rules.d/90-qemu.rules with the following content:
|
||||
%pre
|
||||
%code
|
||||
:preserve
|
||||
KERNEL=="sda", SYMLINK+="mmcblk0"
|
||||
KERNEL=="sda?", SYMLINK+="mmcblk0p%n"
|
||||
KERNEL=="sda2", SYMLINK+="root"
|
||||
%p
|
||||
The kernel sees the disk as /dev/sda, while a real pi sees /dev/mmcblk0.
|
||||
This will create symlinks to be more consistent with the real pi.
|
||||
%h3#boot Boot
|
||||
%p There is quite a bit to the command line to boot the pi (i have an alias), here it is:
|
||||
%pre
|
||||
%code
|
||||
:preserve
|
||||
qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append 'root=/dev/sda2 panic=1 rootfstype=ext4 rw' -hda raspbian.img -redir tcp:2222::22
|
||||
%ul
|
||||
%li the cpu is what braodcom precifies, ok
|
||||
%li memory is unfortuantely hardcoded in the versatilepb “machine”
|
||||
%li the kernel is the file name of the kernel you downloaded (or extracted)
|
||||
%li raspbian.img is the image you downloaded. Renamed as it probably had the datestamp on it
|
||||
%li the redir redircts the port 2222 to let you log into the pi
|
||||
%p So
|
||||
%pre
|
||||
%code
|
||||
:preserve
|
||||
ssh -p 2222 -l pi localhost
|
||||
%p will get you “in”. Ie username pi (password raspberry is the default) and port 2222
|
||||
%p Qemu bridges the network (that it emulates), and so your pi is now as connected as your mac.
|
||||
%h3#more-disk More Disk
|
||||
%p The image that you download has only 200Mb free. Since the gcc is included and we’re developing (tiny little files of) ruby, this may be ok. If not there is a 3 step procedure to up the space.
|
||||
%pre
|
||||
%code
|
||||
:preserve
|
||||
dd if=/dev/zero bs=1m count=2048 >> raspbian.img
|
||||
%p The 2048 gets you 2Gb as we specified 1m (meg).
|
||||
%p On the pi launch
|
||||
%pre
|
||||
%code
|
||||
:preserve
|
||||
sudo fdisk /dev/sda
|
||||
%p This will probably only work if your do the (Optional) config above.
|
||||
%p
|
||||
Say p, and write down the start of the second partition (122880 for me).
|
||||
d 2 will delete the second partition
|
||||
n p 2 will create a new primary second partition
|
||||
write the number as start and just return to the end.
|
||||
p to check
|
||||
w to write and quit.
|
||||
%p Reboot, and run
|
||||
%pre
|
||||
%code
|
||||
:preserve
|
||||
resize2fs
|
||||
%h2#links Links
|
||||
%p
|
||||
Blog post:
|
||||
%a{:href => "http://xecdesign.com/qemu-emulating-raspberry-pi-the-easy-way/"} http://xecdesign.com/qemu-emulating-raspberry-pi-the-easy-way/
|
||||
%p
|
||||
Kernel:
|
||||
%a{:href => "http://xecdesign.com/downloads/linux-qemu/kernel-qemu"} http://xecdesign.com/downloads/linux-qemu/kernel-qemu
|
||||
%p
|
||||
Rasbian file system(preferably be torrent):
|
||||
%a{:href => "http://www.raspberrypi.org/downloads/"} http://www.raspberrypi.org/downloads/
|
116
arm/qemu.md
116
arm/qemu.md
@ -1,116 +0,0 @@
|
||||
---
|
||||
layout: arm
|
||||
title: How to configure Qemu
|
||||
---
|
||||
|
||||
## Target Pi on Mac
|
||||
|
||||
|
||||
So even the idea is to run software on the Pi, not everyone has a Pi (yet :-)
|
||||
|
||||
Others, like me, prefer to develop on a laptop and not carry the Pi around.
|
||||
|
||||
For all those, this here explains how to emulate the Pi on a Mac.
|
||||
|
||||
Even if you have a Pi, [this explains](/remote_pi.html) a nice way to develop with it.
|
||||
|
||||
### Replace the buggy llvm
|
||||
|
||||
|
||||
Written April 2014: as of writing the latest and greatest llvm based gcc (5.1) on Maverick (10.9) has a bug that makes qemu hang.
|
||||
|
||||
So type gcc -v and if the output contains "LLVM version 5.1", you must install gcc4.2. Easily done with homebrew:
|
||||
|
||||
brew install https://raw.github.com/Homebrew/homebrew-dupes/master/apple-gcc42.rb
|
||||
|
||||
This will not interfere with the systems compiler as the gcc4.2 has postfixed executables (ie gcc-4.2)
|
||||
|
||||
### Qemu
|
||||
|
||||
Then its time to get the Qemu. There may be other emulators out there, and i have read of armulator, but this is what i found discribed and it works and is "easy enough".
|
||||
|
||||
brew install qemu --env=std --cc=gcc-4.2
|
||||
|
||||
For people not on Maverick it may work without the -cc option.
|
||||
|
||||
### Pi images
|
||||
|
||||
Create a directory for the stuff on your mac, ie pi.
|
||||
|
||||
Get the latest Raspian image.
|
||||
|
||||
There seems to be some chicken and egg problem, so quemu needs the kernel seperately. There is one in the links.
|
||||
|
||||
### Configure
|
||||
|
||||
In the blog post there is some fun configuration, I did it and it works. Not sure what happens if you don't.
|
||||
The booting is described below (you may or may not need an extra init=/bin/bash in the root... quotes), so boot your Pi and then configure:
|
||||
|
||||
nano /etc/ld.so.preload
|
||||
|
||||
Put a # in front of the first to comment it out. Should just be one line there.
|
||||
|
||||
Press ctrl-x then y then enter to save and exit.
|
||||
|
||||
(Optional) Create a file /etc/udev/rules.d/90-qemu.rules with the following content:
|
||||
|
||||
KERNEL=="sda", SYMLINK+="mmcblk0"
|
||||
KERNEL=="sda?", SYMLINK+="mmcblk0p%n"
|
||||
KERNEL=="sda2", SYMLINK+="root"
|
||||
|
||||
The kernel sees the disk as /dev/sda, while a real pi sees /dev/mmcblk0.
|
||||
This will create symlinks to be more consistent with the real pi.
|
||||
|
||||
### Boot
|
||||
|
||||
There is quite a bit to the command line to boot the pi (i have an alias), here it is:
|
||||
|
||||
qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append 'root=/dev/sda2 panic=1 rootfstype=ext4 rw' -hda raspbian.img -redir tcp:2222::22
|
||||
|
||||
- the cpu is what braodcom precifies, ok
|
||||
- memory is unfortuantely hardcoded in the versatilepb "machine"
|
||||
- the kernel is the file name of the kernel you downloaded (or extracted)
|
||||
- raspbian.img is the image you downloaded. Renamed as it probably had the datestamp on it
|
||||
- the redir redircts the port 2222 to let you log into the pi
|
||||
|
||||
So
|
||||
|
||||
ssh -p 2222 -l pi localhost
|
||||
|
||||
will get you "in". Ie username pi (password raspberry is the default) and port 2222
|
||||
|
||||
Qemu bridges the network (that it emulates), and so your pi is now as connected as your mac.
|
||||
|
||||
### More Disk
|
||||
|
||||
The image that you download has only 200Mb free. Since the gcc is included and we're developing (tiny little files of) ruby, this may be ok. If not there is a 3 step procedure to up the space.
|
||||
|
||||
dd if=/dev/zero bs=1m count=2048 >> raspbian.img
|
||||
|
||||
The 2048 gets you 2Gb as we specified 1m (meg).
|
||||
|
||||
On the pi launch
|
||||
|
||||
sudo fdisk /dev/sda
|
||||
|
||||
This will probably only work if your do the (Optional) config above.
|
||||
|
||||
Say p, and write down the start of the second partition (122880 for me).
|
||||
d 2 will delete the second partition
|
||||
n p 2 will create a new primary second partition
|
||||
write the number as start and just return to the end.
|
||||
p to check
|
||||
w to write and quit.
|
||||
|
||||
Reboot, and run
|
||||
|
||||
resize2fs
|
||||
|
||||
Links
|
||||
-----
|
||||
|
||||
Blog post: [http://xecdesign.com/qemu-emulating-raspberry-pi-the-easy-way/](http://xecdesign.com/qemu-emulating-raspberry-pi-the-easy-way/)
|
||||
|
||||
Kernel: [http://xecdesign.com/downloads/linux-qemu/kernel-qemu](http://xecdesign.com/downloads/linux-qemu/kernel-qemu)
|
||||
|
||||
Rasbian file system(preferably be torrent): [http://www.raspberrypi.org/downloads/](http://www.raspberrypi.org/downloads/)
|
58
arm/remote_pi.html.haml
Normal file
58
arm/remote_pi.html.haml
Normal file
@ -0,0 +1,58 @@
|
||||
%hr/
|
||||
%p
|
||||
layout: arm
|
||||
title: How to use a remote pi
|
||||
—
|
||||
%h3#headless Headless
|
||||
%p The pi is a strange mix, development board and full pc in one. Some people use it as a pc, but not me.
|
||||
%p I use the pi because it is the same price as an Arduino, but much more powerful.
|
||||
%p As such i don’t use the keyboard or display and that is called headless mode, logging in with ssh.
|
||||
%pre
|
||||
%code
|
||||
:preserve
|
||||
ssh -p 2222 -l pi localhost
|
||||
%p the -p 2222 is only needed for the qemu version, not the real pi.
|
||||
%h3#authorized Authorized
|
||||
%p
|
||||
Over ssh one can use many other tools, but the password soon gets to be a pain.
|
||||
So the first thing i do is copy my public key over to the pi. This will allow login without password.
|
||||
%pre
|
||||
%code
|
||||
:preserve
|
||||
scp -P 2222 .ssh/id_rsa.pub pi@localhost:.ssh/authorized_keys
|
||||
%p
|
||||
This assumes a fresh pi, otherwise you have to append your key to the authorized ones. Also if it complains about no
|
||||
id_rsa.pub then you have to generate a key pair (public/private) using ssh-keygen (no password, otherwise you’ll be typing that)
|
||||
%h3#syncing Syncing
|
||||
%p
|
||||
Off course I do all that to be able to actually work on my machine. On the Pi my keyboard doesn’t even work and
|
||||
i’d have to use emacs or nano instead of TextMate. So i need to get the files accross.
|
||||
For this there is a million ways, but since i just go one way (mac to pi) i use rsync (over ssh).
|
||||
%p I set up a directory (home) in my pi directory (on the mac), that i copy to the home directory on the pi using:
|
||||
%pre
|
||||
%code
|
||||
:preserve
|
||||
rsync -r -a -v -e "ssh -l pi -p 2222" ~/pi/home/ localhost:/home/pi
|
||||
%p The pi/home is on my laptop and the command transfers all files to /home/pi , the default directory of the pi user.
|
||||
%h3#automatic-sync Automatic sync
|
||||
%p Transferring files is off course nice, but having to do it by hand after saving quickly becomes tedious.
|
||||
%p Fswatch to the rescue. It will watch the filesystem (fs) for changes. Install with brew install fswatch
|
||||
%p
|
||||
Then you can store the above rsync command in a shell script, say sync.sh.
|
||||
Add afplay “/System/Library/Sounds/Morse.aiff” if you like to know it worked.
|
||||
%p Then just run
|
||||
%pre
|
||||
%code
|
||||
:preserve
|
||||
fswatch ~/pi/home/ sync.sh
|
||||
%p And hear the ping each time you save.
|
||||
%h2#conclusion Conclusion
|
||||
%p So the total setup involves the qemu set up as described. To work i
|
||||
%ul
|
||||
%li start the terminal (iterm)
|
||||
%li start the pi, with my alias “pi” *
|
||||
%li log in to the pi in it’s window
|
||||
%li open textmate with the directory i work (within the home)
|
||||
%li
|
||||
%p edit, save, wait for ping, alt-tab to pi window, run my whatever and repeat until it’s time for tea
|
||||
%li (i don’t log into the prompt it gives in item so as not to accidentally quit the qemu session with ctr-c )
|
@ -1,66 +0,0 @@
|
||||
---
|
||||
layout: arm
|
||||
title: How to use a remote pi
|
||||
---
|
||||
|
||||
### Headless
|
||||
|
||||
The pi is a strange mix, development board and full pc in one. Some people use it as a pc, but not me.
|
||||
|
||||
I use the pi because it is the same price as an Arduino, but much more powerful.
|
||||
|
||||
As such i don't use the keyboard or display and that is called headless mode, logging in with ssh.
|
||||
|
||||
ssh -p 2222 -l pi localhost
|
||||
|
||||
the -p 2222 is only needed for the qemu version, not the real pi.
|
||||
|
||||
### Authorized
|
||||
|
||||
Over ssh one can use many other tools, but the password soon gets to be a pain.
|
||||
So the first thing i do is copy my public key over to the pi. This will allow login without password.
|
||||
|
||||
scp -P 2222 .ssh/id_rsa.pub pi@localhost:.ssh/authorized_keys
|
||||
|
||||
This assumes a fresh pi, otherwise you have to append your key to the authorized ones. Also if it complains about no
|
||||
id_rsa.pub then you have to generate a key pair (public/private) using ssh-keygen (no password, otherwise you'll be typing that)
|
||||
|
||||
### Syncing
|
||||
|
||||
Off course I do all that to be able to actually work on my machine. On the Pi my keyboard doesn't even work and
|
||||
i'd have to use emacs or nano instead of TextMate. So i need to get the files accross.
|
||||
For this there is a million ways, but since i just go one way (mac to pi) i use rsync (over ssh).
|
||||
|
||||
I set up a directory (home) in my pi directory (on the mac), that i copy to the home directory on the pi using:
|
||||
|
||||
rsync -r -a -v -e "ssh -l pi -p 2222" ~/pi/home/ localhost:/home/pi
|
||||
|
||||
The pi/home is on my laptop and the command transfers all files to /home/pi , the default directory of the pi user.
|
||||
|
||||
### Automatic sync
|
||||
|
||||
Transferring files is off course nice, but having to do it by hand after saving quickly becomes tedious.
|
||||
|
||||
Fswatch to the rescue. It will watch the filesystem (fs) for changes. Install with brew install fswatch
|
||||
|
||||
Then you can store the above rsync command in a shell script, say sync.sh.
|
||||
Add afplay "/System/Library/Sounds/Morse.aiff" if you like to know it worked.
|
||||
|
||||
Then just run
|
||||
|
||||
fswatch ~/pi/home/ sync.sh
|
||||
|
||||
And hear the ping each time you save.
|
||||
|
||||
Conclusion
|
||||
----------
|
||||
|
||||
So the total setup involves the qemu set up as described. To work i
|
||||
|
||||
- start the terminal (iterm)
|
||||
- start the pi, with my alias "pi" *
|
||||
- log in to the pi in it's window
|
||||
- open textmate with the directory i work (within the home)
|
||||
- edit, save, wait for ping, alt-tab to pi window, run my whatever and repeat until it's time for tea
|
||||
|
||||
* (i don't log into the prompt it gives in item so as not to accidentally quit the qemu session with ctr-c )
|
1318
arm/target.html
1318
arm/target.html
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user