Wow. Let me start by saying getting the right combination of tools setup to do this took more time than learning and writing my first few lines of ARM assembly.
Each of the links below has install and config instructions, so I’m not going to cover all of these again here, but here’s the combination of tools that worked for me:
An alternative toolchain could be the GNU Tools for ARM Embedded, but I couldn’t get my (simple) assembly to compile without unfathomable errors using this one (I tried this first before I tried the Sorcery toolchain).
Couple of quick notes as a reminder. I’ll come back with some further notes of using a cross-compiler tool chain with Eclipse C/C++ when I have time:
Compile to object code:
as example.s -o example.o
Link to an executable:
ld -o example example.o
Just as the dd command can be used to create a disk image of an SD card on the Mac (see here), you can use dd to write a downloaded (or backup) disk image to an SD card too:
sudo dd of=/dev/rdiskx if=/path/to/image bs=1m
where x is the disk number as shown by diskutils list.
Given that SD cards have a limited lifetime for writes, using an SD card for a harddrive for Pi may not be the smartest idea in terms of reliability or longevity, so asking how you back up your SD card is a good question. There’s some good answers here.
Specifically on the Mac, find out the disk number of the attached sd card with :
then use the dd command:
dd if=/dev/rdiskx of=/path/to/image bs=1m
where x is the disk number listed from diskutil.