views:

443

answers:

3

Does anyone know of a good introductory textbook on the PowerPC architecture and assembly language that I could recommend to people on my team?

Our company now mostly targets a particular PPC platform for our realtime application, and some of the younger programmers on my team are struggling a bit with release-mode debugging and use of intrinsics. I think this is because they never had a clear, ground-up education on processor organization and the RISC instruction set, so I'd like to provide them with a textbook that can help them bootstrap into a complete understanding of registers, condition codes, and an ability to read assembly code. (Writing it isn't so important; what they really need is to be able to parse the "disassembly" pane of the debugger.)

I was thinking of something like Dr. Richard Paul's SPARC Architecture, Assembly Programming, except targeting the PPC instead of the SPARC, since they haven't got a SPARC assembler to practice on. I don't want to just point them at IBM's PEM, because that isn't a very good tutorial; more important is a gentle introduction to the basics of RISC registers and calling conventions, before they get into the details of the PPC's particular quirks and instruction set.

I also considered starting them on x86 assembly (we target Intel too) and then doing an internal lecture or two on the differences between that and RISC, but x86 asm is such a mess that it seems like it would be an even more confusing place to start.

+1  A: 

When I was in school we used Hennessy and Patterson, which focuses on the MIPS architecture, and talks a little bit about PowerPC. At least MIPS has an available free simulator (SPIM), although I never found it to be as useful as an actual eval board. (For this class we designed and implemented our own 4-bit architectures, rather than 32-bit MIPS)

Matt Kane
A: 

If you can find one (it is no longer in print), I'd highly recommend "Optimizing Powerpc Code: Programming the Powerpc Chip in Assembly Language" by Gary Kacmarcik. This lists each instruction and gives an example of how its used.

Although "Programming Environments Manual for 32-Bit Implementations of the PowerPC™ Architecture" is a must-have resource as well. It fully documents all the features of the PowerPC architecture as well as each instruction. It isn't as easily understood as "Optimizing Powerpc Code" though.

kroylar
+5  A: 

I've been working on PowerPC embedded products for the past ten years. I also hire co-ops through a local university and every six months I need to bring a new group of 4 co-ops up to speed on RTOS concepts, PPC architectures, etc...

I used the Paul and Hennessey books when I was in college. They are great books, but to date I have not found anything similar for the PPC architecture.

To be honest, I have been using materials from the web coupled together with all of the PPC books and guides available from Freescale. The Freescale Literature Distribution will gladly send you any documentation you need, and most of it is free. I have compiled a "New Engineers Handbook" which is essentially a list of my favorite reading materials. Here is a sampling:

PowerPC Compiler Writer's Guide

PowerPC Function Calls

PowerPC Stack Attacks from Phrack Magazine #49 (sorry no link, just Google it)

Looking at a PowerPC 860 Stack Frame Under VxWorks

One thing I love to do with the co-ops is have them write code that causes a stack corruption using a buffer overflow. Then have them decode the results stack trace. I have them use an old PPC based Mac for this task. Compiling and debugging on this platform is much easier and faster than having them do it on our real embedded target. In my experience, having them get their hands dirty decoding stack frames and pouring through assembly code is the best way to learn. Honestly, most of the architecture books although enlightening are pretty dry and just results in bored students. If you want to motivate your new engineers get the working on the PowerPC and show them this stuff in action, it's a lot more interesting than reading about it :)

-djhaus

DJ Haus