I have an old wall in need of a paint. It's in pretty bad shape having been subject to a lot of direct sun and rain. Here are some pics:
How should I prepare the wall for painting to ensure this coat lasts and doesn't peel?
The first step would be to strip off as much of the old paint as possible. The best way I've found to do this on stucco or concrete is to use a wire brush bit in an electric drill.
Second (and most important), it looks like you have some areas with significant cracks in them, so you'll also want to repair or fill the cracks in order to prevent them from allowing moisture into the stucco. This appears to have been the main contributor to paint failing in the past - note how all of the areas of peeling paint run along the cracks. When the stucco is allowed to absorb moisture, it gradually destroys its bond with the primer.
Finally, use a high quality masonry and stucco primer to ensure a well bonded base coat.