Pion production excitation functions in proton-nucleus collisions from the absolute threshold to 500 MeV